Open hissohathair opened 1 month ago
Ah...might be TW being helpful: https://tiddlywiki.com/static/DateFormat.html
Have a possible fix here: https://github.com/hissohathair/tiddlywiki-stuff/tree/frontmatter-fix
Haven't raised a PR yet because although the patch passes the test case I'm not 100% sure I understand why it's happening in the first place. Also want to be sure I haven't broken the in-browser behaviour...
Have a better patch now and a few more tests to make sure I am not making things worse. :-)
Have a better understanding of the issue. instanceof Date
returns false when running under Node, although the object is indeed a Date
object (just not the same kind of Date I guess), so changing the test to checking for a .toISOString
member resolves the issue.
When exporting with the TW CLI I get dates in the frontmatter formatted differently from when I use TW in the browser.
For example, I added a new tiddler "TestPage/FrontMatter" and expected the following:
When using TW in the browser to export to Markdown I get that data. But when I use TW using the CLI I get:
Attaching a modified
test.ps1
to contains this test case: test.ps1.txt (had to rename to ".txt
" for GH to let me upload it :-) -- can also find here)I am looking into it but so far don't understand the root cause. The
render-rules.ts
file is definitely calling.toISOString()
on the appropriate field, so JS has parsed it as a date just fine. Just for some reason in a node.js context the date is not actually ISO formatted. The other thing to note is the missingdate
field, that seems to be because it's not aninstanceof Date
but again that only happens when running from CLI.Any ideas? In the meantime I will keep digging...