From a9b5937132126885b51a75ad82a39243927c455e Mon Sep 17 00:00:00 2001 From: krapcys1-maker Date: Sun, 29 Mar 2026 10:11:22 +0300 Subject: [PATCH] fix: issue #1411 patch from pipeline run --- pages/index.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index fdb10a31..28d14efa 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,7 +1,7 @@ // index.tsx import React, { useEffect, useState } from 'react' -import Head from 'next/head' import { useRouter } from 'next/router' +import Head from 'next/head' import { shouldIDeploy, getBaseUrl } from '../helpers/constants' import Time from '../helpers/time' import Widget from '../component/widget' @@ -26,14 +26,11 @@ const isValidCustomDate = (date?: string): date is string => { const Page: React.FC = ({ tz, now: initialNow, initialReason }) => { const router = useRouter() - const queryTimezone = - typeof router.query.tz === 'string' && Time.zoneExists(router.query.tz) - ? router.query.tz - : tz - const [timezone, setTimezone] = useState(queryTimezone) - const [now, setNow] = useState( - new Time(queryTimezone, initialNow.customDate) - ) + const queryTz = router.query.tz + const resolvedTz = + typeof queryTz === 'string' && Time.zoneExists(queryTz) ? queryTz : tz + const [timezone, setTimezone] = useState(resolvedTz) + const [now, setNow] = useState(new Time(resolvedTz, initialNow.customDate)) const [theme, setTheme] = useState(Theme.Light) useEffect(() => {