Skip to content

Commit

Permalink
postfi dates render bugfix
Browse files Browse the repository at this point in the history
+ updated the versions for release
  • Loading branch information
Ledaryy committed Dec 10, 2022
1 parent 4c18b76 commit 8c3f290
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,7 +1,7 @@
{
"id": "todoist-completed-tasks-plugin",
"name": "Todoist completed tasks",
"version": "1.4.1",
"version": "1.4.2",
"minAppVersion": "0.15.0",
"description": "Fetches completed tasks from todoist API and adds them to the Obsidian note.",
"author": "Andrey Kulishov",
Expand Down
36 changes: 7 additions & 29 deletions src/formatTasks.ts
@@ -1,4 +1,4 @@
import { Notice } from "obsidian";
import { moment, Notice } from "obsidian";
import { TodoistSettings } from "./DefaultSettings";
import { RawTodoistTask } from "./fetchTasks";

Expand Down Expand Up @@ -57,44 +57,22 @@ function renderTasksAsText(tasks: any, settings: TodoistSettings) {
}

if (settings.taskPostfix.includes("{task_finish_date}")) {
const date = task.dateCompleted;
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
const formattedDate = `${year}-${month}-${day}`;
const formattedDate = moment(task.dateCompleted).format("YYYY-MM-DD");;
return formattedDate;
}

if (settings.taskPostfix.includes("{task_finish_datetime}")) {
const date = task.dateCompleted;
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const formattedDate = moment(task.dateCompleted).format("YYYY-MM-DD HH:mm");;
return formattedDate;
}

if (settings.taskPostfix.includes("{current_date}")) {
const date = task.dateCompleted;
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
const formattedDate = `${year}-${month}-${day}`;
const formattedDate = moment(task.dateCompleted).format("YYYY-MM-DD");;
return formattedDate;
}

if (settings.taskPostfix.includes("{current_datetime}")) {
const date = task.dateCompleted;
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const formattedDate = moment(task.dateCompleted).format("YYYY-MM-DD HH:mm");;
return formattedDate;
}
}
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Expand Up @@ -6,5 +6,6 @@
"1.2.0": "0.15.0",
"1.3.0": "0.15.0",
"1.4.0": "0.15.0",
"1.4.1": "0.15.0"
"1.4.1": "0.15.0",
"1.4.2": "0.15.0"
}

0 comments on commit 8c3f290

Please sign in to comment.