replaced dayjs with date-fns

This commit is contained in:
2024-03-27 11:37:57 +01:00
parent 5da644acce
commit ec7fb0ecc3
6 changed files with 36 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
import React, {useReducer} from 'react';
import {createContext, useCallback, useState} from "react";
import { enUS as dateFnsEN, de as dateFnsDE } from 'date-fns/locale';
import {getCookie, getParameter} from "./util";
const LocaleContext = createContext(null);
@@ -31,7 +32,7 @@ function reducer(entries, action) {
function LocaleProvider(props) {
const [entries, dispatch] = useReducer(reducer, window.languageEntries || {});
const [currentLocale, setCurrentLocale] = useState(window.languageCode || "en_US");
const [currentLocale, setCurrentLocale] = useState(window.languageCode || getParameter("lang") || getCookie("lang") || "en_US");
const translate = useCallback((key, defaultTranslation = null) => {