@elliemae/ds-form-date-time-picker 3.18.0 → 3.18.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js +2 -0
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
- package/dist/cjs/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +2 -2
- package/dist/cjs/utils/dateHelpers.js +31 -3
- package/dist/cjs/utils/dateHelpers.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js +2 -0
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -2
- package/dist/esm/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +2 -2
- package/dist/esm/utils/dateHelpers.js +31 -3
- package/dist/esm/utils/dateHelpers.js.map +2 -2
- package/dist/types/parts/Pickers/Calendar/CalendarWrapper.d.ts +1 -1
- package/dist/types/utils/dateHelpers.d.ts +1 -1
- package/package.json +9 -9
|
@@ -46,6 +46,8 @@ const CalendarWrapper = () => {
|
|
|
46
46
|
const { referenceElement, closeCalendar } = (0, import_react.useContext)(import_CalendarContext.CalendarContext);
|
|
47
47
|
if (isControllerOnly)
|
|
48
48
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CalendarContent.CalendarContent, {});
|
|
49
|
+
if (!referenceElement)
|
|
50
|
+
return null;
|
|
49
51
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
52
|
StyledPopper,
|
|
51
53
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/CalendarWrapper.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarContent } from './CalendarContent.js';\nimport { CalendarContext } from './CalendarContext.js';\nimport { styled } from '@elliemae/ds-system';\n\nconst StyledPopper = styled(DSPopperJS)``;\n\nexport const CalendarWrapper = (): JSX.Element => {\n const { isControllerOnly, getProps } = useContext(ControlledDateTimePickerContext);\n const { referenceElement, closeCalendar } = useContext(CalendarContext);\n if (isControllerOnly) return <CalendarContent />;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarContent } from './CalendarContent.js';\nimport { CalendarContext } from './CalendarContext.js';\nimport { styled } from '@elliemae/ds-system';\n\nconst StyledPopper = styled(DSPopperJS)``;\n\nexport const CalendarWrapper = (): JSX.Element | null => {\n const { isControllerOnly, getProps } = useContext(ControlledDateTimePickerContext);\n const { referenceElement, closeCalendar } = useContext(CalendarContext);\n\n if (isControllerOnly) return <CalendarContent />;\n if (!referenceElement) return null;\n return (\n <StyledPopper\n showPopover\n data-testid={ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.CALENDAR}\n referenceElement={referenceElement}\n withoutArrow\n onClickOutside={closeCalendar}\n getOwnerProps={getProps}\n >\n <CalendarContent />\n </StyledPopper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcQ;AAd/B,mBAAkC;AAClC,yBAA2B;AAC3B,gDAAmD;AACnD,yCAAgD;AAChD,6BAAgC;AAChC,6BAAgC;AAChC,uBAAuB;AAEvB,MAAM,mBAAe,yBAAO,6BAAU;AAE/B,MAAM,kBAAkB,MAA0B;AACvD,QAAM,EAAE,kBAAkB,SAAS,QAAI,yBAAW,kEAA+B;AACjF,QAAM,EAAE,kBAAkB,cAAc,QAAI,yBAAW,sCAAe;AAEtE,MAAI;AAAkB,WAAO,4CAAC,0CAAgB;AAC9C,MAAI,CAAC;AAAkB,WAAO;AAC9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAW;AAAA,MACX,eAAa,6EAAmC,gBAAgB;AAAA,MAChE;AAAA,MACA,cAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,eAAe;AAAA,MAEf,sDAAC,0CAAgB;AAAA;AAAA,EACnB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -54,7 +54,7 @@ const useCurrentDisplayedMonthYearLogic = () => {
|
|
|
54
54
|
setCurrentYear(yearFromDateString);
|
|
55
55
|
}, [yearFromDateString]);
|
|
56
56
|
const daysArray = (0, import_react.useMemo)(() => {
|
|
57
|
-
const newDaysArray = (0, import_dateHelpers.
|
|
57
|
+
const newDaysArray = (0, import_dateHelpers.getSixBySevenCurrentMonthDaysMatrix)(currentMonth, currentYear);
|
|
58
58
|
const hiddenPrevDay = (0, import_dateHelpers.sumValuesToDate)(newDaysArray[0].day, {
|
|
59
59
|
daysToSum: -1
|
|
60
60
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState, useEffect, createRef } from 'react';\n// eslint-disable-next-line max-len\nimport { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';\nimport {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAqE;AAErE,+DAAkE;AAClE,yBAKO;AAIP,SAAS,gBAAyB,KAAe,WAAoC;AACnF,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,WAAW;AAC9C,UAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,SAAS;AACxC,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;AAaO,MAAM,oCAAoC,MAA0C;AACzF,QAAM,EAAE,OAAO,qBAAqB,MAAM,mBAAmB,QAAI,4GAAkD;AACnH,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,mBAAmB;AACpE,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,kBAAkB;AAIjE,8BAAU,MAAM;AACd,oBAAgB,mBAAmB;AAAA,EACrC,GAAG,CAAC,mBAAmB,CAAC;AACxB,8BAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,UAAM,mBAAe,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState, useEffect, createRef } from 'react';\n// eslint-disable-next-line max-len\nimport { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';\nimport {\n getSixBySevenCurrentMonthDaysMatrix,\n sumFromDateValues,\n sumValuesToDate,\n getDateStringFromDay,\n} from '../../../utils/dateHelpers.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction sliceIntoChunks<T = any>(arr: Array<T>, chunkSize: number): Array<Array<T>> {\n const res = [];\n for (let i = 0; i < arr.length; i += chunkSize) {\n const chunk = arr.slice(i, i + chunkSize);\n res.push(chunk);\n }\n return res;\n}\ninterface UseCurrentDisplayedMonthYearLogicT {\n currentMonth: DSControlledDateTimePickerInternalsT.DateMonth;\n currentYear: number;\n daysArray: DSControlledDateTimePickerInternalsT.MetaMonthDay[];\n invisibleFirstDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n daysMatrixByWeekday: DSControlledDateTimePickerInternalsT.MetaMonthDay[][];\n invisibleLastDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n handlePrevMonth: () => void;\n handlePrevYear: () => void;\n handleNextMonth: () => void;\n handleNextYear: () => void;\n}\nexport const useCurrentDisplayedMonthYearLogic = (): UseCurrentDisplayedMonthYearLogicT => {\n const { month: monthFromDateString, year: yearFromDateString } = useGetMonthYearFromDateStringOrEmptyStartingMonth();\n const [currentMonth, setCurrentMonth] = useState(monthFromDateString);\n const [currentYear, setCurrentYear] = useState(yearFromDateString);\n\n // side-effects are really really controlled in this case so use-effect should be fine\n // don't add 200 side-effects to those or else Chaos would hunt us for the years to come\n useEffect(() => {\n setCurrentMonth(monthFromDateString);\n }, [monthFromDateString]);\n useEffect(() => {\n setCurrentYear(yearFromDateString);\n }, [yearFromDateString]);\n\n const daysArray = useMemo(() => {\n const newDaysArray = getSixBySevenCurrentMonthDaysMatrix(currentMonth, currentYear);\n const hiddenPrevDay = sumValuesToDate(newDaysArray[0].day, {\n daysToSum: -1,\n });\n const hiddenPrevMetaday = {\n day: hiddenPrevDay,\n dayAsString: getDateStringFromDay(hiddenPrevDay),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n const hiddenNextDay = sumValuesToDate(newDaysArray[newDaysArray.length - 1].day, {\n daysToSum: 1,\n });\n const hiddenNextMetaday = {\n day: hiddenNextDay,\n dayAsString: getDateStringFromDay(hiddenNextDay),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n return [hiddenPrevMetaday, ...newDaysArray, hiddenNextMetaday];\n }, [currentMonth, currentYear]);\n\n const handlePrevYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: -1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handlePrevMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: -1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: 1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: 1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const { invisibleFirstDay, daysMatrixByWeekday, invisibleLastDay } = useMemo(() => {\n const [invisible1stDay, ...otherDays] = [...daysArray];\n const invisibleDayLast = otherDays.pop();\n return {\n invisibleFirstDay: invisible1stDay,\n daysMatrixByWeekday: sliceIntoChunks<DSControlledDateTimePickerInternalsT.MetaMonthDay>(otherDays, 7),\n invisibleLastDay: invisibleDayLast,\n };\n }, [daysArray]);\n\n return useMemo(\n () => ({\n currentMonth,\n currentYear,\n daysArray,\n invisibleFirstDay,\n daysMatrixByWeekday,\n invisibleLastDay,\n handlePrevYear,\n handlePrevMonth,\n handleNextMonth,\n handleNextYear,\n }),\n [\n currentMonth,\n currentYear,\n daysArray,\n daysMatrixByWeekday,\n handleNextMonth,\n handleNextYear,\n handlePrevMonth,\n handlePrevYear,\n invisibleFirstDay,\n invisibleLastDay,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAqE;AAErE,+DAAkE;AAClE,yBAKO;AAIP,SAAS,gBAAyB,KAAe,WAAoC;AACnF,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,WAAW;AAC9C,UAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,SAAS;AACxC,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;AAaO,MAAM,oCAAoC,MAA0C;AACzF,QAAM,EAAE,OAAO,qBAAqB,MAAM,mBAAmB,QAAI,4GAAkD;AACnH,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,mBAAmB;AACpE,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,kBAAkB;AAIjE,8BAAU,MAAM;AACd,oBAAgB,mBAAmB;AAAA,EACrC,GAAG,CAAC,mBAAmB,CAAC;AACxB,8BAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,UAAM,mBAAe,wDAAoC,cAAc,WAAW;AAClF,UAAM,oBAAgB,oCAAgB,aAAa,CAAC,EAAE,KAAK;AAAA,MACzD,WAAW;AAAA,IACb,CAAC;AACD,UAAM,oBAAoB;AAAA,MACxB,KAAK;AAAA,MACL,iBAAa,yCAAqB,aAAa;AAAA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ACvC,UAAM,EAAE,MAAM,QAAQ,QAAI,sCAAkB,EAAE,OAAO,cAAc,MAAM,YAAY,GAAG,EAAE,YAAY,EAAE,CAAC;AACzG,mBAAe,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,WAAW,CAAC;AAE9B,QAAM,EAAE,mBAAmB,qBAAqB,iBAAiB,QAAI,sBAAQ,MAAM;AACjF,UAAM,CAAC,iBAAiB,GAAG,SAAS,IAAI,CAAC,GAAG,SAAS;AACrD,UAAM,mBAAmB,UAAU,IAAI;AACvC,WAAO;AAAA,MACL,mBAAmB;AAAA,MACnB,qBAAqB,gBAAmE,WAAW,CAAC;AAAA,MACpG,kBAAkB;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,11 +38,11 @@ __export(dateHelpers_exports, {
|
|
|
38
38
|
getDayFromDateString: () => getDayFromDateString,
|
|
39
39
|
getDaysInMonth: () => getDaysInMonth,
|
|
40
40
|
getFirstXDaysFromNextMonth: () => getFirstXDaysFromNextMonth,
|
|
41
|
-
getFiveBySevenCurrentMonthDaysMatrix: () => getFiveBySevenCurrentMonthDaysMatrix,
|
|
42
41
|
getHowManyDaysInMonth: () => getHowManyDaysInMonth,
|
|
43
42
|
getLastDayOfMonth: () => getLastDayOfMonth,
|
|
44
43
|
getLastXDaysFromPreviousMonth: () => getLastXDaysFromPreviousMonth,
|
|
45
44
|
getMonthNameByMonthNumber: () => getMonthNameByMonthNumber,
|
|
45
|
+
getSixBySevenCurrentMonthDaysMatrix: () => getSixBySevenCurrentMonthDaysMatrix,
|
|
46
46
|
getTimeStringFromDay: () => getTimeStringFromDay,
|
|
47
47
|
getValidationDateStringMetaInfo: () => getValidationDateStringMetaInfo,
|
|
48
48
|
isLeapYear: () => isLeapYear,
|
|
@@ -208,7 +208,7 @@ const getFirstXDaysFromNextMonth = (month, year, howMany) => {
|
|
|
208
208
|
}
|
|
209
209
|
return days;
|
|
210
210
|
};
|
|
211
|
-
const
|
|
211
|
+
const getSixBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
212
212
|
const currentMonthDays = getDaysInMonth(month, year).map((day) => ({
|
|
213
213
|
day,
|
|
214
214
|
dayAsString: getDateStringFromDay(day),
|
|
@@ -240,6 +240,34 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
|
240
240
|
isHidden: false,
|
|
241
241
|
dayBtnRef: (0, import_react.createRef)()
|
|
242
242
|
}));
|
|
243
|
-
|
|
243
|
+
const allDays = [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];
|
|
244
|
+
const is6by7 = allDays.length === 42;
|
|
245
|
+
if (is6by7)
|
|
246
|
+
return allDays;
|
|
247
|
+
const daysBefore = 7 + firstDayOfTheMonthWeekDay;
|
|
248
|
+
let daysAfter = 6 - lastDayOfTheMonthWeekDay;
|
|
249
|
+
const is4by7 = previousMonthDaysToPrepend.length === 0 && currentMonthDays.length === 28 && nextMonthDaysToAppend.length === 0;
|
|
250
|
+
if (is4by7) {
|
|
251
|
+
daysAfter = 7;
|
|
252
|
+
}
|
|
253
|
+
const previousMonthDaysToPrepend2 = getLastXDaysFromPreviousMonth(month, year, daysBefore).map((day) => ({
|
|
254
|
+
day,
|
|
255
|
+
dayAsString: getDateStringFromDay(day),
|
|
256
|
+
isPrevMonthDay: true,
|
|
257
|
+
isNextMonthDay: false,
|
|
258
|
+
isCurrMonthDay: false,
|
|
259
|
+
isHidden: false,
|
|
260
|
+
dayBtnRef: (0, import_react.createRef)()
|
|
261
|
+
}));
|
|
262
|
+
const nextMonthDaysToAppend2 = getFirstXDaysFromNextMonth(month, year, daysAfter).map((day) => ({
|
|
263
|
+
day,
|
|
264
|
+
dayAsString: getDateStringFromDay(day),
|
|
265
|
+
isPrevMonthDay: false,
|
|
266
|
+
isNextMonthDay: true,
|
|
267
|
+
isCurrMonthDay: false,
|
|
268
|
+
isHidden: false,
|
|
269
|
+
dayBtnRef: (0, import_react.createRef)()
|
|
270
|
+
}));
|
|
271
|
+
return [...previousMonthDaysToPrepend2, ...currentMonthDays, ...nextMonthDaysToAppend2];
|
|
244
272
|
};
|
|
245
273
|
//# sourceMappingURL=dateHelpers.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/dateHelpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { createRef } from 'react';\nimport { monthNames } from './constants.js';\nimport { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';\nimport { convertToPositiveNumberIfPossible } from './numberHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../propTypes.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes.js';\n\nexport const getDateValuesFromDate = (day: Date): DateValuesT => ({\n month: day?.getMonth?.() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: day?.getDate?.() as DSControlledDateTimePickerInternalsT.DateDay,\n year: day?.getFullYear?.(),\n});\nexport const getDateStringFromDay = (day: Date): string => {\n const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12\n const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);\n const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);\n\n return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;\n};\nexport const getTimeStringFromDay = (day: Date): string => {\n const hoursNum = day.getHours();\n const meridiem = hoursNum > 12 ? 'PM' : 'AM';\n const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;\n const minutesNum = day.getMinutes();\n\n const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);\n const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);\n\n return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;\n};\nexport const getMonthNameByMonthNumber = (monthNumber: number): string => monthNames[monthNumber];\nexport const isSameDateMoment = (dateA: Date, dateB: Date): boolean => dateA?.getTime?.() === dateB?.getTime?.();\n\nexport const compareTwoDatesDayEquality = (dayA: Date, dayB: Date): boolean => {\n const { day: currD, month: currM, year: currY } = getDateValuesFromDate(dayA);\n const { day: focusD, month: focusM, year: focusY } = getDateValuesFromDate(dayB);\n return currD === focusD && currM === focusM && currY === focusY;\n};\n\nexport const getLastDayOfMonth = (month: DSControlledDateTimePickerInternalsT.DateMonth, year: number): Date =>\n new Date(year, month + 1, 0);\nexport const isValidDayForTheMonth = (\n month: DSControlledDateTimePickerInternalsT.DateMonth,\n year: number,\n day: DSControlledDateTimePickerInternalsT.DateDay,\n): boolean => new Date(year, month, day)?.getMonth?.() === month;\nexport const getDayFromDateString = (dateString: string): Date | null => {\n const { month, day, year } = deconstructValuesFromDateString(dateString);\n const monthNum = convertToPositiveNumberIfPossible(month);\n const dayNum = convertToPositiveNumberIfPossible(day) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n const yearNum = convertToPositiveNumberIfPossible(year);\n if (\n monthNum !== -1 &&\n dayNum !== -1 &&\n yearNum !== -1 &&\n isValidDayForTheMonth((monthNum - 1) as DSControlledDateTimePickerInternalsT.DateMonth, yearNum, dayNum)\n )\n return new Date(yearNum, monthNum - 1, dayNum);\n return null;\n};\nexport const isValidDayForTheMonthDateString = (dateString: string): boolean => {\n if (isIncompleteString(dateString)) return true;\n const { month } = deconstructValuesFromDateString(dateString);\n const monthInt = convertToPositiveNumberIfPossible(month);\n if (monthInt === -1) return false;\n const monthDateMonth = (monthInt - 1) as DSControlledDateTimePickerInternalsT.DateMonth;\n return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;\n};\n\nexport const getValidationDateStringMetaInfo = (\n dateString: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsOutOfRangeDay = (day: string) => false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsDisabledDay = (day: string) => false,\n): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {};\n if (!isIncompleteString(dateString)) {\n metaInfo.isDayPresentInMonth = isValidDayForTheMonthDateString(dateString);\n if (!metaInfo.isDayPresentInMonth)\n metaInfo.suggestedErrorMsg = 'The selected day is not part of the selected month';\n const day = getDayFromDateString(dateString);\n if (day) {\n metaInfo.isOutOfRangeDay = getIsOutOfRangeDay(dateString);\n metaInfo.isDisabledDay = getIsDisabledDay(dateString);\n if (metaInfo.isOutOfRangeDay || metaInfo.isDisabledDay)\n metaInfo.suggestedErrorMsg = 'The selected day is not allowed';\n }\n }\n return metaInfo;\n};\n// code adapted from https://github.com/datejs/Datejs/blob/master/src/core.js\nexport const isLeapYear = (year: number): boolean => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\nexport const getHowManyDaysInMonth = (year: number, month: number): number => {\n const daysPerMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n return daysPerMonth[month];\n};\n\nexport const dateIsLeapYear = (date: Date): boolean => isLeapYear(date.getFullYear());\n\nexport const dateGetDaysInMonth = (date: Date): number => getHowManyDaysInMonth(date.getFullYear(), date.getMonth());\n\nexport const dateAddMonths = (date: Date, value: number): Date => {\n const copiedDate = new Date(date.getTime());\n const n = copiedDate.getDate();\n copiedDate.setDate(1);\n copiedDate.setMonth(copiedDate.getMonth() + value);\n copiedDate.setDate(Math.min(n, dateGetDaysInMonth(copiedDate)));\n return copiedDate;\n};\nexport const dateAddYear = (date: Date, value: number): Date => dateAddMonths(date, value * 12);\n\ninterface DateValuesT {\n month: DSControlledDateTimePickerInternalsT.DateMonth;\n year: number;\n day?: DSControlledDateTimePickerInternalsT.DateDay;\n}\ninterface DateSumValuesT {\n monthsToSum?: number;\n yearsToSum?: number;\n daysToSum?: number;\n}\n// sumFromDateValues supports negative values to \"subtract\"\nexport const sumFromDateValues = (\n { month, year, day = 1 }: DateValuesT,\n { monthsToSum = 0, yearsToSum = 0, daysToSum = 0 }: DateSumValuesT,\n): DateValuesT => {\n let newDate = new Date(year, month, day);\n if (yearsToSum) newDate = dateAddYear(newDate, yearsToSum);\n\n if (monthsToSum) newDate = dateAddMonths(newDate, monthsToSum);\n\n if (daysToSum) newDate.setDate(newDate.getDate() + daysToSum);\n\n return {\n month: newDate.getMonth() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: newDate.getDate() as DSControlledDateTimePickerInternalsT.DateDay,\n year: newDate.getFullYear(),\n };\n};\nexport const sumValuesToDate = (day: Date, sumValues: DateSumValuesT): Date => {\n const dateAsVals = getDateValuesFromDate(day);\n const { month, year, day: newD } = sumFromDateValues(dateAsVals, sumValues);\n return new Date(year, month, newD);\n};\nexport const subtractYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() - howManyMore);\n return newDate;\n};\nexport const subtractMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() - howManyMore);\n return newDate;\n};\nexport const sumMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() + howManyMore);\n return newDate;\n};\nexport const sumYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() + howManyMore);\n return newDate;\n};\n\nexport const getDaysInMonth = (month: number, year: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (date.getMonth() === month) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\nexport const getLastXDaysFromPreviousMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n date.setDate(date.getDate() - 1);\n days.push(new Date(date));\n }\n return days.reverse();\n};\nexport const getFirstXDaysFromNextMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = sumMonths(new Date(year, month, 1), 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\n\nexport const getFiveBySevenCurrentMonthDaysMatrix = (\n month: number,\n year: number,\n): DSControlledDateTimePickerInternalsT.MetaMonthDay[] => {\n const currentMonthDays = getDaysInMonth(month, year).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: false,\n isCurrMonthDay: true,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();\n const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(\n (day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }),\n );\n const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();\n const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n return [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA0B;AAC1B,uBAA2B;AAC3B,2BAAmG;AACnG,2BAAkD;AAI3C,MAAM,wBAAwB,CAAC,SAA4B;AAAA,EAChE,OAAO,KAAK,WAAW;AAAA,EACvB,KAAK,KAAK,UAAU;AAAA,EACpB,MAAM,KAAK,cAAc;AAC3B;AACO,MAAM,uBAAuB,CAAC,QAAsB;AACzD,QAAM,mBAAe,oDAA8B,GAAG,IAAI,SAAS,IAAI,KAAK,CAAC;AAC7E,QAAM,iBAAa,oDAA8B,GAAG,IAAI,QAAQ,KAAK,CAAC;AACtE,QAAM,kBAAc,oDAA8B,GAAG,IAAI,YAAY,KAAK,CAAC;AAE3E,SAAO,GAAG,gBAAgB,cAAc;AAC1C;AACO,MAAM,uBAAuB,CAAC,QAAsB;AACzD,QAAM,WAAW,IAAI,SAAS;AAC9B,QAAM,WAAW,WAAW,KAAK,OAAO;AACxC,QAAM,mBAAmB,WAAW,KAAK,WAAW,KAAK;AACzD,QAAM,aAAa,IAAI,WAAW;AAElC,QAAM,mBAAe,oDAA8B,GAAG,oBAAoB,CAAC;AAC3E,QAAM,qBAAiB,oDAA8B,GAAG,cAAc,CAAC;AAEvE,SAAO,GAAG,gBAAgB,kBAAkB;AAC9C;AACO,MAAM,4BAA4B,CAAC,gBAAgC,4BAAW,WAAW;AACzF,MAAM,mBAAmB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K,QAAQ,IAAI,CAAC;AAAA,EACjC;AACA,SAAO;AACT;AACO,MAAM,gCAAgC,CAAC,OAAe,MAAc,YAA4B;AACrG,QAAM,OAAO,IAAI,KAAK,MAAM,OAAO,CAAC;AACpC,QAAM,OAAe,CAAC;AACtB,SAAO,KAAK,WAAW,SAAS;AAC9B,SAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AAAA,EAC1B;AACA,SAAO,KAAK,QAAQ;AACtB;AACO,MAAM,6BAA6B,CAAC,OAAe,MAAc,YAA4B;AAClG,QAAM,OAAO,UAAU,IAAI,KAAK,MAAM,OAAO,CAAC,GAAG,CAAC;AAClD,QAAM,OAAe,CAAC;AACtB,SAAO,KAAK,WAAW,SAAS;AAC9B,SAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AACxB,SAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAAA,EACjC;AACA,SAAO;AACT;AAEO,MAAM,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { createRef } from 'react';\nimport { monthNames } from './constants.js';\nimport { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';\nimport { convertToPositiveNumberIfPossible } from './numberHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../propTypes.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes.js';\n\nexport const getDateValuesFromDate = (day: Date): DateValuesT => ({\n month: day?.getMonth?.() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: day?.getDate?.() as DSControlledDateTimePickerInternalsT.DateDay,\n year: day?.getFullYear?.(),\n});\nexport const getDateStringFromDay = (day: Date): string => {\n const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12\n const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);\n const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);\n\n return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;\n};\nexport const getTimeStringFromDay = (day: Date): string => {\n const hoursNum = day.getHours();\n const meridiem = hoursNum > 12 ? 'PM' : 'AM';\n const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;\n const minutesNum = day.getMinutes();\n\n const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);\n const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);\n\n return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;\n};\nexport const getMonthNameByMonthNumber = (monthNumber: number): string => monthNames[monthNumber];\nexport const isSameDateMoment = (dateA: Date, dateB: Date): boolean => dateA?.getTime?.() === dateB?.getTime?.();\n\nexport const compareTwoDatesDayEquality = (dayA: Date, dayB: Date): boolean => {\n const { day: currD, month: currM, year: currY } = getDateValuesFromDate(dayA);\n const { day: focusD, month: focusM, year: focusY } = getDateValuesFromDate(dayB);\n return currD === focusD && currM === focusM && currY === focusY;\n};\n\nexport const getLastDayOfMonth = (month: DSControlledDateTimePickerInternalsT.DateMonth, year: number): Date =>\n new Date(year, month + 1, 0);\nexport const isValidDayForTheMonth = (\n month: DSControlledDateTimePickerInternalsT.DateMonth,\n year: number,\n day: DSControlledDateTimePickerInternalsT.DateDay,\n): boolean => new Date(year, month, day)?.getMonth?.() === month;\nexport const getDayFromDateString = (dateString: string): Date | null => {\n const { month, day, year } = deconstructValuesFromDateString(dateString);\n const monthNum = convertToPositiveNumberIfPossible(month);\n const dayNum = convertToPositiveNumberIfPossible(day) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n const yearNum = convertToPositiveNumberIfPossible(year);\n if (\n monthNum !== -1 &&\n dayNum !== -1 &&\n yearNum !== -1 &&\n isValidDayForTheMonth((monthNum - 1) as DSControlledDateTimePickerInternalsT.DateMonth, yearNum, dayNum)\n )\n return new Date(yearNum, monthNum - 1, dayNum);\n return null;\n};\nexport const isValidDayForTheMonthDateString = (dateString: string): boolean => {\n if (isIncompleteString(dateString)) return true;\n const { month } = deconstructValuesFromDateString(dateString);\n const monthInt = convertToPositiveNumberIfPossible(month);\n if (monthInt === -1) return false;\n const monthDateMonth = (monthInt - 1) as DSControlledDateTimePickerInternalsT.DateMonth;\n return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;\n};\n\nexport const getValidationDateStringMetaInfo = (\n dateString: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsOutOfRangeDay = (day: string) => false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsDisabledDay = (day: string) => false,\n): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {};\n if (!isIncompleteString(dateString)) {\n metaInfo.isDayPresentInMonth = isValidDayForTheMonthDateString(dateString);\n if (!metaInfo.isDayPresentInMonth)\n metaInfo.suggestedErrorMsg = 'The selected day is not part of the selected month';\n const day = getDayFromDateString(dateString);\n if (day) {\n metaInfo.isOutOfRangeDay = getIsOutOfRangeDay(dateString);\n metaInfo.isDisabledDay = getIsDisabledDay(dateString);\n if (metaInfo.isOutOfRangeDay || metaInfo.isDisabledDay)\n metaInfo.suggestedErrorMsg = 'The selected day is not allowed';\n }\n }\n return metaInfo;\n};\n// code adapted from https://github.com/datejs/Datejs/blob/master/src/core.js\nexport const isLeapYear = (year: number): boolean => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\nexport const getHowManyDaysInMonth = (year: number, month: number): number => {\n const daysPerMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n return daysPerMonth[month];\n};\n\nexport const dateIsLeapYear = (date: Date): boolean => isLeapYear(date.getFullYear());\n\nexport const dateGetDaysInMonth = (date: Date): number => getHowManyDaysInMonth(date.getFullYear(), date.getMonth());\n\nexport const dateAddMonths = (date: Date, value: number): Date => {\n const copiedDate = new Date(date.getTime());\n const n = copiedDate.getDate();\n copiedDate.setDate(1);\n copiedDate.setMonth(copiedDate.getMonth() + value);\n copiedDate.setDate(Math.min(n, dateGetDaysInMonth(copiedDate)));\n return copiedDate;\n};\nexport const dateAddYear = (date: Date, value: number): Date => dateAddMonths(date, value * 12);\n\ninterface DateValuesT {\n month: DSControlledDateTimePickerInternalsT.DateMonth;\n year: number;\n day?: DSControlledDateTimePickerInternalsT.DateDay;\n}\ninterface DateSumValuesT {\n monthsToSum?: number;\n yearsToSum?: number;\n daysToSum?: number;\n}\n// sumFromDateValues supports negative values to \"subtract\"\nexport const sumFromDateValues = (\n { month, year, day = 1 }: DateValuesT,\n { monthsToSum = 0, yearsToSum = 0, daysToSum = 0 }: DateSumValuesT,\n): DateValuesT => {\n let newDate = new Date(year, month, day);\n if (yearsToSum) newDate = dateAddYear(newDate, yearsToSum);\n\n if (monthsToSum) newDate = dateAddMonths(newDate, monthsToSum);\n\n if (daysToSum) newDate.setDate(newDate.getDate() + daysToSum);\n\n return {\n month: newDate.getMonth() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: newDate.getDate() as DSControlledDateTimePickerInternalsT.DateDay,\n year: newDate.getFullYear(),\n };\n};\nexport const sumValuesToDate = (day: Date, sumValues: DateSumValuesT): Date => {\n const dateAsVals = getDateValuesFromDate(day);\n const { month, year, day: newD } = sumFromDateValues(dateAsVals, sumValues);\n return new Date(year, month, newD);\n};\nexport const subtractYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() - howManyMore);\n return newDate;\n};\nexport const subtractMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() - howManyMore);\n return newDate;\n};\nexport const sumMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() + howManyMore);\n return newDate;\n};\nexport const sumYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() + howManyMore);\n return newDate;\n};\n\nexport const getDaysInMonth = (month: number, year: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (date.getMonth() === month) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\nexport const getLastXDaysFromPreviousMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n date.setDate(date.getDate() - 1);\n days.push(new Date(date));\n }\n return days.reverse();\n};\nexport const getFirstXDaysFromNextMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = sumMonths(new Date(year, month, 1), 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\n\nexport const getSixBySevenCurrentMonthDaysMatrix = (\n month: number,\n year: number,\n): DSControlledDateTimePickerInternalsT.MetaMonthDay[] => {\n const currentMonthDays = getDaysInMonth(month, year).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: false,\n isCurrMonthDay: true,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();\n const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(\n (day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }),\n );\n const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();\n const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n const allDays = [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];\n\n // we want to be sure that we have 6 rows and 7 columns always (worst case scenario - this ensure no jump of popperjs when changing months)\n const is6by7 = allDays.length === 42;\n if (is6by7) return allDays;\n\n // by default we prepend an extra week of previous month days\n const daysBefore = 7 + firstDayOfTheMonthWeekDay;\n // and we append just enough days to fill the 6th row of the current month\n let daysAfter = 6 - lastDayOfTheMonthWeekDay;\n // in some extreme cases we might have 4 rows and 7 columns (e.g. February 2026)\n // we can check it by checking that previousMonthDaysToPrepend length is 0 + currentMonthDays length is 28 + nextMonthDaysToAppend length is 0\n const is4by7 =\n previousMonthDaysToPrepend.length === 0 && currentMonthDays.length === 28 && nextMonthDaysToAppend.length === 0;\n if (is4by7) {\n // in this case we append an extra week of next month days\n daysAfter = 7;\n }\n\n // we add a \"previous month\" rows at the start of the array to make sure we have 6 rows\n const previousMonthDaysToPrepend2 = getLastXDaysFromPreviousMonth(month, year, daysBefore).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const nextMonthDaysToAppend2 = getFirstXDaysFromNextMonth(month, year, daysAfter).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n return [...previousMonthDaysToPrepend2, ...currentMonthDays, ...nextMonthDaysToAppend2];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAChB,UAAU;AAAA,IACV,eAAW,wBAA6B;AAAA,EAC1C,EAAE;AAEF,QAAM,UAAU,CAAC,GAAG,4BAA4B,GAAG,kBAAkB,GAAG,qBAAqB;AAG7F,QAAM,SAAS,QAAQ,WAAW;AAClC,MAAI;AAAQ,WAAO;AAGnB,QAAM,aAAa,IAAI;AAEvB,MAAI,YAAY,IAAI;AAGpB,QAAM,SACJ,2BAA2B,WAAW,KAAK,iBAAiB,WAAW,MAAM,sBAAsB,WAAW;AAChH,MAAI,QAAQ;AAEV,gBAAY;AAAA,EACd;AAGA,QAAM,8BAA8B,8BAA8B,OAAO,MAAM,UAAU,EAAE,IAAI,CAAC,SAAS;AAAA,IACvG;AAAA,IACA,aAAa,qBAAqB,GAAG;AAAA,IACrC,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,eAAW,wBAA6B;AAAA,EAC1C,EAAE;AACF,QAAM,yBAAyB,2BAA2B,OAAO,MAAM,SAAS,EAAE,IAAI,CAAC,SAAS;AAAA,IAC9F;AAAA,IACA,aAAa,qBAAqB,GAAG;AAAA,IACrC,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,eAAW,wBAA6B;AAAA,EAC1C,EAAE;AAEF,SAAO,CAAC,GAAG,6BAA6B,GAAG,kBAAkB,GAAG,sBAAsB;AACxF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,6 +13,8 @@ const CalendarWrapper = () => {
|
|
|
13
13
|
const { referenceElement, closeCalendar } = useContext(CalendarContext);
|
|
14
14
|
if (isControllerOnly)
|
|
15
15
|
return /* @__PURE__ */ jsx(CalendarContent, {});
|
|
16
|
+
if (!referenceElement)
|
|
17
|
+
return null;
|
|
16
18
|
return /* @__PURE__ */ jsx(
|
|
17
19
|
StyledPopper,
|
|
18
20
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarWrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarContent } from './CalendarContent.js';\nimport { CalendarContext } from './CalendarContext.js';\nimport { styled } from '@elliemae/ds-system';\n\nconst StyledPopper = styled(DSPopperJS)``;\n\nexport const CalendarWrapper = (): JSX.Element => {\n const { isControllerOnly, getProps } = useContext(ControlledDateTimePickerContext);\n const { referenceElement, closeCalendar } = useContext(CalendarContext);\n if (isControllerOnly) return <CalendarContent />;\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarContent } from './CalendarContent.js';\nimport { CalendarContext } from './CalendarContext.js';\nimport { styled } from '@elliemae/ds-system';\n\nconst StyledPopper = styled(DSPopperJS)``;\n\nexport const CalendarWrapper = (): JSX.Element | null => {\n const { isControllerOnly, getProps } = useContext(ControlledDateTimePickerContext);\n const { referenceElement, closeCalendar } = useContext(CalendarContext);\n\n if (isControllerOnly) return <CalendarContent />;\n if (!referenceElement) return null;\n return (\n <StyledPopper\n showPopover\n data-testid={ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.CALENDAR}\n referenceElement={referenceElement}\n withoutArrow\n onClickOutside={closeCalendar}\n getOwnerProps={getProps}\n >\n <CalendarContent />\n </StyledPopper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACcQ;AAd/B,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,0CAA0C;AACnD,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,cAAc;AAEvB,MAAM,eAAe,OAAO,UAAU;AAE/B,MAAM,kBAAkB,MAA0B;AACvD,QAAM,EAAE,kBAAkB,SAAS,IAAI,WAAW,+BAA+B;AACjF,QAAM,EAAE,kBAAkB,cAAc,IAAI,WAAW,eAAe;AAEtE,MAAI;AAAkB,WAAO,oBAAC,mBAAgB;AAC9C,MAAI,CAAC;AAAkB,WAAO;AAC9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAW;AAAA,MACX,eAAa,mCAAmC,gBAAgB;AAAA,MAChE;AAAA,MACA,cAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,eAAe;AAAA,MAEf,8BAAC,mBAAgB;AAAA;AAAA,EACnB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { useMemo, useCallback, useState, useEffect, createRef } from "react";
|
|
3
3
|
import { useGetMonthYearFromDateStringOrEmptyStartingMonth } from "../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
getSixBySevenCurrentMonthDaysMatrix,
|
|
6
6
|
sumFromDateValues,
|
|
7
7
|
sumValuesToDate,
|
|
8
8
|
getDateStringFromDay
|
|
@@ -26,7 +26,7 @@ const useCurrentDisplayedMonthYearLogic = () => {
|
|
|
26
26
|
setCurrentYear(yearFromDateString);
|
|
27
27
|
}, [yearFromDateString]);
|
|
28
28
|
const daysArray = useMemo(() => {
|
|
29
|
-
const newDaysArray =
|
|
29
|
+
const newDaysArray = getSixBySevenCurrentMonthDaysMatrix(currentMonth, currentYear);
|
|
30
30
|
const hiddenPrevDay = sumValuesToDate(newDaysArray[0].day, {
|
|
31
31
|
daysToSum: -1
|
|
32
32
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState, useEffect, createRef } from 'react';\n// eslint-disable-next-line max-len\nimport { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';\nimport {\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,SAAS,aAAa,UAAU,WAAW,iBAAiB;AAErE,SAAS,yDAAyD;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,gBAAyB,KAAe,WAAoC;AACnF,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,WAAW;AAC9C,UAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,SAAS;AACxC,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;AAaO,MAAM,oCAAoC,MAA0C;AACzF,QAAM,EAAE,OAAO,qBAAqB,MAAM,mBAAmB,IAAI,kDAAkD;AACnH,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,mBAAmB;AACpE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,kBAAkB;AAIjE,YAAU,MAAM;AACd,oBAAgB,mBAAmB;AAAA,EACrC,GAAG,CAAC,mBAAmB,CAAC;AACxB,YAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,QAAM,YAAY,QAAQ,MAAM;AAC9B,UAAM,eAAe,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo, useCallback, useState, useEffect, createRef } from 'react';\n// eslint-disable-next-line max-len\nimport { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';\nimport {\n getSixBySevenCurrentMonthDaysMatrix,\n sumFromDateValues,\n sumValuesToDate,\n getDateStringFromDay,\n} from '../../../utils/dateHelpers.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction sliceIntoChunks<T = any>(arr: Array<T>, chunkSize: number): Array<Array<T>> {\n const res = [];\n for (let i = 0; i < arr.length; i += chunkSize) {\n const chunk = arr.slice(i, i + chunkSize);\n res.push(chunk);\n }\n return res;\n}\ninterface UseCurrentDisplayedMonthYearLogicT {\n currentMonth: DSControlledDateTimePickerInternalsT.DateMonth;\n currentYear: number;\n daysArray: DSControlledDateTimePickerInternalsT.MetaMonthDay[];\n invisibleFirstDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n daysMatrixByWeekday: DSControlledDateTimePickerInternalsT.MetaMonthDay[][];\n invisibleLastDay?: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n handlePrevMonth: () => void;\n handlePrevYear: () => void;\n handleNextMonth: () => void;\n handleNextYear: () => void;\n}\nexport const useCurrentDisplayedMonthYearLogic = (): UseCurrentDisplayedMonthYearLogicT => {\n const { month: monthFromDateString, year: yearFromDateString } = useGetMonthYearFromDateStringOrEmptyStartingMonth();\n const [currentMonth, setCurrentMonth] = useState(monthFromDateString);\n const [currentYear, setCurrentYear] = useState(yearFromDateString);\n\n // side-effects are really really controlled in this case so use-effect should be fine\n // don't add 200 side-effects to those or else Chaos would hunt us for the years to come\n useEffect(() => {\n setCurrentMonth(monthFromDateString);\n }, [monthFromDateString]);\n useEffect(() => {\n setCurrentYear(yearFromDateString);\n }, [yearFromDateString]);\n\n const daysArray = useMemo(() => {\n const newDaysArray = getSixBySevenCurrentMonthDaysMatrix(currentMonth, currentYear);\n const hiddenPrevDay = sumValuesToDate(newDaysArray[0].day, {\n daysToSum: -1,\n });\n const hiddenPrevMetaday = {\n day: hiddenPrevDay,\n dayAsString: getDateStringFromDay(hiddenPrevDay),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n const hiddenNextDay = sumValuesToDate(newDaysArray[newDaysArray.length - 1].day, {\n daysToSum: 1,\n });\n const hiddenNextMetaday = {\n day: hiddenNextDay,\n dayAsString: getDateStringFromDay(hiddenNextDay),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n isHidden: true,\n };\n return [hiddenPrevMetaday, ...newDaysArray, hiddenNextMetaday];\n }, [currentMonth, currentYear]);\n\n const handlePrevYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: -1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handlePrevMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: -1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextMonth = useCallback(() => {\n const { month: newMonth, year: newYear } = sumFromDateValues(\n { month: currentMonth, year: currentYear },\n { monthsToSum: 1 },\n );\n setCurrentMonth(newMonth);\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const handleNextYear = useCallback(() => {\n const { year: newYear } = sumFromDateValues({ month: currentMonth, year: currentYear }, { yearsToSum: 1 });\n setCurrentYear(newYear);\n }, [currentMonth, currentYear]);\n\n const { invisibleFirstDay, daysMatrixByWeekday, invisibleLastDay } = useMemo(() => {\n const [invisible1stDay, ...otherDays] = [...daysArray];\n const invisibleDayLast = otherDays.pop();\n return {\n invisibleFirstDay: invisible1stDay,\n daysMatrixByWeekday: sliceIntoChunks<DSControlledDateTimePickerInternalsT.MetaMonthDay>(otherDays, 7),\n invisibleLastDay: invisibleDayLast,\n };\n }, [daysArray]);\n\n return useMemo(\n () => ({\n currentMonth,\n currentYear,\n daysArray,\n invisibleFirstDay,\n daysMatrixByWeekday,\n invisibleLastDay,\n handlePrevYear,\n handlePrevMonth,\n handleNextMonth,\n handleNextYear,\n }),\n [\n currentMonth,\n currentYear,\n daysArray,\n daysMatrixByWeekday,\n handleNextMonth,\n handleNextYear,\n handlePrevMonth,\n handlePrevYear,\n invisibleFirstDay,\n invisibleLastDay,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,SAAS,aAAa,UAAU,WAAW,iBAAiB;AAErE,SAAS,yDAAyD;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,gBAAyB,KAAe,WAAoC;AACnF,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,WAAW;AAC9C,UAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,SAAS;AACxC,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;AAaO,MAAM,oCAAoC,MAA0C;AACzF,QAAM,EAAE,OAAO,qBAAqB,MAAM,mBAAmB,IAAI,kDAAkD;AACnH,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,mBAAmB;AACpE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,kBAAkB;AAIjE,YAAU,MAAM;AACd,oBAAgB,mBAAmB;AAAA,E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,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,WAAW,CAAC;AAE9B,QAAM,kBAAkB,YAAY,MAAM;AACxC,UAAM,EAAE,OAAO,UAAU,MAAM,QAAQ,IAAI;AAAA,MACzC,EAAE,OAAO,cAAc,MAAM,YAAY;AAAA,MACzC,EAAE,aAAa,EAAE;AAAA,IACnB;AACA,oBAAgB,QAAQ;AACxB,mBAAe,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,WAAW,CAAC;AAE9B,QAAM,iBAAiB,YAAY,MAAM;AACvC,UAAM,EAAE,MAAM,QAAQ,IAAI,kBAAkB,EAAE,OAAO,cAAc,MAAM,YAAY,GAAG,EAAE,YAAY,EAAE,CAAC;AACzG,mBAAe,OAAO;AAAA,EACxB,GAAG,CAAC,cAAc,WAAW,CAAC;AAE9B,QAAM,EAAE,mBAAmB,qBAAqB,iBAAiB,IAAI,QAAQ,MAAM;AACjF,UAAM,CAAC,iBAAiB,GAAG,SAAS,IAAI,CAAC,GAAG,SAAS;AACrD,UAAM,mBAAmB,UAAU,IAAI;AACvC,WAAO;AAAA,MACL,mBAAmB;AAAA,MACnB,qBAAqB,gBAAmE,WAAW,CAAC;AAAA,MACpG,kBAAkB;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -149,7 +149,7 @@ const getFirstXDaysFromNextMonth = (month, year, howMany) => {
|
|
|
149
149
|
}
|
|
150
150
|
return days;
|
|
151
151
|
};
|
|
152
|
-
const
|
|
152
|
+
const getSixBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
153
153
|
const currentMonthDays = getDaysInMonth(month, year).map((day) => ({
|
|
154
154
|
day,
|
|
155
155
|
dayAsString: getDateStringFromDay(day),
|
|
@@ -181,7 +181,35 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
|
|
|
181
181
|
isHidden: false,
|
|
182
182
|
dayBtnRef: createRef()
|
|
183
183
|
}));
|
|
184
|
-
|
|
184
|
+
const allDays = [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];
|
|
185
|
+
const is6by7 = allDays.length === 42;
|
|
186
|
+
if (is6by7)
|
|
187
|
+
return allDays;
|
|
188
|
+
const daysBefore = 7 + firstDayOfTheMonthWeekDay;
|
|
189
|
+
let daysAfter = 6 - lastDayOfTheMonthWeekDay;
|
|
190
|
+
const is4by7 = previousMonthDaysToPrepend.length === 0 && currentMonthDays.length === 28 && nextMonthDaysToAppend.length === 0;
|
|
191
|
+
if (is4by7) {
|
|
192
|
+
daysAfter = 7;
|
|
193
|
+
}
|
|
194
|
+
const previousMonthDaysToPrepend2 = getLastXDaysFromPreviousMonth(month, year, daysBefore).map((day) => ({
|
|
195
|
+
day,
|
|
196
|
+
dayAsString: getDateStringFromDay(day),
|
|
197
|
+
isPrevMonthDay: true,
|
|
198
|
+
isNextMonthDay: false,
|
|
199
|
+
isCurrMonthDay: false,
|
|
200
|
+
isHidden: false,
|
|
201
|
+
dayBtnRef: createRef()
|
|
202
|
+
}));
|
|
203
|
+
const nextMonthDaysToAppend2 = getFirstXDaysFromNextMonth(month, year, daysAfter).map((day) => ({
|
|
204
|
+
day,
|
|
205
|
+
dayAsString: getDateStringFromDay(day),
|
|
206
|
+
isPrevMonthDay: false,
|
|
207
|
+
isNextMonthDay: true,
|
|
208
|
+
isCurrMonthDay: false,
|
|
209
|
+
isHidden: false,
|
|
210
|
+
dayBtnRef: createRef()
|
|
211
|
+
}));
|
|
212
|
+
return [...previousMonthDaysToPrepend2, ...currentMonthDays, ...nextMonthDaysToAppend2];
|
|
185
213
|
};
|
|
186
214
|
export {
|
|
187
215
|
compareTwoDatesDayEquality,
|
|
@@ -194,11 +222,11 @@ export {
|
|
|
194
222
|
getDayFromDateString,
|
|
195
223
|
getDaysInMonth,
|
|
196
224
|
getFirstXDaysFromNextMonth,
|
|
197
|
-
getFiveBySevenCurrentMonthDaysMatrix,
|
|
198
225
|
getHowManyDaysInMonth,
|
|
199
226
|
getLastDayOfMonth,
|
|
200
227
|
getLastXDaysFromPreviousMonth,
|
|
201
228
|
getMonthNameByMonthNumber,
|
|
229
|
+
getSixBySevenCurrentMonthDaysMatrix,
|
|
202
230
|
getTimeStringFromDay,
|
|
203
231
|
getValidationDateStringMetaInfo,
|
|
204
232
|
isLeapYear,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/dateHelpers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { createRef } from 'react';\nimport { monthNames } from './constants.js';\nimport { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';\nimport { convertToPositiveNumberIfPossible } from './numberHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../propTypes.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes.js';\n\nexport const getDateValuesFromDate = (day: Date): DateValuesT => ({\n month: day?.getMonth?.() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: day?.getDate?.() as DSControlledDateTimePickerInternalsT.DateDay,\n year: day?.getFullYear?.(),\n});\nexport const getDateStringFromDay = (day: Date): string => {\n const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12\n const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);\n const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);\n\n return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;\n};\nexport const getTimeStringFromDay = (day: Date): string => {\n const hoursNum = day.getHours();\n const meridiem = hoursNum > 12 ? 'PM' : 'AM';\n const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;\n const minutesNum = day.getMinutes();\n\n const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);\n const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);\n\n return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;\n};\nexport const getMonthNameByMonthNumber = (monthNumber: number): string => monthNames[monthNumber];\nexport const isSameDateMoment = (dateA: Date, dateB: Date): boolean => dateA?.getTime?.() === dateB?.getTime?.();\n\nexport const compareTwoDatesDayEquality = (dayA: Date, dayB: Date): boolean => {\n const { day: currD, month: currM, year: currY } = getDateValuesFromDate(dayA);\n const { day: focusD, month: focusM, year: focusY } = getDateValuesFromDate(dayB);\n return currD === focusD && currM === focusM && currY === focusY;\n};\n\nexport const getLastDayOfMonth = (month: DSControlledDateTimePickerInternalsT.DateMonth, year: number): Date =>\n new Date(year, month + 1, 0);\nexport const isValidDayForTheMonth = (\n month: DSControlledDateTimePickerInternalsT.DateMonth,\n year: number,\n day: DSControlledDateTimePickerInternalsT.DateDay,\n): boolean => new Date(year, month, day)?.getMonth?.() === month;\nexport const getDayFromDateString = (dateString: string): Date | null => {\n const { month, day, year } = deconstructValuesFromDateString(dateString);\n const monthNum = convertToPositiveNumberIfPossible(month);\n const dayNum = convertToPositiveNumberIfPossible(day) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n const yearNum = convertToPositiveNumberIfPossible(year);\n if (\n monthNum !== -1 &&\n dayNum !== -1 &&\n yearNum !== -1 &&\n isValidDayForTheMonth((monthNum - 1) as DSControlledDateTimePickerInternalsT.DateMonth, yearNum, dayNum)\n )\n return new Date(yearNum, monthNum - 1, dayNum);\n return null;\n};\nexport const isValidDayForTheMonthDateString = (dateString: string): boolean => {\n if (isIncompleteString(dateString)) return true;\n const { month } = deconstructValuesFromDateString(dateString);\n const monthInt = convertToPositiveNumberIfPossible(month);\n if (monthInt === -1) return false;\n const monthDateMonth = (monthInt - 1) as DSControlledDateTimePickerInternalsT.DateMonth;\n return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;\n};\n\nexport const getValidationDateStringMetaInfo = (\n dateString: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsOutOfRangeDay = (day: string) => false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsDisabledDay = (day: string) => false,\n): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {};\n if (!isIncompleteString(dateString)) {\n metaInfo.isDayPresentInMonth = isValidDayForTheMonthDateString(dateString);\n if (!metaInfo.isDayPresentInMonth)\n metaInfo.suggestedErrorMsg = 'The selected day is not part of the selected month';\n const day = getDayFromDateString(dateString);\n if (day) {\n metaInfo.isOutOfRangeDay = getIsOutOfRangeDay(dateString);\n metaInfo.isDisabledDay = getIsDisabledDay(dateString);\n if (metaInfo.isOutOfRangeDay || metaInfo.isDisabledDay)\n metaInfo.suggestedErrorMsg = 'The selected day is not allowed';\n }\n }\n return metaInfo;\n};\n// code adapted from https://github.com/datejs/Datejs/blob/master/src/core.js\nexport const isLeapYear = (year: number): boolean => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\nexport const getHowManyDaysInMonth = (year: number, month: number): number => {\n const daysPerMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n return daysPerMonth[month];\n};\n\nexport const dateIsLeapYear = (date: Date): boolean => isLeapYear(date.getFullYear());\n\nexport const dateGetDaysInMonth = (date: Date): number => getHowManyDaysInMonth(date.getFullYear(), date.getMonth());\n\nexport const dateAddMonths = (date: Date, value: number): Date => {\n const copiedDate = new Date(date.getTime());\n const n = copiedDate.getDate();\n copiedDate.setDate(1);\n copiedDate.setMonth(copiedDate.getMonth() + value);\n copiedDate.setDate(Math.min(n, dateGetDaysInMonth(copiedDate)));\n return copiedDate;\n};\nexport const dateAddYear = (date: Date, value: number): Date => dateAddMonths(date, value * 12);\n\ninterface DateValuesT {\n month: DSControlledDateTimePickerInternalsT.DateMonth;\n year: number;\n day?: DSControlledDateTimePickerInternalsT.DateDay;\n}\ninterface DateSumValuesT {\n monthsToSum?: number;\n yearsToSum?: number;\n daysToSum?: number;\n}\n// sumFromDateValues supports negative values to \"subtract\"\nexport const sumFromDateValues = (\n { month, year, day = 1 }: DateValuesT,\n { monthsToSum = 0, yearsToSum = 0, daysToSum = 0 }: DateSumValuesT,\n): DateValuesT => {\n let newDate = new Date(year, month, day);\n if (yearsToSum) newDate = dateAddYear(newDate, yearsToSum);\n\n if (monthsToSum) newDate = dateAddMonths(newDate, monthsToSum);\n\n if (daysToSum) newDate.setDate(newDate.getDate() + daysToSum);\n\n return {\n month: newDate.getMonth() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: newDate.getDate() as DSControlledDateTimePickerInternalsT.DateDay,\n year: newDate.getFullYear(),\n };\n};\nexport const sumValuesToDate = (day: Date, sumValues: DateSumValuesT): Date => {\n const dateAsVals = getDateValuesFromDate(day);\n const { month, year, day: newD } = sumFromDateValues(dateAsVals, sumValues);\n return new Date(year, month, newD);\n};\nexport const subtractYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() - howManyMore);\n return newDate;\n};\nexport const subtractMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() - howManyMore);\n return newDate;\n};\nexport const sumMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() + howManyMore);\n return newDate;\n};\nexport const sumYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() + howManyMore);\n return newDate;\n};\n\nexport const getDaysInMonth = (month: number, year: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (date.getMonth() === month) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\nexport const getLastXDaysFromPreviousMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n date.setDate(date.getDate() - 1);\n days.push(new Date(date));\n }\n return days.reverse();\n};\nexport const getFirstXDaysFromNextMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = sumMonths(new Date(year, month, 1), 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\n\nexport const getFiveBySevenCurrentMonthDaysMatrix = (\n month: number,\n year: number,\n): DSControlledDateTimePickerInternalsT.MetaMonthDay[] => {\n const currentMonthDays = getDaysInMonth(month, year).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: false,\n isCurrMonthDay: true,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();\n const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(\n (day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }),\n );\n const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();\n const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n return [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B,iCAAiC,0BAA0B;AACnG,SAAS,yCAAyC;AAI3C,MAAM,wBAAwB,CAAC,SAA4B;AAAA,EAChE,OAAO,KAAK,WAAW;AAAA,EACvB,KAAK,KAAK,UAAU;AAAA,EACpB,MAAM,KAAK,cAAc;AAC3B;AACO,MAAM,uBAAuB,CAAC,QAAsB;AACzD,QAAM,eAAe,8BAA8B,GAAG,IAAI,SAAS,IAAI,KAAK,CAAC;AAC7E,QAAM,aAAa,8BAA8B,GAAG,IAAI,QAAQ,KAAK,CAAC;AACtE,QAAM,cAAc,8BAA8B,GAAG,IAAI,YAAY,KAAK,CAAC;AAE3E,SAAO,GAAG,gBAAgB,cAAc;AAC1C;AACO,MAAM,uBAAuB,CAAC,QAAsB;AACzD,QAAM,WAAW,IAAI,SAAS;AAC9B,QAAM,WAAW,WAAW,KAAK,OAAO;AACxC,QAAM,mBAAmB,WAAW,KAAK,WAAW,KAAK;AACzD,QAAM,aAAa,IAAI,WAAW;AAElC,QAAM,eAAe,8BAA8B,GAAG,oBAAoB,CAAC;AAC3E,QAAM,iBAAiB,8BAA8B,GAAG,cAAc,CAAC;AAEvE,SAAO,GAAG,gBAAgB,kBAAkB;AAC9C;AACO,MAAM,4BAA4B,CAAC,gBAAgC,WAAW,WAAW;AACzF,MAAM,mBAAmB,CAAC,OAAa,UAAyB,OAAO,UAAU,MAAM,OAAO,UAAU;AAExG,MAAM,6BAA6B,CAAC,MAAY,SAAwB;AAC7E,QAAM,EAAE,KAAK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AI,KAAK,MAAM,OAAO,CAAC;AACpC,QAAM,OAAe,CAAC;AACtB,SAAO,KAAK,WAAW,SAAS;AAC9B,SAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AAAA,EAC1B;AACA,SAAO,KAAK,QAAQ;AACtB;AACO,MAAM,6BAA6B,CAAC,OAAe,MAAc,YAA4B;AAClG,QAAM,OAAO,UAAU,IAAI,KAAK,MAAM,OAAO,CAAC,GAAG,CAAC;AAClD,QAAM,OAAe,CAAC;AACtB,SAAO,KAAK,WAAW,SAAS;AAC9B,SAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AACxB,SAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAAA,EACjC;AACA,SAAO;AACT;AAEO,MAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { createRef } from 'react';\nimport { monthNames } from './constants.js';\nimport { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';\nimport { convertToPositiveNumberIfPossible } from './numberHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../propTypes.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes.js';\n\nexport const getDateValuesFromDate = (day: Date): DateValuesT => ({\n month: day?.getMonth?.() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: day?.getDate?.() as DSControlledDateTimePickerInternalsT.DateDay,\n year: day?.getFullYear?.(),\n});\nexport const getDateStringFromDay = (day: Date): string => {\n const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12\n const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);\n const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);\n\n return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;\n};\nexport const getTimeStringFromDay = (day: Date): string => {\n const hoursNum = day.getHours();\n const meridiem = hoursNum > 12 ? 'PM' : 'AM';\n const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;\n const minutesNum = day.getMinutes();\n\n const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);\n const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);\n\n return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;\n};\nexport const getMonthNameByMonthNumber = (monthNumber: number): string => monthNames[monthNumber];\nexport const isSameDateMoment = (dateA: Date, dateB: Date): boolean => dateA?.getTime?.() === dateB?.getTime?.();\n\nexport const compareTwoDatesDayEquality = (dayA: Date, dayB: Date): boolean => {\n const { day: currD, month: currM, year: currY } = getDateValuesFromDate(dayA);\n const { day: focusD, month: focusM, year: focusY } = getDateValuesFromDate(dayB);\n return currD === focusD && currM === focusM && currY === focusY;\n};\n\nexport const getLastDayOfMonth = (month: DSControlledDateTimePickerInternalsT.DateMonth, year: number): Date =>\n new Date(year, month + 1, 0);\nexport const isValidDayForTheMonth = (\n month: DSControlledDateTimePickerInternalsT.DateMonth,\n year: number,\n day: DSControlledDateTimePickerInternalsT.DateDay,\n): boolean => new Date(year, month, day)?.getMonth?.() === month;\nexport const getDayFromDateString = (dateString: string): Date | null => {\n const { month, day, year } = deconstructValuesFromDateString(dateString);\n const monthNum = convertToPositiveNumberIfPossible(month);\n const dayNum = convertToPositiveNumberIfPossible(day) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n const yearNum = convertToPositiveNumberIfPossible(year);\n if (\n monthNum !== -1 &&\n dayNum !== -1 &&\n yearNum !== -1 &&\n isValidDayForTheMonth((monthNum - 1) as DSControlledDateTimePickerInternalsT.DateMonth, yearNum, dayNum)\n )\n return new Date(yearNum, monthNum - 1, dayNum);\n return null;\n};\nexport const isValidDayForTheMonthDateString = (dateString: string): boolean => {\n if (isIncompleteString(dateString)) return true;\n const { month } = deconstructValuesFromDateString(dateString);\n const monthInt = convertToPositiveNumberIfPossible(month);\n if (monthInt === -1) return false;\n const monthDateMonth = (monthInt - 1) as DSControlledDateTimePickerInternalsT.DateMonth;\n return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;\n};\n\nexport const getValidationDateStringMetaInfo = (\n dateString: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsOutOfRangeDay = (day: string) => false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsDisabledDay = (day: string) => false,\n): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {};\n if (!isIncompleteString(dateString)) {\n metaInfo.isDayPresentInMonth = isValidDayForTheMonthDateString(dateString);\n if (!metaInfo.isDayPresentInMonth)\n metaInfo.suggestedErrorMsg = 'The selected day is not part of the selected month';\n const day = getDayFromDateString(dateString);\n if (day) {\n metaInfo.isOutOfRangeDay = getIsOutOfRangeDay(dateString);\n metaInfo.isDisabledDay = getIsDisabledDay(dateString);\n if (metaInfo.isOutOfRangeDay || metaInfo.isDisabledDay)\n metaInfo.suggestedErrorMsg = 'The selected day is not allowed';\n }\n }\n return metaInfo;\n};\n// code adapted from https://github.com/datejs/Datejs/blob/master/src/core.js\nexport const isLeapYear = (year: number): boolean => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\nexport const getHowManyDaysInMonth = (year: number, month: number): number => {\n const daysPerMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n return daysPerMonth[month];\n};\n\nexport const dateIsLeapYear = (date: Date): boolean => isLeapYear(date.getFullYear());\n\nexport const dateGetDaysInMonth = (date: Date): number => getHowManyDaysInMonth(date.getFullYear(), date.getMonth());\n\nexport const dateAddMonths = (date: Date, value: number): Date => {\n const copiedDate = new Date(date.getTime());\n const n = copiedDate.getDate();\n copiedDate.setDate(1);\n copiedDate.setMonth(copiedDate.getMonth() + value);\n copiedDate.setDate(Math.min(n, dateGetDaysInMonth(copiedDate)));\n return copiedDate;\n};\nexport const dateAddYear = (date: Date, value: number): Date => dateAddMonths(date, value * 12);\n\ninterface DateValuesT {\n month: DSControlledDateTimePickerInternalsT.DateMonth;\n year: number;\n day?: DSControlledDateTimePickerInternalsT.DateDay;\n}\ninterface DateSumValuesT {\n monthsToSum?: number;\n yearsToSum?: number;\n daysToSum?: number;\n}\n// sumFromDateValues supports negative values to \"subtract\"\nexport const sumFromDateValues = (\n { month, year, day = 1 }: DateValuesT,\n { monthsToSum = 0, yearsToSum = 0, daysToSum = 0 }: DateSumValuesT,\n): DateValuesT => {\n let newDate = new Date(year, month, day);\n if (yearsToSum) newDate = dateAddYear(newDate, yearsToSum);\n\n if (monthsToSum) newDate = dateAddMonths(newDate, monthsToSum);\n\n if (daysToSum) newDate.setDate(newDate.getDate() + daysToSum);\n\n return {\n month: newDate.getMonth() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: newDate.getDate() as DSControlledDateTimePickerInternalsT.DateDay,\n year: newDate.getFullYear(),\n };\n};\nexport const sumValuesToDate = (day: Date, sumValues: DateSumValuesT): Date => {\n const dateAsVals = getDateValuesFromDate(day);\n const { month, year, day: newD } = sumFromDateValues(dateAsVals, sumValues);\n return new Date(year, month, newD);\n};\nexport const subtractYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() - howManyMore);\n return newDate;\n};\nexport const subtractMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() - howManyMore);\n return newDate;\n};\nexport const sumMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() + howManyMore);\n return newDate;\n};\nexport const sumYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() + howManyMore);\n return newDate;\n};\n\nexport const getDaysInMonth = (month: number, year: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (date.getMonth() === month) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\nexport const getLastXDaysFromPreviousMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n date.setDate(date.getDate() - 1);\n days.push(new Date(date));\n }\n return days.reverse();\n};\nexport const getFirstXDaysFromNextMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = sumMonths(new Date(year, month, 1), 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\n\nexport const getSixBySevenCurrentMonthDaysMatrix = (\n month: number,\n year: number,\n): DSControlledDateTimePickerInternalsT.MetaMonthDay[] => {\n const currentMonthDays = getDaysInMonth(month, year).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: false,\n isCurrMonthDay: true,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();\n const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(\n (day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }),\n );\n const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();\n const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n const allDays = [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];\n\n // we want to be sure that we have 6 rows and 7 columns always (worst case scenario - this ensure no jump of popperjs when changing months)\n const is6by7 = allDays.length === 42;\n if (is6by7) return allDays;\n\n // by default we prepend an extra week of previous month days\n const daysBefore = 7 + firstDayOfTheMonthWeekDay;\n // and we append just enough days to fill the 6th row of the current month\n let daysAfter = 6 - lastDayOfTheMonthWeekDay;\n // in some extreme cases we might have 4 rows and 7 columns (e.g. February 2026)\n // we can check it by checking that previousMonthDaysToPrepend length is 0 + currentMonthDays length is 28 + nextMonthDaysToAppend length is 0\n const is4by7 =\n previousMonthDaysToPrepend.length === 0 && currentMonthDays.length === 28 && nextMonthDaysToAppend.length === 0;\n if (is4by7) {\n // in this case we append an extra week of next month days\n daysAfter = 7;\n }\n\n // we add a \"previous month\" rows at the start of the array to make sure we have 6 rows\n const previousMonthDaysToPrepend2 = getLastXDaysFromPreviousMonth(month, year, daysBefore).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const nextMonthDaysToAppend2 = getFirstXDaysFromNextMonth(month, year, daysAfter).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n return [...previousMonthDaysToPrepend2, ...currentMonthDays, ...nextMonthDaysToAppend2];\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B,iCAAiC,0BAA0B;AACnG,SAAS,yCAAyC;AAI3C,MAAM,wBAAwB,CAAC,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B,WAAW;AAChH,MAAI,QAAQ;AAEV,gBAAY;AAAA,EACd;AAGA,QAAM,8BAA8B,8BAA8B,OAAO,MAAM,UAAU,EAAE,IAAI,CAAC,SAAS;AAAA,IACvG;AAAA,IACA,aAAa,qBAAqB,GAAG;AAAA,IACrC,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,WAAW,UAA6B;AAAA,EAC1C,EAAE;AACF,QAAM,yBAAyB,2BAA2B,OAAO,MAAM,SAAS,EAAE,IAAI,CAAC,SAAS;AAAA,IAC9F;AAAA,IACA,aAAa,qBAAqB,GAAG;AAAA,IACrC,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,WAAW,UAA6B;AAAA,EAC1C,EAAE;AAEF,SAAO,CAAC,GAAG,6BAA6B,GAAG,kBAAkB,GAAG,sBAAsB;AACxF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const CalendarWrapper: () => JSX.Element;
|
|
2
|
+
export declare const CalendarWrapper: () => JSX.Element | null;
|
|
@@ -36,5 +36,5 @@ export declare const sumYears: (date: Date, howManyMore?: number) => Date;
|
|
|
36
36
|
export declare const getDaysInMonth: (month: number, year: number) => Date[];
|
|
37
37
|
export declare const getLastXDaysFromPreviousMonth: (month: number, year: number, howMany: number) => Date[];
|
|
38
38
|
export declare const getFirstXDaysFromNextMonth: (month: number, year: number, howMany: number) => Date[];
|
|
39
|
-
export declare const
|
|
39
|
+
export declare const getSixBySevenCurrentMonthDaysMatrix: (month: number, year: number) => DSControlledDateTimePickerInternalsT.MetaMonthDay[];
|
|
40
40
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-date-time-picker",
|
|
3
|
-
"version": "3.18.0",
|
|
3
|
+
"version": "3.18.1-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Date Time Picker",
|
|
6
6
|
"files": [
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"indent": 4
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@elliemae/ds-button": "3.18.0",
|
|
39
|
-
"@elliemae/ds-
|
|
40
|
-
"@elliemae/ds-
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-utilities": "3.18.0"
|
|
38
|
+
"@elliemae/ds-button": "3.18.1-rc.0",
|
|
39
|
+
"@elliemae/ds-grid": "3.18.1-rc.0",
|
|
40
|
+
"@elliemae/ds-icon": "3.18.1-rc.0",
|
|
41
|
+
"@elliemae/ds-icons": "3.18.1-rc.0",
|
|
42
|
+
"@elliemae/ds-popperjs": "3.18.1-rc.0",
|
|
43
|
+
"@elliemae/ds-props-helpers": "3.18.1-rc.0",
|
|
44
|
+
"@elliemae/ds-system": "3.18.1-rc.0",
|
|
45
|
+
"@elliemae/ds-utilities": "3.18.1-rc.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@elliemae/pui-theme": "~2.7.0",
|