[TW5] DateFormat DDth MMM YYYY when Date Field for DD is 00?

44 views
Skip to first unread message

TheDiveO

unread,
Mar 8, 2017, 5:15:46 AM3/8/17
to TiddlyWiki
Hi,

as I'm importing a document index into TW5 I face the situation that all documents in the index have a year and month of publication, but only some have a day. So I thought that from TW5's "Date Fields" perspective something like "20030700" would be fine. Now, when I run this through the view widget with format="date" and template="DDth MMM YYYY" then I get "30th June 2003" instead of "1st July 2003".

What I would get instead is "July 2003". Is there a quick way to achieve this with what TW5 already has on board? Or do I need to resort to some macro magic instead?

As always, any help and insight greatly appreciated!
-- TheDiveO

Dragon Cotterill

unread,
Mar 8, 2017, 5:48:02 AM3/8/17
to TiddlyWiki
Since when has there ever been a "zero" day of the month? As far as I recall the first day of the month is always "1". Perhaps you should do the same for your values?


TheDiveO

unread,
Mar 8, 2017, 7:35:53 AM3/8/17
to TiddlyWiki
Day 0 actually signals that only month and day are present. Anyway, I've come up with a small JavaScript macro that gets the job done while allowing to use the nice templating that TW5's core date formatting offers.
Reply all
Reply to author
Forward
0 new messages