G'day,

Just to get the conversation started, try this in a new tiddler in some 
tiddlywiki:

<$vars dateNow= <<now wYYYY-W0WW-ddd>>>

{{{ 
[<dateNow>search-replace:[Mon],[1]search-replace:[Tue],[2]search-replace:[Wed],[3]search-replace:[Thu],[4]search-replace:[Fri],[5]search-replace:[Sat],[6]search-replace:[Thu],[7]]
 
}}}

</$vars>

On Thursday, September 9, 2021 at 4:57:30 PM UTC-3 J N wrote:

> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8698d89e-e3c4-4e35-b7a5-20fc61f5e9c1n%40googlegroups.com.

Reply via email to