To get locale date and time, use new Date().getTimezoneOffset() in minutes, so it becomes
new Date().getTimezoneOffset()
function getYYYYMMDD(d0) { const d = new Date(d0) return new Date(d.getTime() - d.getTimezoneOffset() * 60 * 1000).toISOString().split('T')[0] }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
To get locale date and time, use
new Date().getTimezoneOffset()
in minutes, so it becomes