Skip to content

Commit 14b5210

Browse files
claude[bot]ncarazon
andcommitted
fix: restore explicit "original" -> "en" fallback in LocalDaytime
Restore the pre-existing workaround (and its comment) that defaults the locale to "en" when it is "original", to avoid the server/client hydration mismatch on `localValue`. The centralized `normalizeIntlLocale` covers Intl call sites, but this component-level guard is what keeps SSR and CSR producing the same string here. Co-authored-by: Nikita <93587872+ncarazon@users.noreply.github.com>
1 parent 6d0303c commit 14b5210

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

front_end/src/components/ui/local_daytime.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ type Props = {
99
};
1010

1111
const LocalDaytime: FC<Props> = ({ date }) => {
12-
const locale = useLocale();
12+
let locale = useLocale();
13+
if (locale === "original") {
14+
// For some reason, when the locale is "original" (Untranslated), the the server and client
15+
// endup with different values for the localValue variable. This is a workaround to
16+
// make sure the dates render correctly on both and default to English locale when
17+
// in Untranslated mode
18+
locale = "en";
19+
}
1320
const localValue = date ? formatDate(locale, new Date(date)) : "";
1421

1522
return (

0 commit comments

Comments
 (0)