A correction of the example given for a week date in TiddlyWiki is that the 
template should use the wYYYY token for the ISO week-numbering year, not 
YYYY, since weeks may cross the traditional year boundary with some days of 
the week falling outside the year the week belongs to. It is a bit 
surprising that the final element of the week day number is missing when 
the other parts of the ISO standard are supported.

torsdag 9 september 2021 kl. 21:31:46 UTC+2 skrev J N:

> I would like to use the ISO week date format for the title of new journal 
> tiddlers and elsewhere, since I find it practical to be aware of the week 
> day in combination with a sortable date format.
>
> https://en.wikipedia.org/wiki/ISO_8601#Week_dates
> YYYY-Www-D or YYYYWwwD
>
> E.g. 2021-w36-4 for thursday of week 36, 2021-09-09.
>
> I can not see a way to get the week day number in the built in date format 
> tokens.
>
> https://tiddlywiki.com/#DateFormat
>
> The closest I've got is YYYY-W0WW-ddd, but that renders as 2021-W36-Thu, 
> which will not sort alphanumerically in date order like an ISO date would.
>
> I can see that the template tokens are implemented in a system tiddler 
> named $:/core/modules/utils/utils.js.
>
> Getting the day of week is trivial in JavaScript, e.g. adding a token 
> matching a single "D" for this:
>
> [/^D/, function() {
> return date.getDay() || 7;
> }]
>
> The utils.js tiddler seems to contain a lot of other stuff however, and I 
> guess local changes would have to be merged on achieving updates of 
> TiddlyWiki.
>
> Maybe there are other ways to achieve custom date formatting of this kind 
> in TiddlyWiki?
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/de63bfa1-069a-4777-b010-578e2a991859n%40googlegroups.com.

Reply via email to