Compare commits

...

6 commits

Author SHA1 Message Date
DecafDev
c8a4c5fd29
Merge pull request #387 from decaf-dev/dev
1.47.4
2025-05-02 21:02:32 -06:00
DecafDev
2360454f4a chore: bump version 2025-05-02 21:02:11 -06:00
DecafDev
2df4bca0e4 chore: use node 22 2025-05-02 21:01:53 -06:00
DecafDev
239dd7903f
Merge pull request #386 from decaf-dev/dev
v1.47.3
2025-05-02 20:48:17 -06:00
DecafDev
911695e190 chore: bump version 2025-05-02 20:47:30 -06:00
DecafDev
afca3eeba9 fix: use correct types for moment.js 2025-05-02 20:47:14 -06:00
7 changed files with 28 additions and 22 deletions

View file

@ -14,7 +14,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "18"
node-version: "22"
- uses: oven-sh/setup-bun@v1
with:

View file

@ -1,10 +1,10 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import esbuild from "esbuild";
import esbuildSvelte from "esbuild-svelte";
import fs from "fs";
import path from "path";
import esbuildSvelte from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";
import process from "process";
import { sveltePreprocess } from "svelte-preprocess";
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD

View file

@ -1,7 +1,7 @@
{
"id": "vault-explorer",
"name": "Vault Explorer",
"version": "1.47.2",
"version": "1.47.4",
"minAppVersion": "1.4.13",
"description": "Explore your vault in visual format",
"author": "DecafDev",

View file

@ -1,6 +1,6 @@
{
"name": "obsidian-vault-explorer",
"version": "1.47.2",
"version": "1.47.4",
"description": "Explore your vault in visual format",
"main": "main.js",
"scripts": {

View file

@ -1,8 +1,10 @@
import { moment } from "obsidian";
import { moment as _moment } from "obsidian";
const moment = _moment as unknown as typeof _moment.default;
export const formatAsBearTimeString = (milliseconds: number) => {
const now = (moment as any)();
const time = (moment as any)(milliseconds);
const now = moment();
const time = moment(milliseconds);
const diffInSeconds = now.diff(time, "seconds");
const diffInMinutes = now.diff(time, "minutes");

View file

@ -1,4 +1,6 @@
import { moment } from "obsidian";
import { moment as _moment } from "obsidian";
const moment = _moment as unknown as typeof _moment.default;
const DATE_FORMATS = ["YYYY-MM-DDTHH:mm:ss", "YYYY-MM-DDTHH:mm", "YYYY-MM-DD"];
@ -7,7 +9,7 @@ const DATE_FORMATS = ["YYYY-MM-DDTHH:mm:ss", "YYYY-MM-DDTHH:mm", "YYYY-MM-DD"];
* @returns - The current time in milliseconds
*/
export const getStartOfTodayMillis = () => {
return (moment as any)().startOf("day").valueOf();
return moment().startOf("day").valueOf();
};
/**
@ -16,7 +18,7 @@ export const getStartOfTodayMillis = () => {
* @returns - The start of the day in milliseconds
*/
export const getStartOfDayMillis = (date: string) => {
return (moment as any)(date).startOf("day").valueOf();
return moment(date).startOf("day").valueOf();
};
/**
@ -24,19 +26,19 @@ export const getStartOfDayMillis = (date: string) => {
* @returns - The start of the week in milliseconds
*/
export const getStartOfThisWeekMillis = () => {
return (moment as any)().startOf("week").valueOf();
return moment().startOf("week").valueOf();
};
export const getMomentDate = (date: string) => {
return (moment as any)(date, DATE_FORMATS, true);
return moment(date, DATE_FORMATS, true);
};
export const getDateDaysAgo = (daysAgo: number) => {
return (moment as any)().subtract(daysAgo, "days").format("YYYY-MM-DD");
return moment().subtract(daysAgo, "days").format("YYYY-MM-DD");
};
export const getDateDaysAhead = (daysAgo: number) => {
return (moment as any)().add(daysAgo, "days").format("YYYY-MM-DD");
return moment().add(daysAgo, "days").format("YYYY-MM-DD");
};
/**
@ -45,7 +47,7 @@ export const getDateDaysAhead = (daysAgo: number) => {
*/
export const getStartOfLastWeekMillis = () => {
//This is the Sunday the previous week
return (moment as any)().subtract(1, "weeks").startOf("week").valueOf();
return moment().subtract(1, "weeks").startOf("week").valueOf();
};
/**
@ -54,7 +56,7 @@ export const getStartOfLastWeekMillis = () => {
* @returns - The date in milliseconds
*/
export const getTimeMillis = (date: string) => {
const momentDate = (moment as any)(date, DATE_FORMATS, true);
const momentDate = moment(date, DATE_FORMATS, true);
if (!momentDate.isValid()) {
throw new Error(`Date format not handled: ${date}`);
@ -68,7 +70,7 @@ export const getTimeMillis = (date: string) => {
* @returns - True if the date is supported, false otherwise
*/
export const isDateSupported = (date: string) => {
const momentDate = (moment as any)(date, DATE_FORMATS, true);
const momentDate = moment(date, DATE_FORMATS, true);
return momentDate.isValid();
};
@ -78,7 +80,7 @@ export const isDateSupported = (date: string) => {
* @returns - The end of the day in milliseconds
*/
export const getEndOfDayMillis = (date: string) => {
const day = (moment as any)(date);
const day = moment(date);
day.set({
hour: 23,
minute: 59,

View file

@ -152,5 +152,7 @@
"1.46.0": "1.4.13",
"1.47.0": "1.4.13",
"1.47.1": "1.4.13",
"1.47.2": "1.4.13"
"1.47.2": "1.4.13",
"1.47.3": "1.4.13",
"1.47.4": "1.4.13"
}