This is how javascript handles dates...

let today = new Date(2020, 4, 28); //2020-05-28

"The month is zero-based for JavaScript. Days and years are one-based."

I'm pissed and amused at the same time

@rasmus Doesn't it depend on locale?

Date(2020, 4, 28).toString()
"Tue Apr 28 2020 16:48:43 GMT+0200 (Central European Summer Time)"

On a related note, I was also disappointed to see it has not implemented anything to format the object into a string, as in Python say,

@ashwinvis It seems like if you don't use the keyword new it always returns the current time.

I agree, it would be really handy. I can't think of why they haven't implemented it. The interaction with the DOM have changed dramatically because of libraries such as jQuery, so dates should also get some love

Sign in to participate in the conversation
Mastodon @ SUNET

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!