Merge pull request #386 from decaf-dev/dev

v1.47.3
This commit is contained in:
DecafDev 2025-05-02 20:48:17 -06:00 committed by GitHub
commit 239dd7903f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 17 deletions

View file

@ -1,7 +1,7 @@
{
"id": "vault-explorer",
"name": "Vault Explorer",
"version": "1.47.2",
"version": "1.47.3",
"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.3",
"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,6 @@
"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"
}