React by Patrik

Understanding Timezone Behavior in JavaScript

JavaScript Date objects are always created and manipulated relative to the user’s local timezone, which it gets from the environment.

const date = new Date("2025-05-27T20:03:00Z"); // stored as UTC
console.log(date.toString()); 
// → "Tue May 27 2025 22:03:00 GMT+0200 (Central European Summer Time)"

To determine the client’s timezone:

Intl.DateTimeFormat().resolvedOptions().timeZone
// → "Europe/Berlin" or similar

This automatic timezone handling is key to understanding how UTC inputs appear offset when viewed or edited on the frontend.

javascript
timezone
utc
datetime
date object

Comments