Skip to content

Commit

Permalink
release 1.0.41
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroBlackInk committed Jun 11, 2023
1 parent 7fbe021 commit d39838a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "ultimate-todoist-sync",
"name": "Ultimate Todoist Sync",
"version": "1.0.40",
"version": "1.0.41",
"minAppVersion": "1.0.0",
"description": "This is the best Todoist task synchronization plugin for Obsidian so far.",
"author": "HeroBlackInk",
Expand Down
8 changes: 5 additions & 3 deletions src/syncModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,19 +694,19 @@ export class TodoistSync {
console.log(e)
console.log(typeof e.extra_data.last_due_date === 'undefined')
if(!(typeof e.extra_data.last_due_date === 'undefined')){
console.log(`prepare update dueDate`)
//console.log(`prepare update dueDate`)
await this.syncUpdatedTaskDueDateToObsidian(e)

}

if(!(typeof e.extra_data.last_content === 'undefined')){
console.log(`prepare update content`)
//console.log(`prepare update content`)
await this.syncUpdatedTaskContentToObsidian(e)
}

//await this.plugin.fileOperation.syncUpdatedTaskToTheFile(e)
//还要修改cache中的数据
new Notice(`Task ${e.object_id} is updated.`)
//new Notice(`Task ${e.object_id} is updated.`)
processedEvents.push(e)
}

Expand All @@ -726,6 +726,7 @@ export class TodoistSync {
this.plugin.fileOperation.syncUpdatedTaskContentToTheFile(e)
const content = e.extra_data.content
this.plugin.cacheOperation.modifyTaskToCacheByID(e.object_id,{content})
new Notice(`The content of Task ${e.parent_item_id} has been modified.`)

}

Expand All @@ -734,6 +735,7 @@ export class TodoistSync {
//修改cache的日期,要使用todoist的格式
const due = await this.plugin.todoistRestAPI.getTaskDueById(e.object_id)
this.plugin.cacheOperation.modifyTaskToCacheByID(e.object_id,{due})
new Notice(`The due date of Task ${e.parent_item_id} has been modified.`)

}

Expand Down
15 changes: 6 additions & 9 deletions src/taskParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,12 @@ export class TaskParser {
}
let utcDateString = utcTimeString;
let dateObj = new Date(utcDateString); // 将UTC格式字符串转换为Date对象
let localDateString = dateObj.toLocaleString(); // 将Date对象转换为本地时间字符串
let localDateObj = new Date(localDateString);
let year = localDateObj.getFullYear();
let month = (localDateObj.getMonth() + 1).toString().padStart(2, '0');
let date = localDateObj.getDate().toString().padStart(2, '0');
let hours = localDateObj.getHours().toString().padStart(2, '0');
let minutes = localDateObj.getMinutes().toString().padStart(2, '0');
let result = `${year}-${month}-${date}`;
return(result);
let year = dateObj.getFullYear();
let month = (dateObj.getMonth() + 1).toString().padStart(2, '0');
let date = dateObj.getDate().toString().padStart(2, '0');
let localDateString = `${year}-${month}-${date}`;
return localDateString;
return(localDateString);
} catch (error) {
console.error(`Error extracting date from string '${utcTimeString}': ${error}`);
return null;
Expand Down

0 comments on commit d39838a

Please sign in to comment.