thesamim / TickTickSync

GNU General Public License v3.0
99 stars 2 forks source link

Date error #79

Closed 4ependoZzz closed 3 months ago

4ependoZzz commented 3 months ago

Screenshot_20240311_231905_Obsidian Hi, every time when I input due date in obsidian task or task in ticktick this date update after sync with "undefined" and I can not use tasks in obsidian and tick tick

thesamim commented 3 months ago

TickTickSync dates are all in YYYY-MM-DD format to comply with Task dates. Can you tell me what you are expecting to see instead of undefined?

Also:

  1. What plugins do you have enabled?
  2. Do any of them change the date format?
  3. How are you entering the dates?
4ependoZzz commented 3 months ago

I know that the date format in TickTick is YYYY-MM-DD. I found confirmation of this here: TickTick Developer

Instead of "undefined," I expected to see 📅 2024-03-17.

Also:

  1. I made an experiment on a new storage without any additional plugins. I installed only Tasks and TickTickSync plugins.
  2. Accordingly, no plugins change the date format. 3.1. In Obsidian, I enter the date through the task menu. Afterward, it ends up at the end of the task in normal form. Then, during synchronization, it is replaced with undefined-DD.MM.YYYY-undefined. After that during synchronization back from TickTick, the date is placed before the tag. In TickTick, the date is not set, and the entry undefined-date-undefined goes into the task description. 3.2. In TickTick, I set the date in the standard way. It also ends up at the end of the task in Obsidian in the format undef-DD.MM.YYYY-undef during synchronization, and after that, it is moved into the body of the task. In TickTick, the date is cleared at this point.
4ependoZzz commented 3 months ago

It might also be useful for investigating my issue. I also tried installing the Ultimate Todoist Sync plugin in another obsidian vault. With it, this problem did not occur. I think the issue is not with the date format on the Obsidian side.

thesamim commented 3 months ago

What platform is this happening in?

   3.1. In Obsidian, I enter the date through the task menu. Afterward, it ends up at the end of the task in normal form. 

Are you putting in a scheduled date or a due date?

Please do this:

  1. Please enter a task using the same method, but do NOT add the TickTick tag. copy the line from the .md file and paste it here.

  2. using your favorite method (Ctrl-Shift-I in Windows. Don't know what it is in other platforms) go to the debug console.

  3. In the console type in console.log(Intl.DateTimeFormat().resolvedOptions().timeZone) and let me know what you see. image is what I see...

  4. In Ticktick, what time zone do you have?

It looks like we're losing year and day in the time zone conversion (the two undefineds.)

4ependoZzz commented 3 months ago

The setup is the same on both platforms (win, android) I put in due date

  1. Example from obsidian android (same on the win):
    • [ ] test task 📅 2024-03-17

the task takes this form immediately after entering the tag

and after a few seconds

If we were losing a year and a day during the date conversion, then between undef we would only get the month, but we see the full correct date in another format.

thesamim commented 3 months ago

I'm sorry, I'm not able to reproduce this. I have set my timezone the same as yours on both Windows and Android. All working as designed. image

I have not tested this with any language other than English. Is it possible that we are running into a language difference problem?

Could you please

  1. back up your main.js file in <your vault root>\.obsidian\plugins\tickticksync
  2. replace it with the main.js here in this zip file: main.zip
  3. filter console with "@@@"
  4. let me know what you see.
4ependoZzz commented 3 months ago

Sorry, I can't download this file (main.zip) Error 54113 the same in this discussion error 54113

thesamim commented 3 months ago

Let's try this: https://github.com/thesamim/TickTickSync/blob/65-enable-plugin-on-android-mobile/dist/TickTickSyn-1.0.18-Test.zip and click on download. image

4ependoZzz commented 3 months ago

I got it)) 2024-03-13 163655 yellow hilight looks provocative

thesamim commented 3 months ago

Thanks! That was helpful.

I believe I found the issue: date.toLocaleString is returning date in your locale format, but I was not accounting for the difference in formats. I have made a change to always get the local time in the format the code is expecting.

If you could check two things please:

  1. That we don't see undefined-17.03.2024-undefined any longer
  2. That the date for the task is accurate per your time zone

Please download: https://github.com/thesamim/TickTickSync/blob/65-enable-plugin-on-android-mobile/dist/TickTickSyn-1.0.18-Test.zip again and let me know if that did, indeed, fix the problem.

4ependoZzz commented 3 months ago

Hi, the archive is corrupt. Upload one more please

thesamim commented 3 months ago

@4ependoZzz : it downloaded fine for me. But anyway: I deleted it and added back to repository. Please try again.

4ependoZzz commented 3 months ago

@thesamim my browser has lost its head)) I tested the latest version Everything is fine!!!)) thank you very much for the quick solution to the issue!!!

thesamim commented 3 months ago

You're welcome. Thanks for your patience and help.

I will put out a new release in the couple of days.