Extract dayjs setup into file
This commit is contained in:
@@ -8,20 +8,12 @@
|
|||||||
|
|
||||||
import { StrictMode } from 'react';
|
import { StrictMode } from 'react';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
||||||
import { App } from '@/App';
|
import { App } from '@/App';
|
||||||
import '@/index.css';
|
import '@/index.css';
|
||||||
// roboto font
|
// roboto font
|
||||||
import '@fontsource/roboto';
|
import '@fontsource/roboto';
|
||||||
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
||||||
import { loadDayJsLocale } from '@/util/language.tsx';
|
import '@/lib/dayjs/Setup.ts';
|
||||||
|
|
||||||
dayjs.extend(customParseFormat);
|
|
||||||
|
|
||||||
loadDayJsLocale(navigator.language).then(() => {
|
|
||||||
dayjs.locale(navigator.language);
|
|
||||||
});
|
|
||||||
|
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.ready.then((registration) => {
|
navigator.serviceWorker.ready.then((registration) => {
|
||||||
|
|||||||
17
src/lib/dayjs/Setup.ts
Normal file
17
src/lib/dayjs/Setup.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||||
|
import { loadDayJsLocale } from '@/util/language.tsx';
|
||||||
|
|
||||||
|
dayjs.extend(customParseFormat);
|
||||||
|
|
||||||
|
loadDayJsLocale(navigator.language).then(() => {
|
||||||
|
dayjs.locale(navigator.language);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user