-
Notifications
You must be signed in to change notification settings - Fork 82
Conversation
content/mdnotes.js
Outdated
return (d.getMonth() < 10 ? "0" : "") + d.getMonth(); | ||
function getDate(date) { | ||
const d = new Date(date); | ||
return d.toISOString().substring(0,10);; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to remember having tried this option and having had issues due to timezones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the timezone used in toISOString
is UTC, this can cause issues depending on the time of day and the timezone of the user. See this for more info.
I'll do a fix mostly working date offset in-case in fall in the wrong date Either that it I can do a alternate change which starts the month from 1 so that it doesn't break |
Added fix for timezones see response 2 https://stackoverflow.com/questions/23593052/format-javascript-date-as-yyyy-mm-dd |
Thanks! I think the fix should work, now it's just a matter of removing the lines where we use |
I changed it use the simpleISODate method that was apparently doing the same thing |
Made the date output more consistent and made the date field output in ISO-format