You could then add the suffix 000000000 and you would have a tiddlywiki date serial number, and view would work on it (but it does on shorter dates as well). However we have seen cases where it’s best to make it 12 noon to help with getting the date + or - 12 Hours so use 120000000 to assist with cross time zones.
Look at the following, and try on the prerelease
<$edit-text tiddler="$:/temp/birthday" tag="input" type=date/>
<$button tooltip="save selected date to bithday-date">
<$action-setfield $field="birthday-date" $value={{{ [{$:/temp/birthday}!is[blank]search-replace:g[-],[]addsuffix[120000000]] }}}/>
<$action-deletetiddler $tiddler="$:/temp/birthday"/>
Save Birthday
</$button>
The above allows you to type in only valid dates, or click to select from a date picker. It then converts it to the tiddlywiki serial number format and saves it in a field.
Use the view widget to display in any format.
Should respond to your localisation with mm/dd or dd/mm (works for me)
The input date can use any date format recognized by the Javascript Date.parse() function.
Generally this conforms to ISO 8601 standard date format (see ISO 8601 - Wikipedia]]).
The output format uses TiddlyWiki Date Format codes (see https://tiddlywiki.com/#DateFormat), and defaults to “[UTC]YYYY0MM0DD0hh0mm0ss0XXX”.
It handles all the example date formats you listed, except for “2021 - 09.5”… because of the combination of spaces and dashes. If you entered it as “2021-09.5” or “2021 09.5” then it DOES convert!
Note that this macro is just using the built-in javascript date object, which it then passes through the TWCore date formatter. It’s literally just one line of JS code in a TW macro wrapper:
Hello Scot,
For a while I did not update the TW-Script! But I have bookmarked this one to be added!
I will publish a partial update and add this one too!