Skip to content

Commit

Permalink
Refactor i18n and dayjs initialization
Browse files Browse the repository at this point in the history
Explicitly add `i18n` initialization on the root `index.tsx`.

Move `dayjs` initialization to its own file `dayjs.ts` referenced
from `index.tsx`.  This follows the `i18n` init style.

Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
  • Loading branch information
sjd78 committed Jan 17, 2024
1 parent 2ea144d commit b027b88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
10 changes: 10 additions & 0 deletions client/src/app/dayjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dayjs from "dayjs";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import customParseFormat from "dayjs/plugin/customParseFormat";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(customParseFormat);
dayjs.extend(isSameOrBefore);
11 changes: 2 additions & 9 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ import ENV from "@app/env";
import App from "@app/App";
import reportWebVitals from "@app/reportWebVitals";
import { KeycloakProvider } from "@app/components/KeycloakProvider";
import dayjs from "dayjs";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import customParseFormat from "dayjs/plugin/customParseFormat";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(customParseFormat);
dayjs.extend(isSameOrBefore);
import "@app/dayjs";
import "@app/i18n";

const queryClient = new QueryClient();

Expand Down

0 comments on commit b027b88

Please sign in to comment.