Get the Current Date in a Specific Timezone in JavaScript
To get today's date in a user's zone, call Temporal.Now.plainDateISO(timeZone) with their IANA id — never the host's clock. Part of Getting the Current Time with Temporal.Now.
Why this scenario is tricky
A server almost always runs in UTC, so new Date().getDate() gives the UTC calendar day — which is yesterday or tomorrow for a large share of the world at any given moment. Computing "today" for a user means reading the clock in the user's zone, not the host's.
Minimal working solution
import { Temporal } from '@js-temporal/polyfill';
// Pass the user's IANA zone, not the host's.
const today = Temporal.Now.plainDateISO('America/New_York');
console.log(today.toString()); // e.g. '2026-07-22'
Full production version
Validate the zone and fall back to UTC when the user's zone is unknown.
import { Temporal } from '@js-temporal/polyfill';
function todayIn(zone: string | undefined): Temporal.PlainDate {
try {
return Temporal.Now.plainDateISO(zone ?? 'UTC');
} catch {
throw new RangeError(`Invalid time zone: ${zone}`);
}
}
Verification snippet
Common pitfalls
Frequently Asked Questions
Why does the server show yesterday's or tomorrow's date?
Servers usually run in UTC, so new Date().getDate() returns the UTC calendar day. For users west or far east of UTC that is a different day, so always compute today with the user's IANA zone via Temporal.Now.plainDateISO.
What if I don't know the user's time zone?
Default to UTC and detect the zone client-side with Intl.DateTimeFormat().resolvedOptions().timeZone, then persist it. Rendering with the user's stored zone gives a correct 'today' on subsequent server renders.