I have a bunch of files that has their names generated from date -Ins
(2023-11-16T16:34:48,334801753+05:30). I need these strings to be used inside the Date()
constructor. For some reason, this is considered as an invalid format? However, when I use date -Is
(2023-11-16T16:34:48+05:30), there seems to be no issue? What is happening here?
It’s because of the comma. Javascript expects a period instead of a comma. But even then it will throw away everything smaller than a millisecond.
Looks like it’s not just JS, there’s also other languages with this same issue. For my use case, I don’t really need seconds. Since date is more than enough, I’m going to use
date -I
. Basically, those files are MDX files. And since I’m not going to write more than one article in a day, I guess that would solve my issue.