I’m trying to use the value of created
and modified
field in the datetime
HTML attribute, like so:
<time datetime="YYYY-MM-DDTHH:MMZ">local time format her</time>
The W3C states that the value of the datetime
attribute should always be in UTC (Zulu) as it is read by machines and they do the conversion. While the human-facing time is the one between <time></time>
.
The code I came up with is:
<time datetime={{{ [{!!modified}format:date[YYYY-0MM-0DDT0hh:0mm:0ss]] }}}>{{!!modified}}</time>
And the result is:
<time datetime="2024-10-07T01:34:23">Mon Oct 07 2024 01:34:23 GMT+0800 (Philippine Standard Time)</time>
Two issues I’m stuck:
-
I can’t figure out how to change the dateformat in
{{!!modified}}
so it will display in the ISO format.If I use this raw:
{{{ [{!!modified}format:date[YYYY-0MM-0DDT0hh:0mm:0ss]] }}}
It outputs an anchor link. (Other than I can’t make it to convert to UTC.)
-
The value in
datetime
is local time (see attached screenshot). Inserting[UTC]
is not working.{{{ [{!!modified}format:date[[UTC]YYYY-0MM-0DDT0hh:0mm:0ss]] }}}
Continuing the discussion from Converting a date from local time to UTC:
As shown in the screenshot, the
format:date
is giving the local time. It matches my desktop clock as well as the other ways to output the time via TiddlyWiki. While the one with a[UTC]
prefix outputs the correct UTC time.Is it a bug since it’s no longer giving a UTC value? Or, was it changed? In any case, is there a way to set
[UTC]
?
Thank you again for the assistance and insights!