@fluentui/react-calendar-compat 0.3.8 → 0.3.10
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/CHANGELOG.md +35 -6
- package/dist/index.d.ts +5 -5
- package/lib/components/Calendar/Calendar.js +1 -0
- package/lib/components/Calendar/Calendar.js.map +1 -1
- package/lib/components/Calendar/Calendar.types.js.map +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.js +2 -0
- package/lib/components/Calendar/useCalendarStyles.styles.js.map +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.raw.js +1 -0
- package/lib/components/Calendar/useCalendarStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDay/CalendarDay.js +1 -0
- package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib/components/CalendarDay/CalendarDay.types.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js +2 -0
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.raw.js +1 -0
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js +2 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +1 -0
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +2 -0
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js +1 -0
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js +2 -0
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -1
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js +1 -0
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDayGrid/useWeeks.js +1 -0
- package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.js +2 -1
- package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js +2 -0
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js.map +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js +1 -0
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js +2 -0
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js +1 -0
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarYear/CalendarYear.js +2 -5
- package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib/components/CalendarYear/CalendarYear.types.js.map +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js +2 -0
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.raw.js +1 -0
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.raw.js.map +1 -1
- package/lib/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
- package/lib/utils/dateMath/dateMath.js +14 -3
- package/lib/utils/dateMath/dateMath.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.js +1 -0
- package/lib-commonjs/components/Calendar/Calendar.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.types.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js +1 -0
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.js +1 -0
- package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.types.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +2 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +1 -0
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js +1 -0
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js +2 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.js +2 -5
- package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.types.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
- package/lib-commonjs/utils/dateMath/dateMath.js +14 -3
- package/lib-commonjs/utils/dateMath/dateMath.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CalendarYear/useCalendarYearStyles.styles.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarYear/useCalendarYearStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarPickerStyles.styles';\nimport type { CalendarYearStyleProps, CalendarYearStyles } from './CalendarYear.types';\n\n/**\n * @internal\n *\n * Apply styling to the CalendarYear slots based on the state\n */\nexport const useCalendarYearStyles_unstable = (props: CalendarYearStyleProps): CalendarYearStyles => {\n 'use no memo';\n\n return useCalendarPickerStyles_unstable(props);\n};\n"],"names":["useCalendarPickerStyles_unstable","useCalendarYearStyles_unstable","props"],"mappings":"AAAA;;;;;;;;;;;+CAEiD,mDAAmD;AAQ7F,MAAMC,iCAAiC,CAACC;IAC7C;IAEA,WAAOF,+DAAAA,EAAiCE;AAC1C,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/dateFormatting/dateFormatting.defaults.ts"],"sourcesContent":["import type { CalendarStrings, DateFormatting, DateGridStrings } from './dateFormatting.types';\n\n/**\n * Format date to a day string representation\n * @param date - input date to format\n */\nexport const formatDay = (date: Date) => date.getDate().toString();\n\n/**\n * Format date to a month-day-year string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonthDayYear = (date: Date, strings: DateGridStrings) =>\n strings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();\n\n/**\n * Format date to a month-year string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonthYear = (date: Date, strings: DateGridStrings) =>\n strings.months[date.getMonth()] + ' ' + date.getFullYear();\n\n/**\n * Format date to a month string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonth = (date: Date, strings: DateGridStrings) => strings.months[date.getMonth()];\n\n/**\n * Format date to a year string representation\n * @param date - input date to format\n */\nexport const formatYear = (date: Date) => date.getFullYear().toString();\n\nexport const DEFAULT_DATE_GRID_STRINGS: DateGridStrings = {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n shortDays: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n};\n\nexport const DEFAULT_DATE_FORMATTING: DateFormatting = {\n formatDay,\n formatMonth,\n formatYear,\n formatMonthDayYear,\n formatMonthYear,\n};\n\nexport const DEFAULT_CALENDAR_STRINGS: CalendarStrings = {\n ...DEFAULT_DATE_GRID_STRINGS,\n\n goToToday: 'Go to today',\n weekNumberFormatString: 'Week number {0}',\n prevMonthAriaLabel: 'Previous month',\n nextMonthAriaLabel: 'Next month',\n prevYearAriaLabel: 'Previous year',\n nextYearAriaLabel: 'Next year',\n prevYearRangeAriaLabel: 'Previous year range',\n nextYearRangeAriaLabel: 'Next year range',\n closeButtonAriaLabel: 'Close',\n selectedDateFormatString: 'Selected date {0}',\n todayDateFormatString: \"Today's date {0}\",\n monthPickerHeaderAriaLabel: '{0}, change year',\n yearPickerHeaderAriaLabel: '{0}, change month',\n dayMarkedAriaLabel: 'marked',\n};\n"],"names":["formatDay","date","getDate","toString","formatMonthDayYear","strings","months","getMonth","getFullYear","formatMonthYear","formatMonth","formatYear","DEFAULT_DATE_GRID_STRINGS","shortMonths","days","shortDays","DEFAULT_DATE_FORMATTING","DEFAULT_CALENDAR_STRINGS","goToToday","weekNumberFormatString","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","prevYearRangeAriaLabel","nextYearRangeAriaLabel","closeButtonAriaLabel","selectedDateFormatString","todayDateFormatString","monthPickerHeaderAriaLabel","yearPickerHeaderAriaLabel","dayMarkedAriaLabel"],"mappings":"AAEA;;;CAGC,GACD;;;;;;;;;;;4BA2DaiB;;;2BARAD;;;6BApBAJ;;;aA/BAZ;;;eAuBAU;;;sBAhBAN;;;mBAQAK;;;IAcAE,UAAAA;;;;AA7BN,MAAMX,YAAY,CAACC,
|
|
1
|
+
{"version":3,"sources":["../src/utils/dateFormatting/dateFormatting.defaults.ts"],"sourcesContent":["import type { CalendarStrings, DateFormatting, DateGridStrings } from './dateFormatting.types';\n\n/**\n * Format date to a day string representation\n * @param date - input date to format\n */\nexport const formatDay = (date: Date): string => date.getDate().toString();\n\n/**\n * Format date to a month-day-year string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonthDayYear = (date: Date, strings: DateGridStrings): string =>\n strings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();\n\n/**\n * Format date to a month-year string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonthYear = (date: Date, strings: DateGridStrings): string =>\n strings.months[date.getMonth()] + ' ' + date.getFullYear();\n\n/**\n * Format date to a month string\n * @param date - input date to format\n * @param strings - localized strings\n */\nexport const formatMonth = (date: Date, strings: DateGridStrings): string => strings.months[date.getMonth()];\n\n/**\n * Format date to a year string representation\n * @param date - input date to format\n */\nexport const formatYear = (date: Date): string => date.getFullYear().toString();\n\nexport const DEFAULT_DATE_GRID_STRINGS: DateGridStrings = {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n shortDays: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n};\n\nexport const DEFAULT_DATE_FORMATTING: DateFormatting = {\n formatDay,\n formatMonth,\n formatYear,\n formatMonthDayYear,\n formatMonthYear,\n};\n\nexport const DEFAULT_CALENDAR_STRINGS: CalendarStrings = {\n ...DEFAULT_DATE_GRID_STRINGS,\n\n goToToday: 'Go to today',\n weekNumberFormatString: 'Week number {0}',\n prevMonthAriaLabel: 'Previous month',\n nextMonthAriaLabel: 'Next month',\n prevYearAriaLabel: 'Previous year',\n nextYearAriaLabel: 'Next year',\n prevYearRangeAriaLabel: 'Previous year range',\n nextYearRangeAriaLabel: 'Next year range',\n closeButtonAriaLabel: 'Close',\n selectedDateFormatString: 'Selected date {0}',\n todayDateFormatString: \"Today's date {0}\",\n monthPickerHeaderAriaLabel: '{0}, change year',\n yearPickerHeaderAriaLabel: '{0}, change month',\n dayMarkedAriaLabel: 'marked',\n};\n"],"names":["formatDay","date","getDate","toString","formatMonthDayYear","strings","months","getMonth","getFullYear","formatMonthYear","formatMonth","formatYear","DEFAULT_DATE_GRID_STRINGS","shortMonths","days","shortDays","DEFAULT_DATE_FORMATTING","DEFAULT_CALENDAR_STRINGS","goToToday","weekNumberFormatString","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","prevYearRangeAriaLabel","nextYearRangeAriaLabel","closeButtonAriaLabel","selectedDateFormatString","todayDateFormatString","monthPickerHeaderAriaLabel","yearPickerHeaderAriaLabel","dayMarkedAriaLabel"],"mappings":"AAEA;;;CAGC,GACD;;;;;;;;;;;4BA2DaiB;;;2BARAD;;;6BApBAJ;;;aA/BAZ;;;eAuBAU;;;sBAhBAN;;;mBAQAK;;;IAcAE,UAAAA;;;;AA7BN,MAAMX,YAAY,CAACC,OAAuBA,KAAKC,OAAO,GAAGC,QAAQ,GAAG;AAOpE,MAAMC,qBAAqB,CAACH,MAAYI,UAC7CA,QAAQC,MAAM,CAACL,KAAKM,QAAQ,GAAG,GAAG,MAAMN,KAAKC,OAAO,KAAK,OAAOD,KAAKO,WAAW,GAAG;AAO9E,MAAMC,kBAAkB,CAACR,MAAYI,UAC1CA,QAAQC,MAAM,CAACL,KAAKM,QAAQ,GAAG,GAAG,MAAMN,KAAKO,WAAW,GAAG;AAOtD,MAAME,cAAc,CAACT,MAAYI,UAAqCA,QAAQC,MAAM,CAACL,KAAKM,QAAQ,GAAG,CAAC;AAMtG,mBAAmB,CAACN,OAAuBA,KAAKO,WAAW,GAAGL,QAAQ,GAAG;AAEzE,MAAMS,4BAA6C;IACxDN,QAAQ;QACN;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IACDO,aAAa;QAAC;QAAO;QAAO;QAAO;QAAO;QAAO;QAAO;QAAO;QAAO;QAAO;QAAO;QAAO;KAAM;IACjGC,MAAM;QAAC;QAAU;QAAU;QAAW;QAAa;QAAY;QAAU;KAAW;IACpFC,WAAW;QAAC;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;KAAI;AAChD,EAAE;AAEK,MAAMC,0BAA0C;IACrDhB;IACAU;IACAC;IACAP;IACAK;AACF,EAAE;AAEK,MAAMQ,2BAA4C;IACvD,GAAGL,yBAAyB;IAE5BM,WAAW;IACXC,wBAAwB;IACxBC,oBAAoB;IACpBC,oBAAoB;IACpBC,mBAAmB;IACnBC,mBAAmB;IACnBC,wBAAwB;IACxBC,wBAAwB;IACxBC,sBAAsB;IACtBC,0BAA0B;IAC1BC,uBAAuB;IACvBC,4BAA4B;IAC5BC,2BAA2B;IAC3BC,oBAAoB;AACtB,EAAE"}
|
|
@@ -136,11 +136,22 @@ function getDateRangeArray(date, dateRangeType, firstDayOfWeek, workWeekDays, da
|
|
|
136
136
|
_constants.DayOfWeek.Friday
|
|
137
137
|
];
|
|
138
138
|
}
|
|
139
|
-
daysToSelectInDayView = Math.max(daysToSelectInDayView, 1);
|
|
140
139
|
switch(dateRangeType){
|
|
141
140
|
case _constants.DateRangeType.Day:
|
|
142
|
-
|
|
143
|
-
endDate =
|
|
141
|
+
// Create a date range for the specified date
|
|
142
|
+
[startDate, endDate] = [
|
|
143
|
+
date,
|
|
144
|
+
addDays(date, daysToSelectInDayView)
|
|
145
|
+
];
|
|
146
|
+
// If the start date is after the end date, swap them
|
|
147
|
+
if (compareDatePart(startDate, endDate) > 0) {
|
|
148
|
+
// For reverse dates we need to add one day to both dates
|
|
149
|
+
// to ensure correct start date
|
|
150
|
+
[startDate, endDate] = [
|
|
151
|
+
addDays(endDate, 1),
|
|
152
|
+
addDays(startDate, 1)
|
|
153
|
+
];
|
|
154
|
+
}
|
|
144
155
|
break;
|
|
145
156
|
case _constants.DateRangeType.Week:
|
|
146
157
|
case _constants.DateRangeType.WorkWeek:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/dateMath/dateMath.ts"],"sourcesContent":["import { DateRangeType, DayOfWeek, FirstWeekOfYear, MonthOfYear, TimeConstants } from '../constants';\n\n/**\n * Returns a date offset from the given date by the specified number of days.\n * @param date - The origin date\n * @param days - The number of days to offset. 'days' can be negative.\n * @returns A new Date object offset from the origin date by the given number of days\n */\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date.getTime());\n result.setDate(result.getDate() + days);\n return result;\n}\n\n/**\n * Returns a date offset from the given date by the specified number of weeks.\n * @param date - The origin date\n * @param weeks - The number of weeks to offset. 'weeks' can be negative.\n * @returns A new Date object offset from the origin date by the given number of weeks\n */\nexport function addWeeks(date: Date, weeks: number): Date {\n return addDays(date, weeks * TimeConstants.DaysInOneWeek);\n}\n\n/**\n * Returns a date offset from the given date by the specified number of months.\n * The method tries to preserve the day-of-month; however, if the new month does not have enough days\n * to contain the original day-of-month, we'll use the last day of the new month.\n * @param date - The origin date\n * @param months - The number of months to offset. 'months' can be negative.\n * @returns A new Date object offset from the origin date by the given number of months\n */\nexport function addMonths(date: Date, months: number): Date {\n let result = new Date(date.getTime());\n const newMonth = result.getMonth() + months;\n result.setMonth(newMonth);\n\n // We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.\n // Loop until we back up to a day the new month has.\n // (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)\n if (\n result.getMonth() !==\n ((newMonth % TimeConstants.MonthInOneYear) + TimeConstants.MonthInOneYear) % TimeConstants.MonthInOneYear\n ) {\n result = addDays(result, -result.getDate());\n }\n return result;\n}\n\n/**\n * Returns a date offset from the given date by the specified number of years.\n * The method tries to preserve the day-of-month; however, if the new month does not have enough days\n * to contain the original day-of-month, we'll use the last day of the new month.\n * @param date - The origin date\n * @param years - The number of years to offset. 'years' can be negative.\n * @returns A new Date object offset from the origin date by the given number of years\n */\nexport function addYears(date: Date, years: number): Date {\n let result = new Date(date.getTime());\n result.setFullYear(date.getFullYear() + years);\n\n // We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.\n // Loop until we back up to a day the new month has.\n // (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)\n if (\n result.getMonth() !==\n ((date.getMonth() % TimeConstants.MonthInOneYear) + TimeConstants.MonthInOneYear) % TimeConstants.MonthInOneYear\n ) {\n result = addDays(result, -result.getDate());\n }\n return result;\n}\n\n/**\n * Returns a date that is the first day of the month of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the first day of the month.\n */\nexport function getMonthStart(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is the last day of the month of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the last day of the month.\n */\nexport function getMonthEnd(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth() + 1, 0, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is the first day of the year of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the first day of the year.\n */\nexport function getYearStart(date: Date): Date {\n return new Date(date.getFullYear(), 0, 1, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is the last day of the year of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the last day of the year.\n */\nexport function getYearEnd(date: Date): Date {\n return new Date(date.getFullYear() + 1, 0, 0, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is a copy of the given date, aside from the month changing to the given month.\n * The method tries to preserve the day-of-month; however, if the new month does not have enough days\n * to contain the original day-of-month, we'll use the last day of the new month.\n * @param date - The origin date\n * @param month - The 0-based index of the month to set on the date.\n * @returns A new Date object with the given month set.\n */\nexport function setMonth(date: Date, month: number): Date {\n return addMonths(date, month - date.getMonth());\n}\n\n/**\n * Compares two dates, and returns true if the two dates (not accounting for time-of-day) are equal.\n * @returns True if the two dates represent the same date (regardless of time-of-day), false otherwise.\n */\nexport function compareDates(date1: Date, date2: Date): boolean {\n if (!date1 && !date2) {\n return true;\n } else if (!date1 || !date2) {\n return false;\n } else {\n return (\n date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n }\n}\n\n/**\n * Compare the date parts of two dates\n * @param date1 - The first date to compare\n * @param date2 - The second date to compare\n * @returns A negative value if date1 is earlier than date2, 0 if the dates are equal, or a positive value\n * if date1 is later than date2.\n */\nexport function compareDatePart(date1: Date, date2: Date): number {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\n}\n\n/**\n * Gets the date range array including the specified date. The date range array is calculated as the list\n * of dates accounting for the specified first day of the week and date range type.\n * @param date - The input date\n * @param dateRangeType - The desired date range type, i.e., day, week, month, etc.\n * @param firstDayOfWeek - The first day of the week.\n * @param workWeekDays - The allowed days in work week. If not provided, assumes all days are allowed.\n * @param daysToSelectInDayView - The number of days to include when using dateRangeType === DateRangeType.Day\n * for multiday view. Defaults to 1\n * @returns An array of dates representing the date range containing the specified date.\n */\nexport function getDateRangeArray(\n date: Date,\n dateRangeType: DateRangeType,\n firstDayOfWeek: DayOfWeek,\n workWeekDays?: DayOfWeek[],\n daysToSelectInDayView: number = 1,\n): Date[] {\n const datesArray: Date[] = [];\n let startDate: Date;\n let endDate = null;\n\n if (!workWeekDays) {\n workWeekDays = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday];\n }\n\n daysToSelectInDayView = Math.max(daysToSelectInDayView, 1);\n\n switch (dateRangeType) {\n case DateRangeType.Day:\n startDate = getDatePart(date);\n endDate = addDays(startDate, daysToSelectInDayView);\n break;\n\n case DateRangeType.Week:\n case DateRangeType.WorkWeek:\n startDate = getStartDateOfWeek(getDatePart(date), firstDayOfWeek);\n endDate = addDays(startDate, TimeConstants.DaysInOneWeek);\n break;\n\n case DateRangeType.Month:\n startDate = new Date(date.getFullYear(), date.getMonth(), 1);\n endDate = addMonths(startDate, 1);\n break;\n\n default:\n throw new Error('Unexpected object: ' + dateRangeType);\n }\n\n // Populate the dates array with the dates in range\n let nextDate = startDate;\n\n do {\n if (dateRangeType !== DateRangeType.WorkWeek) {\n // push all days not in work week view\n datesArray.push(nextDate);\n } else if (workWeekDays.indexOf(nextDate.getDay()) !== -1) {\n datesArray.push(nextDate);\n }\n nextDate = addDays(nextDate, 1);\n } while (!compareDates(nextDate, endDate));\n\n return datesArray;\n}\n\n/**\n * Checks whether the specified date is in the given date range.\n * @param date - The origin date\n * @param dateRange - An array of dates to do the lookup on\n * @returns True if the date matches one of the dates in the specified array, false otherwise.\n */\nexport function isInDateRangeArray(date: Date, dateRange: Date[]): boolean {\n for (const dateInRange of dateRange) {\n if (compareDates(date, dateInRange)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Returns the week number for a date.\n * Week numbers are 1 - 52 (53) in a year\n * @param navigatedDate - A date to find the week number for.\n * @param firstDayOfWeek - The first day of the week (0-6, Sunday = 0)\n * @param firstWeekOfYear - The first week of the year (1-2)\n * @returns The weeks number array for the current month.\n */\nexport function getWeekNumbersInMonth(\n weeksInMonth: number,\n firstDayOfWeek: DayOfWeek,\n firstWeekOfYear: FirstWeekOfYear,\n navigatedDate: Date,\n): number[] {\n const selectedYear = navigatedDate.getFullYear();\n const selectedMonth = navigatedDate.getMonth();\n let dayOfMonth = 1;\n const fistDayOfMonth = new Date(selectedYear, selectedMonth, dayOfMonth);\n const endOfFirstWeek =\n dayOfMonth +\n (firstDayOfWeek + TimeConstants.DaysInOneWeek - 1) -\n adjustWeekDay(firstDayOfWeek, fistDayOfMonth.getDay());\n let endOfWeekRange = new Date(selectedYear, selectedMonth, endOfFirstWeek);\n dayOfMonth = endOfWeekRange.getDate();\n\n const weeksArray = [];\n for (let i = 0; i < weeksInMonth; i++) {\n // Get week number for end of week\n weeksArray.push(getWeekNumber(endOfWeekRange, firstDayOfWeek, firstWeekOfYear));\n dayOfMonth += TimeConstants.DaysInOneWeek;\n endOfWeekRange = new Date(selectedYear, selectedMonth, dayOfMonth);\n }\n return weeksArray;\n}\n\n/**\n * Returns the week number for a date.\n * Week numbers are 1 - 52 (53) in a year\n * @param date - A date to find the week number for.\n * @param firstDayOfWeek - The first day of the week (0-6, Sunday = 0)\n * @param firstWeekOfYear - The first week of the year (1-2)\n * @returns The week's number in the year.\n */\nexport function getWeekNumber(date: Date, firstDayOfWeek: DayOfWeek, firstWeekOfYear: FirstWeekOfYear): number {\n // First four-day week of the year - minumum days count\n const fourDayWeek = 4;\n\n switch (firstWeekOfYear) {\n case FirstWeekOfYear.FirstFullWeek:\n return getWeekOfYearFullDays(date, firstDayOfWeek, TimeConstants.DaysInOneWeek);\n\n case FirstWeekOfYear.FirstFourDayWeek:\n return getWeekOfYearFullDays(date, firstDayOfWeek, fourDayWeek);\n\n default:\n return getFirstDayWeekOfYear(date, firstDayOfWeek);\n }\n}\n\n/**\n * Gets the date for the first day of the week based on the given date assuming\n * the specified first day of the week.\n * @param date - The date to find the beginning of the week date for.\n * @returns A new date object representing the first day of the week containing the input date.\n */\nexport function getStartDateOfWeek(date: Date, firstDayOfWeek: DayOfWeek): Date {\n let daysOffset = firstDayOfWeek - date.getDay();\n if (daysOffset > 0) {\n // If first day of week is > date, go 1 week back, to ensure resulting date is in the past.\n daysOffset -= TimeConstants.DaysInOneWeek;\n }\n return addDays(date, daysOffset);\n}\n\n/**\n * Gets the date for the last day of the week based on the given date assuming\n * the specified first day of the week.\n * @param date - The date to find the beginning of the week date for.\n * @returns A new date object representing the first day of the week containing the input date.\n */\nexport function getEndDateOfWeek(date: Date, firstDayOfWeek: DayOfWeek): Date {\n const lastDayOfWeek = firstDayOfWeek - 1 >= 0 ? firstDayOfWeek - 1 : TimeConstants.DaysInOneWeek - 1;\n let daysOffset = lastDayOfWeek - date.getDay();\n if (daysOffset < 0) {\n // If last day of week is < date, go 1 week forward, to ensure resulting date is in the future.\n daysOffset += TimeConstants.DaysInOneWeek;\n }\n return addDays(date, daysOffset);\n}\n\n/**\n * Gets a new date with the time portion zeroed out, i.e., set to midnight\n * @param date - The origin date\n * @returns A new date with the time set to midnight\n */\nfunction getDatePart(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/**\n * Helper function to assist in date comparisons\n */\nexport function getDatePartHashValue(date: Date): number {\n // Generate date hash value created as sum of Date (up to 31 = 5 bits), Month (up to 11 = 4 bits) and Year.\n // eslint-disable-next-line no-bitwise\n return date.getDate() + (date.getMonth() << 5) + (date.getFullYear() << 9);\n}\n\n/**\n * Helper function for `getWeekNumber`.\n * Returns week number for a date.\n * @param date - current selected date.\n * @param firstDayOfWeek - The first day of week (0-6, Sunday = 0)\n * @param numberOfFullDays - week settings.\n * @returns The week's number in the year.\n */\nfunction getWeekOfYearFullDays(date: Date, firstDayOfWeek: DayOfWeek, numberOfFullDays: number): number {\n const dayOfYear = getDayOfYear(date) - 1;\n let num = date.getDay() - (dayOfYear % TimeConstants.DaysInOneWeek);\n\n const lastDayOfPrevYear = new Date(date.getFullYear() - 1, MonthOfYear.December, 31);\n const daysInYear = getDayOfYear(lastDayOfPrevYear) - 1;\n\n let num2 = (firstDayOfWeek - num + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n if (num2 !== 0 && num2 >= numberOfFullDays) {\n num2 -= TimeConstants.DaysInOneWeek;\n }\n\n let num3 = dayOfYear - num2;\n if (num3 < 0) {\n num -= daysInYear % TimeConstants.DaysInOneWeek;\n num2 = (firstDayOfWeek - num + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n if (num2 !== 0 && num2 + 1 >= numberOfFullDays) {\n num2 -= TimeConstants.DaysInOneWeek;\n }\n\n num3 = daysInYear - num2;\n }\n\n return Math.floor(num3 / TimeConstants.DaysInOneWeek + 1);\n}\n\n/**\n * Helper function for `getWeekNumber`.\n * Returns week number for a date.\n * @param date - current selected date.\n * @param firstDayOfWeek - The first day of week (0-6, Sunday = 0)\n * @returns The week's number in the year.\n */\nfunction getFirstDayWeekOfYear(date: Date, firstDayOfWeek: number): number {\n const num = getDayOfYear(date) - 1;\n const num2 = date.getDay() - (num % TimeConstants.DaysInOneWeek);\n const num3 = (num2 - firstDayOfWeek + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n\n return Math.floor((num + num3) / TimeConstants.DaysInOneWeek + 1);\n}\n\n/**\n * Helper function for `getWeekNumber`.\n * Returns adjusted week day number when `firstDayOfWeek` is other than Sunday.\n * For Week Day Number comparison checks\n * @param firstDayOfWeek - The first day of week (0-6, Sunday = 0)\n * @param dateWeekDay - shifts number forward to 1 week in case passed as true\n * @returns The day of week adjusted to `firstDayOfWeek`; e.g. when `firstDayOfWeek` is Monday (1),\n * Sunday becomes 7.\n */\nfunction adjustWeekDay(firstDayOfWeek: DayOfWeek, dateWeekDay: DayOfWeek): number {\n return firstDayOfWeek !== DayOfWeek.Sunday && dateWeekDay < firstDayOfWeek\n ? dateWeekDay + TimeConstants.DaysInOneWeek\n : dateWeekDay;\n}\n\n/**\n * Returns the day number for a date in a year:\n * the number of days since January 1st in the particular year.\n * @param date - A date to find the day number for.\n * @returns The day's number in the year.\n */\nfunction getDayOfYear(date: Date): number {\n const month = date.getMonth();\n const year = date.getFullYear();\n let daysUntilDate = 0;\n\n for (let i = 0; i < month; i++) {\n daysUntilDate += daysInMonth(i + 1, year);\n }\n\n daysUntilDate += date.getDate();\n\n return daysUntilDate;\n}\n\n/**\n * Returns the number of days in the month\n * @param month - The month number to target (months 1-12).\n * @param year - The year to target.\n * @returns The number of days in the month.\n */\nfunction daysInMonth(month: number, year: number): number {\n return new Date(year, month, 0).getDate();\n}\n"],"names":["DateRangeType","DayOfWeek","FirstWeekOfYear","MonthOfYear","TimeConstants","addDays","date","days","result","Date","getTime","setDate","getDate","addWeeks","weeks","DaysInOneWeek","addMonths","months","newMonth","getMonth","setMonth","MonthInOneYear","addYears","years","setFullYear","getFullYear","getMonthStart","getMonthEnd","getYearStart","getYearEnd","month","compareDates","date1","date2","compareDatePart","getDatePartHashValue","getDateRangeArray","dateRangeType","firstDayOfWeek","workWeekDays","daysToSelectInDayView","datesArray","startDate","endDate","Monday","Tuesday","Wednesday","Thursday","Friday","Math","max","Day","getDatePart","Week","WorkWeek","getStartDateOfWeek","Month","Error","nextDate","push","indexOf","getDay","isInDateRangeArray","dateRange","dateInRange","getWeekNumbersInMonth","weeksInMonth","firstWeekOfYear","navigatedDate","selectedYear","selectedMonth","dayOfMonth","fistDayOfMonth","endOfFirstWeek","adjustWeekDay","endOfWeekRange","weeksArray","i","getWeekNumber","fourDayWeek","FirstFullWeek","getWeekOfYearFullDays","FirstFourDayWeek","getFirstDayWeekOfYear","daysOffset","getEndDateOfWeek","lastDayOfWeek","numberOfFullDays","dayOfYear","getDayOfYear","num","lastDayOfPrevYear","December","daysInYear","num2","num3","floor","dateWeekDay","Sunday","year","daysUntilDate","daysInMonth"],"mappings":";;;;;;;;;;;WAQgBK;eAAAA;;aAwBAW;;;YAZAH;;;IAqCAS,QAAAA;;;IAyFAY,eAAAA;;;IArBAH,YAAAA;;;wBA+MAI;eAAAA;;qBA3KAC;;;IAqJAiD,gBAAAA;;;eA/NA1D;;;iBATAD;;;IAyNA6B,kBAAAA;;;IAtBAuB,aAAAA;;;yBAnCAb;eAAAA;;IArIApC,UAAAA;;;gBATAD;;;sBA6HAkC;eAAAA;;YAxGA1C;eAAAA;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;AAEA;;;;;;CAMC,GACD,SAASoE,sBAAsB7E,IAAU,EAAEgC,cAAsB;IAC/D,MAAMoD,MAAMD,aAAanF,QAAQ;IACjC,MAAMwF,OAAOxF,KAAKuD,MAAM,KAAM6B,MAAMtF,wBAAAA,CAAcW,aAAa;IAC/D,MAAMgF,OAAQD,CAAAA,OAAOxD,iBAAiB,IAAIlC,wBAAAA,CAAcW,aAAAA,AAAY,IAAKX,wBAAAA,CAAcW,aAAa;IAEpG,OAAOkC,KAAK+C,KAAK,CAAEN,CAAAA,MAAMK,IAAAA,CAAG,GAAK3F,wBAAAA,CAAcW,aAAa,GAAG;AACjE;AAEA;;;;;;;;CAQC,GACD,SAAS2D,cAAcpC,cAAyB,EAAE2D,WAAsB;IACtE,OAAO3D,mBAAmBrC,oBAAAA,CAAUiG,MAAM,IAAID,cAAc3D,iBACxD2D,cAAc7F,wBAAAA,CAAcW,aAAa,GACzCkF;AACN;AAEA;;;;;CAKC,GACD,SAASR,aAAanF,IAAU;IAC9B,MAAMwB,QAAQxB,KAAKa,QAAQ;IAC3B,MAAMgF,OAAO7F,KAAKmB,WAAW;IAC7B,IAAI2E,gBAAgB;IAEpB,IAAK,IAAIvB,IAAI,GAAGA,IAAI/C,OAAO+C,IAAK;QAC9BuB,iBAAiBC,YAAYxB,IAAI,GAAGsB;IACtC;IAEAC,iBAAiB9F,KAAKM,OAAO;IAE7B,OAAOwF;AACT;AAEA;;;;;CAKC,GACD,SAASC,YAAYvE,KAAa,EAAEqE,IAAY;IAC9C,OAAO,IAAI1F,KAAK0F,MAAMrE,OAAO,GAAGlB,OAAO;AACzC"}
|
|
1
|
+
{"version":3,"sources":["../src/utils/dateMath/dateMath.ts"],"sourcesContent":["import { DateRangeType, DayOfWeek, FirstWeekOfYear, MonthOfYear, TimeConstants } from '../constants';\n\n/**\n * Returns a date offset from the given date by the specified number of days.\n * @param date - The origin date\n * @param days - The number of days to offset. 'days' can be negative.\n * @returns A new Date object offset from the origin date by the given number of days\n */\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date.getTime());\n result.setDate(result.getDate() + days);\n return result;\n}\n\n/**\n * Returns a date offset from the given date by the specified number of weeks.\n * @param date - The origin date\n * @param weeks - The number of weeks to offset. 'weeks' can be negative.\n * @returns A new Date object offset from the origin date by the given number of weeks\n */\nexport function addWeeks(date: Date, weeks: number): Date {\n return addDays(date, weeks * TimeConstants.DaysInOneWeek);\n}\n\n/**\n * Returns a date offset from the given date by the specified number of months.\n * The method tries to preserve the day-of-month; however, if the new month does not have enough days\n * to contain the original day-of-month, we'll use the last day of the new month.\n * @param date - The origin date\n * @param months - The number of months to offset. 'months' can be negative.\n * @returns A new Date object offset from the origin date by the given number of months\n */\nexport function addMonths(date: Date, months: number): Date {\n let result = new Date(date.getTime());\n const newMonth = result.getMonth() + months;\n result.setMonth(newMonth);\n\n // We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.\n // Loop until we back up to a day the new month has.\n // (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)\n if (\n result.getMonth() !==\n ((newMonth % TimeConstants.MonthInOneYear) + TimeConstants.MonthInOneYear) % TimeConstants.MonthInOneYear\n ) {\n result = addDays(result, -result.getDate());\n }\n return result;\n}\n\n/**\n * Returns a date offset from the given date by the specified number of years.\n * The method tries to preserve the day-of-month; however, if the new month does not have enough days\n * to contain the original day-of-month, we'll use the last day of the new month.\n * @param date - The origin date\n * @param years - The number of years to offset. 'years' can be negative.\n * @returns A new Date object offset from the origin date by the given number of years\n */\nexport function addYears(date: Date, years: number): Date {\n let result = new Date(date.getTime());\n result.setFullYear(date.getFullYear() + years);\n\n // We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.\n // Loop until we back up to a day the new month has.\n // (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)\n if (\n result.getMonth() !==\n ((date.getMonth() % TimeConstants.MonthInOneYear) + TimeConstants.MonthInOneYear) % TimeConstants.MonthInOneYear\n ) {\n result = addDays(result, -result.getDate());\n }\n return result;\n}\n\n/**\n * Returns a date that is the first day of the month of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the first day of the month.\n */\nexport function getMonthStart(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is the last day of the month of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the last day of the month.\n */\nexport function getMonthEnd(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth() + 1, 0, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is the first day of the year of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the first day of the year.\n */\nexport function getYearStart(date: Date): Date {\n return new Date(date.getFullYear(), 0, 1, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is the last day of the year of the provided date.\n * @param date - The origin date\n * @returns A new Date object with the day set to the last day of the year.\n */\nexport function getYearEnd(date: Date): Date {\n return new Date(date.getFullYear() + 1, 0, 0, 0, 0, 0, 0);\n}\n\n/**\n * Returns a date that is a copy of the given date, aside from the month changing to the given month.\n * The method tries to preserve the day-of-month; however, if the new month does not have enough days\n * to contain the original day-of-month, we'll use the last day of the new month.\n * @param date - The origin date\n * @param month - The 0-based index of the month to set on the date.\n * @returns A new Date object with the given month set.\n */\nexport function setMonth(date: Date, month: number): Date {\n return addMonths(date, month - date.getMonth());\n}\n\n/**\n * Compares two dates, and returns true if the two dates (not accounting for time-of-day) are equal.\n * @returns True if the two dates represent the same date (regardless of time-of-day), false otherwise.\n */\nexport function compareDates(date1: Date, date2: Date): boolean {\n if (!date1 && !date2) {\n return true;\n } else if (!date1 || !date2) {\n return false;\n } else {\n return (\n date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n }\n}\n\n/**\n * Compare the date parts of two dates\n * @param date1 - The first date to compare\n * @param date2 - The second date to compare\n * @returns A negative value if date1 is earlier than date2, 0 if the dates are equal, or a positive value\n * if date1 is later than date2.\n */\nexport function compareDatePart(date1: Date, date2: Date): number {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\n}\n\n/**\n * Gets the date range array including the specified date. The date range array is calculated as the list\n * of dates accounting for the specified first day of the week and date range type.\n * @param date - The input date\n * @param dateRangeType - The desired date range type, i.e., day, week, month, etc.\n * @param firstDayOfWeek - The first day of the week.\n * @param workWeekDays - The allowed days in work week. If not provided, assumes all days are allowed.\n * @param daysToSelectInDayView - The number of days to include when using dateRangeType === DateRangeType.Day\n * for multiday view. Defaults to 1\n * @returns An array of dates representing the date range containing the specified date.\n */\nexport function getDateRangeArray(\n date: Date,\n dateRangeType: DateRangeType,\n firstDayOfWeek: DayOfWeek,\n workWeekDays?: DayOfWeek[],\n daysToSelectInDayView: number = 1,\n): Date[] {\n const datesArray: Date[] = [];\n let startDate: Date;\n let endDate = null;\n\n if (!workWeekDays) {\n workWeekDays = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday];\n }\n\n switch (dateRangeType) {\n case DateRangeType.Day:\n // Create a date range for the specified date\n\n [startDate, endDate] = [date, addDays(date, daysToSelectInDayView)];\n\n // If the start date is after the end date, swap them\n if (compareDatePart(startDate, endDate) > 0) {\n // For reverse dates we need to add one day to both dates\n // to ensure correct start date\n [startDate, endDate] = [addDays(endDate, 1), addDays(startDate, 1)];\n }\n\n break;\n\n case DateRangeType.Week:\n case DateRangeType.WorkWeek:\n startDate = getStartDateOfWeek(getDatePart(date), firstDayOfWeek);\n endDate = addDays(startDate, TimeConstants.DaysInOneWeek);\n break;\n\n case DateRangeType.Month:\n startDate = new Date(date.getFullYear(), date.getMonth(), 1);\n endDate = addMonths(startDate, 1);\n break;\n\n default:\n throw new Error('Unexpected object: ' + dateRangeType);\n }\n\n // Populate the dates array with the dates in range\n let nextDate = startDate;\n\n do {\n if (dateRangeType !== DateRangeType.WorkWeek) {\n // push all days not in work week view\n datesArray.push(nextDate);\n } else if (workWeekDays.indexOf(nextDate.getDay()) !== -1) {\n datesArray.push(nextDate);\n }\n nextDate = addDays(nextDate, 1);\n } while (!compareDates(nextDate, endDate));\n\n return datesArray;\n}\n\n/**\n * Checks whether the specified date is in the given date range.\n * @param date - The origin date\n * @param dateRange - An array of dates to do the lookup on\n * @returns True if the date matches one of the dates in the specified array, false otherwise.\n */\nexport function isInDateRangeArray(date: Date, dateRange: Date[]): boolean {\n for (const dateInRange of dateRange) {\n if (compareDates(date, dateInRange)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Returns the week number for a date.\n * Week numbers are 1 - 52 (53) in a year\n * @param navigatedDate - A date to find the week number for.\n * @param firstDayOfWeek - The first day of the week (0-6, Sunday = 0)\n * @param firstWeekOfYear - The first week of the year (1-2)\n * @returns The weeks number array for the current month.\n */\nexport function getWeekNumbersInMonth(\n weeksInMonth: number,\n firstDayOfWeek: DayOfWeek,\n firstWeekOfYear: FirstWeekOfYear,\n navigatedDate: Date,\n): number[] {\n const selectedYear = navigatedDate.getFullYear();\n const selectedMonth = navigatedDate.getMonth();\n let dayOfMonth = 1;\n const fistDayOfMonth = new Date(selectedYear, selectedMonth, dayOfMonth);\n const endOfFirstWeek =\n dayOfMonth +\n (firstDayOfWeek + TimeConstants.DaysInOneWeek - 1) -\n adjustWeekDay(firstDayOfWeek, fistDayOfMonth.getDay());\n let endOfWeekRange = new Date(selectedYear, selectedMonth, endOfFirstWeek);\n dayOfMonth = endOfWeekRange.getDate();\n\n const weeksArray = [];\n for (let i = 0; i < weeksInMonth; i++) {\n // Get week number for end of week\n weeksArray.push(getWeekNumber(endOfWeekRange, firstDayOfWeek, firstWeekOfYear));\n dayOfMonth += TimeConstants.DaysInOneWeek;\n endOfWeekRange = new Date(selectedYear, selectedMonth, dayOfMonth);\n }\n return weeksArray;\n}\n\n/**\n * Returns the week number for a date.\n * Week numbers are 1 - 52 (53) in a year\n * @param date - A date to find the week number for.\n * @param firstDayOfWeek - The first day of the week (0-6, Sunday = 0)\n * @param firstWeekOfYear - The first week of the year (1-2)\n * @returns The week's number in the year.\n */\nexport function getWeekNumber(date: Date, firstDayOfWeek: DayOfWeek, firstWeekOfYear: FirstWeekOfYear): number {\n // First four-day week of the year - minumum days count\n const fourDayWeek = 4;\n\n switch (firstWeekOfYear) {\n case FirstWeekOfYear.FirstFullWeek:\n return getWeekOfYearFullDays(date, firstDayOfWeek, TimeConstants.DaysInOneWeek);\n\n case FirstWeekOfYear.FirstFourDayWeek:\n return getWeekOfYearFullDays(date, firstDayOfWeek, fourDayWeek);\n\n default:\n return getFirstDayWeekOfYear(date, firstDayOfWeek);\n }\n}\n\n/**\n * Gets the date for the first day of the week based on the given date assuming\n * the specified first day of the week.\n * @param date - The date to find the beginning of the week date for.\n * @returns A new date object representing the first day of the week containing the input date.\n */\nexport function getStartDateOfWeek(date: Date, firstDayOfWeek: DayOfWeek): Date {\n let daysOffset = firstDayOfWeek - date.getDay();\n if (daysOffset > 0) {\n // If first day of week is > date, go 1 week back, to ensure resulting date is in the past.\n daysOffset -= TimeConstants.DaysInOneWeek;\n }\n return addDays(date, daysOffset);\n}\n\n/**\n * Gets the date for the last day of the week based on the given date assuming\n * the specified first day of the week.\n * @param date - The date to find the beginning of the week date for.\n * @returns A new date object representing the first day of the week containing the input date.\n */\nexport function getEndDateOfWeek(date: Date, firstDayOfWeek: DayOfWeek): Date {\n const lastDayOfWeek = firstDayOfWeek - 1 >= 0 ? firstDayOfWeek - 1 : TimeConstants.DaysInOneWeek - 1;\n let daysOffset = lastDayOfWeek - date.getDay();\n if (daysOffset < 0) {\n // If last day of week is < date, go 1 week forward, to ensure resulting date is in the future.\n daysOffset += TimeConstants.DaysInOneWeek;\n }\n return addDays(date, daysOffset);\n}\n\n/**\n * Gets a new date with the time portion zeroed out, i.e., set to midnight\n * @param date - The origin date\n * @returns A new date with the time set to midnight\n */\nfunction getDatePart(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/**\n * Helper function to assist in date comparisons\n */\nexport function getDatePartHashValue(date: Date): number {\n // Generate date hash value created as sum of Date (up to 31 = 5 bits), Month (up to 11 = 4 bits) and Year.\n // eslint-disable-next-line no-bitwise\n return date.getDate() + (date.getMonth() << 5) + (date.getFullYear() << 9);\n}\n\n/**\n * Helper function for `getWeekNumber`.\n * Returns week number for a date.\n * @param date - current selected date.\n * @param firstDayOfWeek - The first day of week (0-6, Sunday = 0)\n * @param numberOfFullDays - week settings.\n * @returns The week's number in the year.\n */\nfunction getWeekOfYearFullDays(date: Date, firstDayOfWeek: DayOfWeek, numberOfFullDays: number): number {\n const dayOfYear = getDayOfYear(date) - 1;\n let num = date.getDay() - (dayOfYear % TimeConstants.DaysInOneWeek);\n\n const lastDayOfPrevYear = new Date(date.getFullYear() - 1, MonthOfYear.December, 31);\n const daysInYear = getDayOfYear(lastDayOfPrevYear) - 1;\n\n let num2 = (firstDayOfWeek - num + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n if (num2 !== 0 && num2 >= numberOfFullDays) {\n num2 -= TimeConstants.DaysInOneWeek;\n }\n\n let num3 = dayOfYear - num2;\n if (num3 < 0) {\n num -= daysInYear % TimeConstants.DaysInOneWeek;\n num2 = (firstDayOfWeek - num + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n if (num2 !== 0 && num2 + 1 >= numberOfFullDays) {\n num2 -= TimeConstants.DaysInOneWeek;\n }\n\n num3 = daysInYear - num2;\n }\n\n return Math.floor(num3 / TimeConstants.DaysInOneWeek + 1);\n}\n\n/**\n * Helper function for `getWeekNumber`.\n * Returns week number for a date.\n * @param date - current selected date.\n * @param firstDayOfWeek - The first day of week (0-6, Sunday = 0)\n * @returns The week's number in the year.\n */\nfunction getFirstDayWeekOfYear(date: Date, firstDayOfWeek: number): number {\n const num = getDayOfYear(date) - 1;\n const num2 = date.getDay() - (num % TimeConstants.DaysInOneWeek);\n const num3 = (num2 - firstDayOfWeek + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n\n return Math.floor((num + num3) / TimeConstants.DaysInOneWeek + 1);\n}\n\n/**\n * Helper function for `getWeekNumber`.\n * Returns adjusted week day number when `firstDayOfWeek` is other than Sunday.\n * For Week Day Number comparison checks\n * @param firstDayOfWeek - The first day of week (0-6, Sunday = 0)\n * @param dateWeekDay - shifts number forward to 1 week in case passed as true\n * @returns The day of week adjusted to `firstDayOfWeek`; e.g. when `firstDayOfWeek` is Monday (1),\n * Sunday becomes 7.\n */\nfunction adjustWeekDay(firstDayOfWeek: DayOfWeek, dateWeekDay: DayOfWeek): number {\n return firstDayOfWeek !== DayOfWeek.Sunday && dateWeekDay < firstDayOfWeek\n ? dateWeekDay + TimeConstants.DaysInOneWeek\n : dateWeekDay;\n}\n\n/**\n * Returns the day number for a date in a year:\n * the number of days since January 1st in the particular year.\n * @param date - A date to find the day number for.\n * @returns The day's number in the year.\n */\nfunction getDayOfYear(date: Date): number {\n const month = date.getMonth();\n const year = date.getFullYear();\n let daysUntilDate = 0;\n\n for (let i = 0; i < month; i++) {\n daysUntilDate += daysInMonth(i + 1, year);\n }\n\n daysUntilDate += date.getDate();\n\n return daysUntilDate;\n}\n\n/**\n * Returns the number of days in the month\n * @param month - The month number to target (months 1-12).\n * @param year - The year to target.\n * @returns The number of days in the month.\n */\nfunction daysInMonth(month: number, year: number): number {\n return new Date(year, month, 0).getDate();\n}\n"],"names":["DateRangeType","DayOfWeek","FirstWeekOfYear","MonthOfYear","TimeConstants","addDays","date","days","result","Date","getTime","setDate","getDate","addWeeks","weeks","DaysInOneWeek","addMonths","months","newMonth","getMonth","setMonth","MonthInOneYear","addYears","years","setFullYear","getFullYear","getMonthStart","getMonthEnd","getYearStart","getYearEnd","month","compareDates","date1","date2","compareDatePart","getDatePartHashValue","getDateRangeArray","dateRangeType","firstDayOfWeek","workWeekDays","daysToSelectInDayView","datesArray","startDate","endDate","Monday","Tuesday","Wednesday","Thursday","Friday","Day","Week","WorkWeek","getStartDateOfWeek","getDatePart","Month","Error","nextDate","push","indexOf","getDay","isInDateRangeArray","dateRange","dateInRange","getWeekNumbersInMonth","weeksInMonth","firstWeekOfYear","navigatedDate","selectedYear","selectedMonth","dayOfMonth","fistDayOfMonth","endOfFirstWeek","adjustWeekDay","endOfWeekRange","weeksArray","i","getWeekNumber","fourDayWeek","FirstFullWeek","getWeekOfYearFullDays","FirstFourDayWeek","getFirstDayWeekOfYear","daysOffset","getEndDateOfWeek","lastDayOfWeek","numberOfFullDays","dayOfYear","getDayOfYear","num","lastDayOfPrevYear","December","daysInYear","num2","num3","Math","floor","dateWeekDay","Sunday","year","daysUntilDate","daysInMonth"],"mappings":";;;;;;;;;;;WAQgBK;eAAAA;;aAwBAW;;;YAZAH;;;IAqCAS,QAAAA;;;IAyFAY,eAAAA;;;gBArBAH;;;IAsNAI,oBAAAA;;;qBAlLAC;eAAAA;;IA4JA+C,gBAAAA;;;eAtOAxD;;;iBATAD;;;sBAgOA0B;;;iBAtBAwB;;;IAnCAb,qBAAAA;;;IA5IAlC,UAAAA;;;IATAD,YAAAA;;;IAoIAgC,kBAAAA;;;YA/GAxC;;;;2BArHsE,eAAe;AAQ9F,iBAAiBd,IAAU,EAAEC,IAAY;IAC9C,MAAMC,SAAS,IAAIC,KAAKH,KAAKI,OAAO;IACpCF,OAAOG,OAAO,CAACH,OAAOI,OAAO,KAAKL;IAClC,OAAOC;AACT;AAQO,SAASK,SAASP,IAAU,EAAEQ,KAAa;IAChD,OAAOT,QAAQC,MAAMQ,QAAQV,wBAAAA,CAAcW,aAAa;AAC1D;AAUO,SAASC,UAAUV,IAAU,EAAEW,MAAc;IAClD,IAAIT,SAAS,IAAIC,KAAKH,KAAKI,OAAO;IAClC,MAAMQ,WAAWV,OAAOW,QAAQ,KAAKF;IACrCT,OAAOY,QAAQ,CAACF;IAEhB,qHAAqH;IACrH,oDAAoD;IACpD,qFAAqF;IACrF,IACEV,OAAOW,QAAQ,OACd,CAACD,WAAWd,wBAAAA,CAAciB,cAAc,G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AAcW,aAAa,GAAG;AACjE;AAEA;;;;;;;;CAQC,GACD,SAASyD,cAAclC,cAAyB,EAAE0D,WAAsB;IACtE,OAAO1D,mBAAmBrC,oBAAAA,CAAUgG,MAAM,IAAID,cAAc1D,iBACxD0D,cAAc5F,wBAAAA,CAAcW,aAAa,GACzCiF;AACN;AAEA;;;;;CAKC,GACD,SAAST,aAAajF,IAAU;IAC9B,MAAMwB,QAAQxB,KAAKa,QAAQ;IAC3B,MAAM+E,OAAO5F,KAAKmB,WAAW;IAC7B,IAAI0E,gBAAgB;IAEpB,IAAK,IAAIxB,IAAI,GAAGA,IAAI7C,OAAO6C,IAAK;QAC9BwB,iBAAiBC,YAAYzB,IAAI,GAAGuB;IACtC;IAEAC,iBAAiB7F,KAAKM,OAAO;IAE7B,OAAOuF;AACT;AAEA;;;;;CAKC,GACD,SAASC,YAAYtE,KAAa,EAAEoE,IAAY;IAC9C,OAAO,IAAIzF,KAAKyF,MAAMpE,OAAO,GAAGlB,OAAO;AACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-calendar-compat",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "Calendar compat component for Fluent UI v9",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@fluentui/keyboard-keys": "^9.0.8",
|
|
22
22
|
"@fluentui/react-icons": "^2.0.245",
|
|
23
|
-
"@fluentui/react-jsx-runtime": "^9.1
|
|
24
|
-
"@fluentui/react-shared-contexts": "^9.25.
|
|
25
|
-
"@fluentui/react-tabster": "^9.26.
|
|
23
|
+
"@fluentui/react-jsx-runtime": "^9.2.1",
|
|
24
|
+
"@fluentui/react-shared-contexts": "^9.25.2",
|
|
25
|
+
"@fluentui/react-tabster": "^9.26.6",
|
|
26
26
|
"@fluentui/react-theme": "^9.2.0",
|
|
27
|
-
"@fluentui/react-utilities": "^9.
|
|
27
|
+
"@fluentui/react-utilities": "^9.25.0",
|
|
28
28
|
"@griffel/react": "^1.5.22",
|
|
29
29
|
"@swc/helpers": "^0.5.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@types/react": ">=16.8.0 <
|
|
33
|
-
"@types/react-dom": ">=16.8.0 <
|
|
34
|
-
"react": ">=16.8.0 <
|
|
35
|
-
"react-dom": ">=16.8.0 <
|
|
32
|
+
"@types/react": ">=16.8.0 <20.0.0",
|
|
33
|
+
"@types/react-dom": ">=16.8.0 <20.0.0",
|
|
34
|
+
"react": ">=16.8.0 <20.0.0",
|
|
35
|
+
"react-dom": ">=16.8.0 <20.0.0"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|
|
38
38
|
".": {
|