Skip to content

Commit

Permalink
fix moment issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tu2-atmanand committed Nov 30, 2024
1 parent fc84096 commit 9747be6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
14 changes: 2 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.2",
"description": "An Obsidian plugin to see all your task in a much more efficient Kanban Board format. Easily manage your tasks throught your vault.",
"main": "main.js",
"type": "module",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Column.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// /src/components/Column.tsx

import { App, moment } from 'obsidian';
import { App, moment as _moment } from 'obsidian';
import React, { useEffect, useState } from 'react';
import { deleteTaskFromFile, deleteTaskFromJson, updateTaskInFile, updateTaskInJson } from 'src/utils/TaskItemUtils';
import { moveFromCompletedToPending, moveFromPendingToCompleted } from 'src/utils/TaskItemUtils';
Expand Down Expand Up @@ -62,6 +62,7 @@ const Column: React.FC<ColumnPropsWithSetBoards> = ({
moveFromCompletedToPending(plugin, taskWithCompleted);
updateTaskInFile(plugin, taskWithCompleted, taskWithCompleted);
} else {
const moment = _moment as unknown as typeof _moment.default;
const taskWithCompleted = { ...updatedTask, completed: moment().format(globalSettings?.taskCompletionDateTimePattern), };
// Move from Pending to Completed
moveFromPendingToCompleted(plugin, taskWithCompleted);
Expand Down
3 changes: 2 additions & 1 deletion src/utils/ScanningVault.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// /src/utils/ScanningVaults.ts

import { App, TFile, moment } from "obsidian";
import { App, TFile, moment as _moment } from "obsidian";
import { loadTasksJsonFromSS, writeTasksJsonToSS } from "./tasksCache";
import {
scanFilterForFilesNFolders,
Expand Down Expand Up @@ -141,6 +141,7 @@ export class ScanningVault {
const basename = file.basename;

// Check if the basename matches the dueFormat using moment
const moment = _moment as unknown as typeof _moment.default;
if (
moment(basename, dueFormat, true).isValid()
) {
Expand Down

0 comments on commit 9747be6

Please sign in to comment.