From a67fb3576c35dbdc1774b51731336349cfb21d39 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Wed, 13 Dec 2023 19:46:37 -0500 Subject: [PATCH] Issues with Scoreboard. Most things check out with dayjs besides that. Signed-off-by: Dave Richer --- .../form-date-picker.component.jsx | 4 -- .../scoreboard-targets-table.util.js | 8 --- client/src/utils/day.js | 60 ++++++++++++++++++- 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/client/src/components/form-date-picker/form-date-picker.component.jsx b/client/src/components/form-date-picker/form-date-picker.component.jsx index c58db4739..b50a2e0cf 100644 --- a/client/src/components/form-date-picker/form-date-picker.component.jsx +++ b/client/src/components/form-date-picker/form-date-picker.component.jsx @@ -58,10 +58,6 @@ export function FormDatePicker({ && value && value.isValid && value.isValid() - && typeof value.hours === 'function' - && typeof value.minutes === 'function' - && typeof value.seconds === 'function' - && typeof value.milliseconds === 'function' ) { _a.set({ hours: value.hours(), diff --git a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js index 8acfae1e5..461775631 100644 --- a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js +++ b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js @@ -57,14 +57,6 @@ export const AsOfDateTargetHours = (dailyTargetHours, date) => { ); }; -export const ListOfBusinessDaysInCurrentMonth = () => { - // TODO This is probably broken :/ - console.log('Hit!!!!') - const momentListOfDays = dayjs().businessDaysInMonth(); - - return momentListOfDays.map((i) => i.format("YYYY-MM-DD")); -}; - export const ListOfDaysInCurrentMonth = () => { const days = []; const dateStart = dayjs().startOf("month"); diff --git a/client/src/utils/day.js b/client/src/utils/day.js index 9ee744acc..1b6bda2a6 100644 --- a/client/src/utils/day.js +++ b/client/src/utils/day.js @@ -1,15 +1,71 @@ import dayjs from 'dayjs'; import dayjsBusinessDays from "dayjs-business-days2"; import isSameOrAfter from "dayjs/plugin/isSameOrAfter"; +import updateLocale from 'dayjs/plugin/updateLocale'; import isSameOrBefore from "dayjs/plugin/isSameOrBefore"; import timezone from 'dayjs/plugin/timezone'; import utc from 'dayjs/plugin/utc'; +import minMax from 'dayjs/plugin/minMax'; +import isBetween from 'dayjs/plugin/isBetween'; +import customParseFormat from 'dayjs/plugin/customParseFormat'; +import pluralGetSet from 'dayjs/plugin/pluralGetSet'; +import duration from 'dayjs/plugin/duration'; +import advancedFormat from 'dayjs/plugin/advancedFormat'; +import arraySupport from 'dayjs/plugin/arraySupport'; +import calendar from 'dayjs/plugin/calendar'; +import dayOfYear from 'dayjs/plugin/dayOfYear'; +import weekday from 'dayjs/plugin/weekday'; +import weekOfYear from 'dayjs/plugin/weekOfYear'; +import weekYear from 'dayjs/plugin/weekYear'; +import isoWeek from 'dayjs/plugin/isoWeek'; +import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear'; +import isLeapYear from 'dayjs/plugin/isLeapYear'; +import localeData from 'dayjs/plugin/localeData'; +import localizedFormat from 'dayjs/plugin/localizedFormat'; +import quarterOfYear from 'dayjs/plugin/quarterOfYear'; +import relativeTime from 'dayjs/plugin/relativeTime'; +import isToday from 'dayjs/plugin/isToday'; +import isTomorrow from 'dayjs/plugin/isTomorrow'; +import isYesterday from 'dayjs/plugin/isYesterday'; +import objectSupport from 'dayjs/plugin/objectSupport'; +import toArray from 'dayjs/plugin/toArray'; +import toObject from 'dayjs/plugin/toObject'; +// import badMutable from 'dayjs/plugin/badMutable'; +// import preParsePostFormat from 'dayjs/plugin/preParsePostFormat'; + +// dayjs.extend(badMutable); // TODO: Client Update - This is not advised, scoreboard page +dayjs.extend(toObject); +dayjs.extend(toArray); +dayjs.extend(objectSupport); +dayjs.extend(isYesterday); +dayjs.extend(isTomorrow); +dayjs.extend(isToday); +dayjs.extend(localeData); +dayjs.extend(relativeTime); +dayjs.extend(quarterOfYear); +dayjs.extend(localizedFormat); +// dayjs.extend(preParsePostFormat); // TODO: This should not be needed +dayjs.extend(isLeapYear); +dayjs.extend(isoWeeksInYear); +dayjs.extend(isoWeek); +dayjs.extend(weekYear); +dayjs.extend(weekOfYear); +dayjs.extend(weekday); +dayjs.extend(dayOfYear); +dayjs.extend(calendar); +dayjs.extend(arraySupport); +dayjs.extend(advancedFormat); +dayjs.extend(duration); +dayjs.extend(pluralGetSet); +dayjs.extend(customParseFormat); dayjs.extend(utc); dayjs.extend(timezone); -dayjs.extend(dayjsBusinessDays); +dayjs.extend(updateLocale); dayjs.extend(isSameOrAfter); dayjs.extend(isSameOrBefore); - +dayjs.extend(minMax); +dayjs.extend(isBetween); +dayjs.extend(dayjsBusinessDays); export default dayjs; \ No newline at end of file