As you probably know, I’ve done extensive work with TiddlyWiki time functions (see TiddlyTools/Time/Info).
However, I’ve run into what I suspect is a subtle flaw in the TWCore’s handling for date/time formatting when using the format:date filter operator. Today is the day that the US switches from Daylight Saving Time to Standard Time (changing the time BACK by one hour), and there seems to be an “off by 1 hour” error related to this change in time and the local timezone offset:
Please try the following code at https://TiddlyWiki.com
<$let UTCtime=<<now "[UTC]YYYY0MM0DD0hh0mm0ss0XXX">>>
<$let localtime=<<now "YYYY0MM0DD0hh0mm0ss0XXX">>>
<$let format="[UTC]hh12:0mm:0ssam">
UTCTIME = <<UTCtime>><br>
LOCALTIME = <<localtime>><br>
FORMAT=<<format>><br>
`<<now "hh12:0mm:0ssam">>` = <<now "hh12:0mm:0ssam">><br>
`{{{ [<localtime>format:date<format>] }}}` = {{{ [<localtime>format:date<format>] }}}
For my timezone (California = Pacific Standard Time = UTC-8), the above code outputs:
UTCTIME = 20251102160729711
LOCALTIME = 20251102080729711
FORMAT=[UTC]hh12:0mm:0ssam
<<now "hh12:0mm:0ssam">> = 8:07:29am
{{{ [<localtime>format:date<format>] }}} = 7:07:29am
-
format:datealways expects a UTC timestamp as input, but I am passing it a local timestamp. - I am also using the
[UTC]prefix on the time formatting string. - The expectation is that by using this prefix it will not apply any timezone adjustments to the
<time>value input.
As you can see, the UTCTIME and LOCALTIME correctly show a 8 hour difference and the <<now>> macro output also shows the correct local time. However, when using format:date (with the [UTC] prefix), the result is 1 hour behind the actual local time.
This formatting error only appears on the day that the clocks change and I’ve observed this same error in previous years, but have not been able to track down the cause. In addition, this error seems to be somehow related to my timezone offset as it self-corrects after 8 hours (the difference between my timezone and UTC).
To solve this, I need YOUR help. If people in other timezones could try this code and report their results (as well as their current timezone and offset from UTC), I might be able to narrow down the cause (or at least better understand the problem).
Thanks,
-e