Skip to main content

Dates in JavaScript are terrible. We all know this, but they made big strides for it to not suck anymore.

So what do we get. No more weird constructor passing numbers around. Like you want now? Temporal.Now

That returns a proper prototypal object. Not nonsense... and then everything gets easier. I am not going to explain these, you will just know how they work from reading - it is that nice

Temporal.Now.plainDateISO()

or how about

Temporal.Now.add({days: 1})

or

Temporal.Now.add({days: 1}).subtract({years:2})

Resources