"use client"; import { useEffect, useState } from "react"; import { Input, Label } from "@/components/ui/input"; import { useT } from "@/components/I18n"; /** IANA timezone for quiet hours and the digest, with «как в браузере» (PEP-35). */ export function TimezoneField({ value }: { value: string }) { const t = useT(); const [tz, setTz] = useState(value); const [browser, setBrowser] = useState(null); const [zones, setZones] = useState([]); // Client-only: the server's and the browser's lists may differ (no hydration mismatch). useEffect(() => { setBrowser(Intl.DateTimeFormat().resolvedOptions().timeZone); setZones(typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : []); }, []); return (
{zones.map((z) => ( {browser && browser !== tz && ( )}
); }