From c0d4d233da911143b175b35bebd7c0406584a49d Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Tue, 4 Apr 2023 21:52:59 +0200 Subject: [PATCH] fix: configure luxon Signed-off-by: Tilman Vatteroth --- frontend/src/pages/_app.tsx | 3 +++ frontend/src/utils/configure-luxon.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 frontend/src/utils/configure-luxon.ts diff --git a/frontend/src/pages/_app.tsx b/frontend/src/pages/_app.tsx index 39c6b4219..c6829bfdf 100644 --- a/frontend/src/pages/_app.tsx +++ b/frontend/src/pages/_app.tsx @@ -13,10 +13,13 @@ import { BaseHead } from '../components/layout/base-head' import { UiNotificationBoundary } from '../components/notifications/ui-notification-boundary' import { StoreProvider } from '../redux/store-provider' import { BaseUrlFromEnvExtractor } from '../utils/base-url-from-env-extractor' +import { configureLuxon } from '../utils/configure-luxon' import { ExpectedOriginBoundary } from '../utils/uri-origin-boundary' import type { AppInitialProps, AppProps } from 'next/app' import React from 'react' +configureLuxon() + interface AppPageProps { baseUrls: BaseUrls | undefined } diff --git a/frontend/src/utils/configure-luxon.ts b/frontend/src/utils/configure-luxon.ts new file mode 100644 index 000000000..e2bb57ae1 --- /dev/null +++ b/frontend/src/utils/configure-luxon.ts @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import { Settings } from 'luxon' + +export const configureLuxon = () => { + Settings.throwOnInvalid = true +} + +declare module 'luxon' { + interface TSSettings { + throwOnInvalid: true + } +}