Limited Time Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 123 courses on Level Up Tutorials

or Learn More

This is your last time to get Level Up Pro for $145/year.

0 days 0 hrs 0 min 0 sec

Get Current Date with JavaScript Temporal API

Nov 09, 2021

User avatar
Author
Scott Tolinski

In this post, we'll show you how to access the current day with the Temporal API.

Tldr;

Current Day

Temporal.Now.plainDateISO().day

Current Month

Temporal.Now.plainDateISO().month

Current Current Year

Temporal.Now.plainDateISO().year

You get the point. It's really explicit and easy once you know where to look. You are getting a Temporal date and then accessing date properties like day, month, year.

Temporal.Now.plainDateISO() - get the current date in the system time zone and ISO-8601 calendar

https://tc39.es/proposal-temporal/docs/#Temporal-Now

So, what other properties exist on a Temporal plain date?

This was a quick one with a few key snippets, stay tuned for more Temporal content.

temporal javascript, js dates