Kookma's Timelines macro - date in timeline is one day ahead of date in tiddler

I’m adding a date field to my tiddlers and putting in values formatted as yyymmdd but on the visual timeline, they’re coming out a day ahead. So for example, if I give the date field a value of “2021114” I would expect it to present as Nov 4th, however it’s coming out as Nov 3rd.

At first I thought this was an issue with my tiddlywiki file specifically, but it happens for me on Mohammad’s demo site as well. I brought it up on Mohammad’s github page, but he isn’t able to replicate the error I’m getting. Hopefully, someone here can help me find the cause of the issue.

As an example, this demo tiddler shows me Aug 5th as the date for First Tiddler. If I open up the edit view of First Tiddler, the date value is 19680806.

If it’s of any help, I’m on macOS 10.13.16 and using Google Chrome. This date mismatching happens both on my locally stored tiddlywiki (version 5.1.23) that’s viewed and edited with TiddlyDesktop and Mohammad’s github demo site.

The problem is caused by “timezone offset”. The internal processing of date values is calibrated with UTC+0 (i.e., Greenwich mean time), and doesn’t take into account the difference between UTC+0 and your local time zone.

One way to work around this problem is to specify a time of “120000000” (i.e., noon, using HHMMSSXXX for hours, minutes, seconds, and milliseconds) as part of your date field value (e.g., instead of “19680806”, enter “19860806120000000”.

By using noon as the time, it allows the displayed date value to always be within the same day as the value specified in the date field, regardless of the local timezone offset.

-e

P.S. love the sample text in your tiddlers… WOOF!

Thank you! Adding 120000000 to the value has solved it for me (: Thankfully I duplicate a template tiddler so I can just put that in once and only adjust the yyyymmdd as needed

Love that too! A “lorem ipsum” that creates a smile :wink:

Thank you kookma for such funny things and funny tools (timelines macro) which brings smile to faces! :wink: :sweat_smile:

In case anyone’s browsing this resolved thread: there’s no need to type (or paste) all those zeros! The date-time string implicitly behaves as if zeros fill rightward, past whatever numbers you do specify.

I was surprised to find that appending a single 9 actually works (since my lag is less than 9 hours from UTC+0); somehow the parser doesn’t even need 09 for 9 hours.

-Springer

Please pardon the comment on an old thread, but I thought this may be helpful for others in future:

I was having the same issue even when the date format was simply “YYYY”; the result was always one year earlier than intended. I thought a year couldn’t possibly be affected by a time zone offset issue, but I was wrong. The above solution solved the issue. Thank you.

Thanks for your contribution :slightly_smiling_face: Welcome to Talk TiddlyWiki!