From d5979ed6c8db684d94f77150f5af48b49a04f63b Mon Sep 17 00:00:00 2001 From: Nevo David Date: Thu, 7 Aug 2025 21:31:15 +0700 Subject: [PATCH] feat: better performance for timezone --- .../src/components/layout/set.timezone.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/frontend/src/components/layout/set.timezone.tsx b/apps/frontend/src/components/layout/set.timezone.tsx index e0a3a604..1835b96e 100644 --- a/apps/frontend/src/components/layout/set.timezone.tsx +++ b/apps/frontend/src/components/layout/set.timezone.tsx @@ -21,18 +21,16 @@ export const newDayjs = (config?: ConfigType) => { const SetTimezone: FC = () => { useEffect(() => { - dayjs.utc = new Proxy(originalUtc, { - apply(target, thisArg, args) { - const result = target.apply(thisArg, args); + dayjs.utc = (config?: ConfigType, format?: string, strict?: boolean) => { + const result = originalUtc(config, format, strict); - // Attach `.local()` method to the returned Dayjs object - result.local = function () { - return result.tz(getTimezone()); - }; + // Attach `.local()` method to the returned Dayjs object + result.local = function () { + return result.tz(getTimezone()); + }; - return result; - }, - }); + return result; + }; if (localStorage.getItem('timezone')) { dayjs.tz.setDefault(getTimezone()); }