Sign Up
Go Pro Sign Up Login

Get Current Date with JavaScript Temporal API

Sep 08, 2021

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