# General Translation Knowledge Base: Why do dates cause a React hydration mismatch?
URL: https://generaltranslation.com/en-GB/kb/date-hydration-mismatch.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: The server and the browser format the same date differently when they run in different time zones or default locales, so the HTML React hydrates doesn't match the client render. Pass an explicit locale and timeZone to every date format, or render the date only on the server.
Category: Locale Formatting
Last updated: 2026-11-23
Authors: Kevin Wu
Published: 2026-11-23

A server-rendered React app formats each date twice: once on the server to build the HTML, and again in the browser when React hydrates that HTML. If the two runs produce different text, React reports a hydration error and throws away the server HTML for that part of the tree. React&#39;s own error message names the cause: &quot;Date formatting in a user&#39;s locale which doesn&#39;t match the server.&quot;

## What the error looks like

In React 19 the console shows:

```text
Hydration failed because the server rendered text didn't match the client.
As a result this tree will be regenerated on the client.
```

The message lists several causes, including `Date.now()`, `typeof window` branches, and browser extensions. When the diff under the message shows two versions of the same date or number, such as `11/24/2026` against `11/23/2026` or `1,234.5` against `1.234,5`, the cause is locale formatting.

## Why the server and the browser disagree

`toLocaleDateString()`, `toLocaleString()`, and `new Intl.DateTimeFormat()` with no arguments use the runtime&#39;s default locale and time zone. A server usually runs in UTC with a default locale of `en-US`. The browser uses the visitor&#39;s operating system settings. The same timestamp, `2026-11-24T03:30:00Z`, formatted with no arguments on three machines (Node.js 24):

| Runtime settings                | `d.toLocaleDateString()` | `d.toLocaleString()`     | `(1234.5).toLocaleString()` |
| ------------------------------- | ------------------------ | ------------------------ | --------------------------- |
| Server: `en-US`, UTC            | `11/24/2026`             | `11/24/2026, 3:30:00 AM` | `1,234.5`                   |
| Browser in Los Angeles: `en-US` | `11/23/2026`             | `11/23/2026, 7:30:00 PM` | `1,234.5`                   |
| Browser in Berlin: `de-DE`      | `24.11.2026`             | `24.11.2026, 04:30:00`   | `1.234,5`                   |

Two separate things differ:

* **The time zone** changes the date itself. 3:30 AM UTC on the 24th is still the 23rd in Los Angeles.
* **The locale** changes the format: day and month order, separators, and the 12- or 24-hour clock.

Either one is enough to break hydration, and neither shows up in local development when your laptop, your dev server, and your browser share the same settings.

## Fix 1: pass an explicit locale and time zone

Formatting is deterministic when every input is fixed. Give `Intl.DateTimeFormat` the locale and the `timeZone` instead of letting each runtime pick its own:

```tsx
// ❌ Different output on the server and in the browser
<p>{event.date.toLocaleDateString()}</p>

// ✅ Same output everywhere
<p>
  {new Intl.DateTimeFormat(locale, {
    year: 'numeric',
    month: 'short',
    day: 'numeric',
    timeZone: 'America/New_York',
    timeZoneName: 'short',
  }).format(event.date)}
</p>
```

The locale should come from your app&#39;s active language, the same value the server used to render the page, not from the browser. The time zone needs a decision:

* **A fixed zone**, such as `UTC` or the event&#39;s venue zone, when every reader should see the same date. Show the zone name with `timeZoneName: 'short'` so readers know which one it is. As in the example above, use explicit date fields with this option; it cannot be combined with `dateStyle` or `timeStyle`.
* **The reader&#39;s zone**, when the date should read as local time. The server can&#39;t know it on the first request, so save it once the browser reports it (`Intl.DateTimeFormat().resolvedOptions().timeZone`) in a cookie or account setting, then format with it on later requests. Until it is known, use Fix 2 or Fix 3.

The same applies to numbers and currencies: pass the locale to `Intl.NumberFormat` instead of calling `toLocaleString()` with no arguments.

## Fix 2: format in the browser after hydration

When a value depends on the reader&#39;s clock or zone and the server can&#39;t know it, render a stable placeholder on the server and fill in the date after hydration:

```tsx title="LocalTime.tsx"
'use client';
import { useEffect, useState } from 'react';

export function LocalTime({ date, locale }: { date: Date; locale: string }) {
  const [text, setText] = useState<string | null>(null);

  useEffect(() => {
    // Runs only in the browser, after hydration, so it can use the reader's zone
    setText(
      new Intl.DateTimeFormat(locale, {
        dateStyle: 'medium',
        timeStyle: 'short',
      }).format(date)
    );
  }, [date, locale]);

  // Server HTML and first client render both show the ISO date, so they match
  return <time dateTime={date.toISOString()}>{text ?? date.toISOString().slice(0, 10)}</time>;
}
```

The cost is a visible change after load and a date that search engines see in its placeholder form, so keep this for values that are genuinely per-reader, such as &quot;your next billing date at 9:00 AM your time&quot;.

## Fix 3: render the date only on the server

A Server Component in the Next.js App Router renders once, on the server, and is never re-rendered in the browser. A date formatted there can&#39;t mismatch, because there is no second render to compare. The trade-off is that it uses the server&#39;s time zone unless you pass one. (See [How do I translate Next.js Server Components?](/kb/translate-nextjs-server-components)).

## What about `suppressHydrationWarning`?

React lets you add [`suppressHydrationWarning`](https://react.dev/reference/react-dom/client/hydrateRoot#suppressing-unavoidable-hydration-mismatch-errors) to an element whose text can&#39;t match, such as a timestamp. It only silences the warning one level deep and does not fix the content: React keeps the server&#39;s text, so the reader can still see the server&#39;s date in the server&#39;s zone. Use it for values that are allowed to be slightly stale, not to hide a wrong date.

## Relative times have the same problem

&quot;5 minutes ago&quot; depends on the current time as well as the locale and zone, so the server and the browser can disagree even with identical settings: the server renders &quot;59 seconds ago&quot; and the browser, a moment later, renders &quot;1 minute ago&quot;. Pass the same reference time to both renders. (See [How do I format &quot;3 days ago&quot; in JavaScript?](/kb/relative-time-format)).

## How General Translation&#39;s components handle it

General Translation&#39;s [`<DateTime>`](/docs/react/reference/components/datetime), [`<Num>`](/docs/react/reference/components/num), [`<Currency>`](/docs/react/reference/components/currency), and [`<RelativeTime>`](/docs/react/reference/components/relative-time) components format with `Intl` and take the locale from the app&#39;s active language, which the server resolves from the request and passes to the browser. That removes the default-locale half of the problem: the server and the browser format for the same locale.

The time zone is still the runtime&#39;s unless you set it, so pin it with `options`:

```tsx
import { DateTime } from 'gt-next';

export function EventDate({ event }) {
  // Locale comes from the active language; the time zone is fixed explicitly
  return <DateTime options={{ dateStyle: 'medium', timeZone: 'UTC' }}>{event.date}</DateTime>;
}
```

In `gt-next`, these components render on the server when used in a Server Component, which is Fix 3 without extra code. In a Client Component they render on both sides, so the `timeZone` option is what keeps the output identical. Inside [`<T>`](/docs/react/reference/components/t), the formatted value stays out of the translated sentence, so `Updated <DateTime>…</DateTime>` translates once and shows each reader&#39;s date format. (See [How do I format numbers, dates, and currencies for each locale?](/kb/format-numbers-dates-currencies)).

## Key takeaways

* Hydration errors from dates come from two defaults: the runtime&#39;s time zone and the runtime&#39;s locale.
* Pass both to every `Intl` formatter, with the locale taken from your app&#39;s language rather than the browser.
* Values that depend on the reader&#39;s own zone or clock either render after hydration or use a zone you saved earlier.
* Server-only rendering can&#39;t mismatch, but it formats in the server&#39;s zone unless you pass one.
* `suppressHydrationWarning` hides the warning; it doesn&#39;t make the date right.

## Related questions

- [How do I format numbers, dates and currencies for each locale?](https://generaltranslation.com/en-GB/kb/format-numbers-dates-currencies.mdx): Format each value when the page renders, using the reader's locale and JavaScript's Intl API, and keep it out of the translated sentence. General Translation's `<Num>`, `<Currency>`, `<DateTime>` and `<RelativeTime>` components do both inside a `<T>`, so one translation serves every value.
- [How do I format "3 days ago" in JavaScript?](https://generaltranslation.com/en-GB/kb/relative-time-format.mdx): Use JavaScript's built-in Intl.RelativeTimeFormat, which formats a number and a unit as relative time for any locale, including words like yesterday and the right plural form. It doesn't pick the unit, so add a small helper that chooses seconds, minutes, hours, or days from the difference between two dates.
- [How do I detect a user's browser language?](https://generaltranslation.com/en-GB/kb/detect-user-language.mdx): Read the browser's ordered language list, navigator.languages in JavaScript or the Accept-Language header on the server, sorted by q-value, and match it to your supported locales with a fallback. Safari and Chrome incognito report only one language, and IP geolocation reveals location, not language.
- [How do I translate Next.js Server Components?](https://generaltranslation.com/en-GB/kb/translate-nextjs-server-components.mdx): Load translations on the server for the request's locale and render translated text there, so Server Components send finished HTML and no translation code to the browser. With gt-next, wrap JSX in T and call useGT in synchronous components, await getGT in async ones, and let GTProvider pass translations to Client Components.

## Previous and next questions

- Previous question: [Which languages should I translate my app into first?](https://generaltranslation.com/en-GB/kb/which-languages-first.mdx)

## Sitemap

See the [Knowledge Base sitemap](https://generaltranslation.com/en-GB/kb/sitemap.md) for every article.
