mirror of
https://github.com/heroblackink/ultimate-todoist-sync-for-obsidian.git
synced 2026-07-22 07:40:27 +00:00
The time zone has been added to the task note.
This commit is contained in:
parent
0377627a7c
commit
80e1d837f3
4 changed files with 11 additions and 16 deletions
3
main.ts
3
main.ts
|
|
@ -382,7 +382,7 @@ export default class UltimateTodoistSyncForObsidian extends Plugin {
|
|||
if(!( this.checkModuleClass())){
|
||||
return
|
||||
}
|
||||
if(this.syncTodoistToObsidianStatusLock = true){
|
||||
if(this.syncTodoistToObsidianStatusLock == true){
|
||||
return
|
||||
}
|
||||
this.todoistSync.lineModifiedTaskCheck(filepath as string,lastLineText,lastLine as number,fileContent)
|
||||
|
|
@ -481,7 +481,6 @@ export default class UltimateTodoistSyncForObsidian extends Plugin {
|
|||
}
|
||||
this.syncTodoistToObsidianStatusLock = true
|
||||
await this.todoistSync.syncTodoistToObsidian();
|
||||
console.log('sync from todoist to obsidian done')
|
||||
this.syncTodoistToObsidianStatusLock = false
|
||||
await this.saveSettings();
|
||||
|
||||
|
|
|
|||
|
|
@ -449,12 +449,12 @@ export class TodoistSync {
|
|||
|
||||
|
||||
|
||||
if (contentChanged || statusChanged ||dueDateChanged ||tagsChanged || projectChanged || projectChanged) {
|
||||
if (contentChanged || statusChanged ||dueDateChanged ||tagsChanged || projectChanged || priorityChanged) {
|
||||
console.log(lineTask)
|
||||
console.log(savedTask)
|
||||
//`Task ${lastLineTaskTodoistId} was modified`
|
||||
this.plugin.saveSettings()
|
||||
new Notice(`Task ${lineTask_todoist_id} was modified`)
|
||||
new Notice(`Task ${lineTask_todoist_id} is modified`)
|
||||
|
||||
} else {
|
||||
//console.log(`Task ${lineTask_todoist_id} did not change`);
|
||||
|
|
@ -765,7 +765,10 @@ export class TodoistSync {
|
|||
|
||||
const unsynchronized_item_completed_events = this.todoistSyncAPI.filterActivityEvents(result2, { event_type: 'completed', object_type: 'item' })
|
||||
const unsynchronized_item_uncompleted_events = this.todoistSyncAPI.filterActivityEvents(result2, { event_type: 'uncompleted', object_type: 'item' })
|
||||
|
||||
//Items updated (only changes to content, description, due_date and responsible_uid)
|
||||
const unsynchronized_item_updated_events = this.todoistSyncAPI.filterActivityEvents(result2, { event_type: 'updated', object_type: 'item' })
|
||||
|
||||
const unsynchronized_notes_added_events = this.todoistSyncAPI.filterActivityEvents(result1, { event_type: 'added', object_type: 'note' })
|
||||
const unsynchronized_project_events = this.todoistSyncAPI.filterActivityEvents(result1, { object_type: 'project' })
|
||||
console.log(unsynchronized_item_completed_events)
|
||||
|
|
|
|||
|
|
@ -457,11 +457,11 @@ export class TaskParser {
|
|||
}
|
||||
|
||||
|
||||
//extra date from obsidian event
|
||||
//extra date from obsidian event
|
||||
// 使用示例
|
||||
//const str = "2023-03-27T15:59:59.000000Z";
|
||||
//const dateStr = ISOStringToLocalDatetimeString(str);
|
||||
//console.log(dateStr); // 输出 2023-03-27T15:59
|
||||
//console.log(dateStr); // 输出 Mon Mar 27 2023 23:59:59 GMT+0800 (China Standard Time)
|
||||
ISOStringToLocalDatetimeString(utcTimeString:string) {
|
||||
try {
|
||||
if(utcTimeString === null){
|
||||
|
|
@ -469,14 +469,7 @@ 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}T${hours}:${minutes}`;
|
||||
let result = dateObj.toString();
|
||||
return(result);
|
||||
} catch (error) {
|
||||
console.error(`Error extracting date from string '${utcTimeString}': ${error}`);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export class TodoistRestAPI {
|
|||
try {
|
||||
|
||||
const isSuccess = await api.reopenTask(taskId);
|
||||
console.log(`task ${taskId} opend`)
|
||||
console.log(`Task ${taskId} is reopend`)
|
||||
return(isSuccess)
|
||||
|
||||
} catch (error) {
|
||||
|
|
@ -107,7 +107,7 @@ export class TodoistRestAPI {
|
|||
const api = await this.initializeAPI()
|
||||
try {
|
||||
const isSuccess = await api.closeTask(taskId);
|
||||
console.log(`task ${taskId} closed`)
|
||||
console.log(`Task ${taskId} is closed`)
|
||||
return isSuccess;
|
||||
} catch (error) {
|
||||
console.error('Error closing task:', error);
|
||||
|
|
|
|||
Loading…
Reference in a new issue