Update admin layout and pages (#976)

This commit is contained in:
Luke Vella 2024-01-13 15:09:48 +07:00 committed by GitHub
parent 0ba7e9ce91
commit a1bac0c986
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 2053 additions and 1260 deletions

View file

@ -205,6 +205,15 @@ export const DayjsProvider: React.FunctionComponent<{
return await dayjsLocales[l].import();
}, [l]);
const preferredTimeZone = config?.timeZone ?? getBrowserTimeZone();
const adjustTimeZone = React.useCallback(
(date: dayjs.ConfigType, keepLocalTime = false) => {
return dayjs(date).tz(preferredTimeZone, keepLocalTime);
},
[preferredTimeZone],
);
if (!state.value) {
// wait for locale to load before rendering
return null;
@ -234,16 +243,10 @@ export const DayjsProvider: React.FunctionComponent<{
dayjs.locale(dayjsLocale);
}
const preferredTimeZone = config?.timeZone ?? getBrowserTimeZone();
return (
<DayjsContext.Provider
value={{
adjustTimeZone: (date, keepLocalTime) => {
return keepLocalTime
? dayjs(date).utc()
: dayjs(date).tz(preferredTimeZone);
},
adjustTimeZone,
dayjs,
locale: localeConfig, // locale defaults
timeZone: preferredTimeZone,