Fix: Defaults / dayjs will not always be present.

This commit is contained in:
Paul 2021-07-04 12:46:33 +01:00
parent 841320aab7
commit 8e0e226ec6

View file

@ -127,7 +127,7 @@ function Locale({ children, locale }: Props) {
function transformLanguage(obj: { [key: string]: any }) { function transformLanguage(obj: { [key: string]: any }) {
const dayjs = obj.dayjs; const dayjs = obj.dayjs;
const defaults = dayjs.defaults; const defaults = dayjs?.defaults;
const twelvehour = defaults?.twelvehour === 'yes' || true; const twelvehour = defaults?.twelvehour === 'yes' || true;
const separator: '/' | '-' | '.' = defaults?.date_separator ?? '/'; const separator: '/' | '-' | '.' = defaults?.date_separator ?? '/';