diff --git a/src/components/calendar/calendar.tsx b/src/components/calendar/calendar.tsx index bb30ebd..aa40dd9 100644 --- a/src/components/calendar/calendar.tsx +++ b/src/components/calendar/calendar.tsx @@ -2,6 +2,7 @@ import React, { ReactChild } from "react"; import { ViewMode } from "../../types/public-types"; import { TopPartOfCalendar } from "./top-part-of-calendar"; import { + getCachedDateTimeFormat, getDaysInMonth, getLocaleMonth, getWeekNumberISO8601, @@ -177,7 +178,7 @@ export const Calendar: React.FC = ({ const dates = dateSetup.dates; for (let i = 0; i < dates.length; i++) { const date = dates[i]; - const bottomValue = Intl.DateTimeFormat(locale, { + const bottomValue = getCachedDateTimeFormat(locale, { hour: "numeric", }).format(date); diff --git a/src/helpers/date-helper.ts b/src/helpers/date-helper.ts index c4a682a..b784a85 100644 --- a/src/helpers/date-helper.ts +++ b/src/helpers/date-helper.ts @@ -12,7 +12,7 @@ type DateHelperScales = | "millisecond"; const intlDTCache = {}; -const getCachedDateTimeFormat = ( +export const getCachedDateTimeFormat = ( locString: string | string[], opts: DateTimeFormatOptions = {} ): DateTimeFormat => { @@ -25,6 +25,7 @@ const getCachedDateTimeFormat = ( return dtf; }; + export const addToDate = ( date: Date, quantity: number, @@ -189,3 +190,4 @@ export const getWeekNumberISO8601 = (date: Date) => { export const getDaysInMonth = (month: number, year: number) => { return new Date(year, month + 1, 0).getDate(); }; +