OokTech/TW5-Bob

Javascript Date() constructor does not accept TiddlyWiki date format as input, nor empty strings.

Closed this issue · 2 comments

Using BobWin.exe 1.6.2r2, Windows 10, latest Firefox 81.0.2.

There are several places in the code where there is a call to (for example) new Date(SomeObject.fields.created)

I'm mostly interested in these 2:

bodyData.tiddlers[title].fields.modified = $tw.utils.stringifyDate(new Date(bodyData.tiddlers[title].fields.modified));

bodyData.tiddlers[title].fields.created = $tw.utils.stringifyDate(new Date(bodyData.tiddlers[title].fields.created));

These lines return "NaN"

// empty string
$tw.utils.stringifyDate(new Date(""));
==> "NaNNaNNaNNaNNaNNaNNaN"

// TiddlyWiki date
$tw.utils.stringifyDate(new Date("20201016232045362"));
==> "NaNNaNNaNNaNNaNNaNNaN"

This works as intended. All of the tools that I use to work with the api send the dates as stringifyed javascript dates.

Please read and follow the guidelines for making a bug report or feature request https://ooktech-public.gitlab.io/guidelines/

Gotcha, thanks.