Learning center

A date shows one day off: find where the value shifted

A date shown one day off moved during a time zone conversion, either in the API or in the browser. Compare the raw API value with the displayed value in the user's time zone to find where.

How a date-only value moves a day#

JavaScript parses a date-only string such as "2026-11-20" as midnight UTC. It parses a date-time string without an offset, such as "2026-11-20T00:00:00", as midnight in the browser's local time zone. MDN: Date.parse and date-only forms Formatting with toLocaleDateString then converts to local time.

In Chromium with the time zone set to America/Los_Angeles:

new Date("2026-11-20").toLocaleDateString("en-US")
  → 11/19/2026            (toISOString: 2026-11-20T00:00:00.000Z)

new Date("2026-11-20T00:00:00").toLocaleDateString("en-US")
  → 11/20/2026            (toISOString: 2026-11-20T08:00:00.000Z)

Midnight UTC on 20 November is 16:00 on 19 November in Los Angeles, so the date-only value is displayed as the 19th. Users east of UTC see the correct day for this value. Users west of UTC see the previous day. That pattern, one day early only for users west of UTC, is typical of this cause. A wrong timestamp from the server can also look different to each viewer, so the pattern alone does not decide; the raw value does.

Two causes to separate#

Cause A: the API sent a shifted valueCause B: the browser shifted a correct value
Raw value in the responseA calendar date that is already the wrong day, or a timestamp that is not the intended momentThe intended calendar date, or a timestamp for the intended moment
Example"2026-11-19T23:00:00Z" when the due time is midnight on 20 November in New York"2026-11-19T23:00:00Z" when the due time is midnight on 20 November in Berlin
Where the fix goesThe server's serialization or storageThe page's parsing or formatting

The same timestamp can belong to either column, so first establish what the field means: a calendar date, such as a due date that is the same day everywhere, or a moment in time, and in which time zone it should be shown. The deciding observation is then the raw value in the API response against that intended value, next to the value on screen and the browser's time zone.

Record the three values#

  1. What the field means: a calendar date or a moment, and the time zone it should display in. The API documentation, the database column type or the PDF usually says.
  2. The raw value. Select the API request in the Network panel and copy the field exactly from the Response tab, such as "dueDate": "2026-11-20" or "dueAt": "2026-11-19T23:00:00Z".
  3. The displayed value, copied from the page.
  4. The browser's time zone and locale. In the Console, run:
Intl.DateTimeFormat().resolvedOptions()

It returns the timeZone, such as America/Los_Angeles, and the locale. resolvedOptions

To reproduce another user's view, choose a location with their time zone in DevTools' Sensors panel; custom locations take a time zone ID and a locale. DevTools custom locations

Worked example: due dates a day early in the United States#

This example is fictional. A billing app shows invoice due dates. Customers in New York and California report that due dates are one day earlier than in the PDF invoice. Customers in Berlin see the same date as the PDF.

The invoice API returned "dueDate": "2026-12-01", the intended day. The page displayed 11/30/2026 with the browser's timeZone set to America/New_York. With the Sensors panel set to Berlin, the page displayed 01/12/2026 in the en-GB locale, which is 1 December. The raw value was correct for every viewer, so the shift happened in the browser.

The report said: the API sends dueDate as a date-only string. The page parses it with new Date(value), which reads it as midnight UTC, and formats it in local time. Viewers west of UTC see the previous day. The receiver could fix it by formatting the date-only value as a calendar date without converting it, such as passing timeZone: "UTC" to the formatter for date-only fields.

When the API is the cause#

If the raw value is a timestamp, check which moment it was meant to represent before you call it wrong. "2026-11-19T23:00:00Z" is 20 November in Berlin and 19 November in UTC, so it is correct for a Berlin midnight deadline and wrong for a New York one. A server that stored a user's local midnight as UTC and then sends only the date part, or a database column that converts on read, produces a wrong value before the browser sees it. A wrong calendar date looks the same to every viewer; a wrong timestamp can look different in each time zone. Report the raw value, the value it should have been, and where you know that from.

What to put in the report#

  • The raw field from the API response, copied exactly.
  • The value the page displayed.
  • The browser's timeZone and locale from resolvedOptions().
  • Whether viewers in other time zones see a different value.
  • The day the value should represent, and where you know that from, such as the PDF or the database.

Questions#

Why is it correct for me and wrong for a colleague?

The browser formats in its own time zone. If you are east of UTC and your colleague is west of it, a date-only value parsed as UTC shows correctly for you and one day early for them. A wrong timestamp from the server can produce the same split, so compare the raw value with the intended one before you assign the fix.

Does daylight saving time matter?

It changes offsets during the year. A value near midnight can display correctly in winter and shift in summer, or the reverse. Record the date of the observation along with the time zone.

Can this happen on the server too?

Yes. A server that formats dates in its own time zone, or a library that converts a date-only value to a timestamp, can shift it before sending. In that case the API sends a shifted value, and the raw response shows it.

Return to the method for browser bug reports for the other symptoms in this collection.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading