@fluentui/react-calendar-compat 0.1.11 → 0.1.13

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.
Files changed (148) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/index.d.ts +4 -0
  3. package/lib/Calendar.js.map +1 -1
  4. package/lib/CalendarDay.js.map +1 -1
  5. package/lib/CalendarDayGrid.js.map +1 -1
  6. package/lib/CalendarMonth.js.map +1 -1
  7. package/lib/CalendarPicker.js.map +1 -1
  8. package/lib/CalendarYear.js.map +1 -1
  9. package/lib/components/Calendar/Calendar.js +1 -2
  10. package/lib/components/Calendar/Calendar.js.map +1 -1
  11. package/lib/components/Calendar/Calendar.types.js +4 -4
  12. package/lib/components/Calendar/Calendar.types.js.map +1 -1
  13. package/lib/components/Calendar/calendarNavigationIcons.js.map +1 -1
  14. package/lib/components/Calendar/defaults.js.map +1 -1
  15. package/lib/components/Calendar/index.js.map +1 -1
  16. package/lib/components/Calendar/useCalendarStyles.styles.js +2 -0
  17. package/lib/components/Calendar/useCalendarStyles.styles.js.map +1 -1
  18. package/lib/components/CalendarDay/CalendarDay.js +2 -5
  19. package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
  20. package/lib/components/CalendarDay/CalendarDay.types.js.map +1 -1
  21. package/lib/components/CalendarDay/index.js.map +1 -1
  22. package/lib/components/CalendarDay/useCalendarDayStyles.styles.js +2 -0
  23. package/lib/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
  24. package/lib/components/CalendarDayGrid/CalendarDayGrid.js +2 -1
  25. package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
  26. package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
  27. package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +2 -4
  28. package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
  29. package/lib/components/CalendarDayGrid/CalendarGridRow.js +2 -1
  30. package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
  31. package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
  32. package/lib/components/CalendarDayGrid/index.js.map +1 -1
  33. package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +9 -2
  34. package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
  35. package/lib/components/CalendarDayGrid/useWeeks.js +1 -0
  36. package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -1
  37. package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
  38. package/lib/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
  39. package/lib/components/CalendarMonth/index.js.map +1 -1
  40. package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js +2 -0
  41. package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js.map +1 -1
  42. package/lib/components/CalendarPicker/CalendarPicker.types.js +3 -1
  43. package/lib/components/CalendarPicker/CalendarPicker.types.js.map +1 -1
  44. package/lib/components/CalendarPicker/index.js.map +1 -1
  45. package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js +2 -0
  46. package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
  47. package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
  48. package/lib/components/CalendarYear/CalendarYear.types.js.map +1 -1
  49. package/lib/components/CalendarYear/index.js.map +1 -1
  50. package/lib/components/CalendarYear/useCalendarYearStyles.styles.js +2 -0
  51. package/lib/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
  52. package/lib/index.js.map +1 -1
  53. package/lib/utils/animations.js.map +1 -1
  54. package/lib/utils/constants.js.map +1 -1
  55. package/lib/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
  56. package/lib/utils/dateFormatting/dateFormatting.types.js.map +1 -1
  57. package/lib/utils/dateFormatting/index.js.map +1 -1
  58. package/lib/utils/dateGrid/dateGrid.types.js.map +1 -1
  59. package/lib/utils/dateGrid/findAvailableDate.js.map +1 -1
  60. package/lib/utils/dateGrid/getBoundedDateRange.js.map +1 -1
  61. package/lib/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -1
  62. package/lib/utils/dateGrid/getDayGrid.js.map +1 -1
  63. package/lib/utils/dateGrid/index.js.map +1 -1
  64. package/lib/utils/dateGrid/isAfterMaxDate.js.map +1 -1
  65. package/lib/utils/dateGrid/isBeforeMinDate.js.map +1 -1
  66. package/lib/utils/dateGrid/isContiguous.js.map +1 -1
  67. package/lib/utils/dateGrid/isRestrictedDate.js.map +1 -1
  68. package/lib/utils/dateMath/dateMath.js.map +1 -1
  69. package/lib/utils/dateMath/index.js.map +1 -1
  70. package/lib/utils/focus.js.map +1 -1
  71. package/lib/utils/index.js.map +1 -1
  72. package/lib-commonjs/Calendar.js.map +1 -1
  73. package/lib-commonjs/CalendarDay.js.map +1 -1
  74. package/lib-commonjs/CalendarDayGrid.js.map +1 -1
  75. package/lib-commonjs/CalendarMonth.js.map +1 -1
  76. package/lib-commonjs/CalendarPicker.js.map +1 -1
  77. package/lib-commonjs/CalendarYear.js.map +1 -1
  78. package/lib-commonjs/components/Calendar/Calendar.js +1 -2
  79. package/lib-commonjs/components/Calendar/Calendar.js.map +1 -1
  80. package/lib-commonjs/components/Calendar/Calendar.types.js +4 -4
  81. package/lib-commonjs/components/Calendar/Calendar.types.js.map +1 -1
  82. package/lib-commonjs/components/Calendar/calendarNavigationIcons.js.map +1 -1
  83. package/lib-commonjs/components/Calendar/defaults.js.map +1 -1
  84. package/lib-commonjs/components/Calendar/index.js.map +1 -1
  85. package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js +1 -0
  86. package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js.map +1 -1
  87. package/lib-commonjs/components/CalendarDay/CalendarDay.js +2 -5
  88. package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
  89. package/lib-commonjs/components/CalendarDay/CalendarDay.types.js.map +1 -1
  90. package/lib-commonjs/components/CalendarDay/index.js.map +1 -1
  91. package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js +1 -0
  92. package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
  93. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +2 -1
  94. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
  95. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
  96. package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +2 -4
  97. package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
  98. package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js +2 -1
  99. package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
  100. package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
  101. package/lib-commonjs/components/CalendarDayGrid/index.js.map +1 -1
  102. package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +10 -1
  103. package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
  104. package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js +3 -3
  105. package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -1
  106. package/lib-commonjs/components/CalendarDayGrid/useWeeks.js +1 -0
  107. package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -1
  108. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
  109. package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
  110. package/lib-commonjs/components/CalendarMonth/index.js.map +1 -1
  111. package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js +1 -0
  112. package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js.map +1 -1
  113. package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js +3 -1
  114. package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js.map +1 -1
  115. package/lib-commonjs/components/CalendarPicker/index.js.map +1 -1
  116. package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js +1 -0
  117. package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
  118. package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
  119. package/lib-commonjs/components/CalendarYear/CalendarYear.types.js.map +1 -1
  120. package/lib-commonjs/components/CalendarYear/index.js.map +1 -1
  121. package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js +1 -0
  122. package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
  123. package/lib-commonjs/index.js +44 -44
  124. package/lib-commonjs/index.js.map +1 -1
  125. package/lib-commonjs/utils/animations.js +9 -9
  126. package/lib-commonjs/utils/animations.js.map +1 -1
  127. package/lib-commonjs/utils/constants.js +8 -8
  128. package/lib-commonjs/utils/constants.js.map +1 -1
  129. package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js +12 -12
  130. package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
  131. package/lib-commonjs/utils/dateFormatting/dateFormatting.types.js.map +1 -1
  132. package/lib-commonjs/utils/dateFormatting/index.js.map +1 -1
  133. package/lib-commonjs/utils/dateGrid/dateGrid.types.js.map +1 -1
  134. package/lib-commonjs/utils/dateGrid/findAvailableDate.js.map +1 -1
  135. package/lib-commonjs/utils/dateGrid/getBoundedDateRange.js.map +1 -1
  136. package/lib-commonjs/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -1
  137. package/lib-commonjs/utils/dateGrid/getDayGrid.js.map +1 -1
  138. package/lib-commonjs/utils/dateGrid/index.js.map +1 -1
  139. package/lib-commonjs/utils/dateGrid/isAfterMaxDate.js.map +1 -1
  140. package/lib-commonjs/utils/dateGrid/isBeforeMinDate.js.map +1 -1
  141. package/lib-commonjs/utils/dateGrid/isContiguous.js.map +1 -1
  142. package/lib-commonjs/utils/dateGrid/isRestrictedDate.js.map +1 -1
  143. package/lib-commonjs/utils/dateMath/dateMath.js +29 -29
  144. package/lib-commonjs/utils/dateMath/dateMath.js.map +1 -1
  145. package/lib-commonjs/utils/dateMath/index.js.map +1 -1
  146. package/lib-commonjs/utils/focus.js.map +1 -1
  147. package/lib-commonjs/utils/index.js.map +1 -1
  148. package/package.json +6 -6
@@ -12,29 +12,29 @@ function _export(target, all) {
12
12
  });
13
13
  }
14
14
  _export(exports, {
15
+ DEFAULT_CALENDAR_STRINGS: function() {
16
+ return DEFAULT_CALENDAR_STRINGS;
17
+ },
18
+ DEFAULT_DATE_FORMATTING: function() {
19
+ return DEFAULT_DATE_FORMATTING;
20
+ },
21
+ DEFAULT_DATE_GRID_STRINGS: function() {
22
+ return DEFAULT_DATE_GRID_STRINGS;
23
+ },
15
24
  formatDay: function() {
16
25
  return formatDay;
17
26
  },
27
+ formatMonth: function() {
28
+ return formatMonth;
29
+ },
18
30
  formatMonthDayYear: function() {
19
31
  return formatMonthDayYear;
20
32
  },
21
33
  formatMonthYear: function() {
22
34
  return formatMonthYear;
23
35
  },
24
- formatMonth: function() {
25
- return formatMonth;
26
- },
27
36
  formatYear: function() {
28
37
  return formatYear;
29
- },
30
- DEFAULT_DATE_GRID_STRINGS: function() {
31
- return DEFAULT_DATE_GRID_STRINGS;
32
- },
33
- DEFAULT_DATE_FORMATTING: function() {
34
- return DEFAULT_DATE_FORMATTING;
35
- },
36
- DEFAULT_CALENDAR_STRINGS: function() {
37
- return DEFAULT_CALENDAR_STRINGS;
38
38
  }
39
39
  });
40
40
  const formatDay = (date)=>date.getDate().toString();
@@ -1 +1 @@
1
- {"version":3,"sources":["dateFormatting.defaults.js"],"sourcesContent":["/**\n * Format date to a day string representation\n * @param date - input date to format\n */ export const formatDay = (date)=>date.getDate().toString();\n/**\n * Format date to a month-day-year string\n * @param date - input date to format\n * @param strings - localized strings\n */ export const formatMonthDayYear = (date, strings)=>strings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();\n/**\n * Format date to a month-year string\n * @param date - input date to format\n * @param strings - localized strings\n */ export const formatMonthYear = (date, strings)=>strings.months[date.getMonth()] + ' ' + date.getFullYear();\n/**\n * Format date to a month string\n * @param date - input date to format\n * @param strings - localized strings\n */ export const formatMonth = (date, strings)=>strings.months[date.getMonth()];\n/**\n * Format date to a year string representation\n * @param date - input date to format\n */ export const formatYear = (date)=>date.getFullYear().toString();\nexport const DEFAULT_DATE_GRID_STRINGS = {\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: [\n 'Jan',\n 'Feb',\n 'Mar',\n 'Apr',\n 'May',\n 'Jun',\n 'Jul',\n 'Aug',\n 'Sep',\n 'Oct',\n 'Nov',\n 'Dec'\n ],\n days: [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday'\n ],\n shortDays: [\n 'S',\n 'M',\n 'T',\n 'W',\n 'T',\n 'F',\n 'S'\n ]\n};\nexport const DEFAULT_DATE_FORMATTING = {\n formatDay,\n formatMonth,\n formatYear,\n formatMonthDayYear,\n formatMonthYear\n};\nexport const DEFAULT_CALENDAR_STRINGS = {\n ...DEFAULT_DATE_GRID_STRINGS,\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","formatMonthDayYear","formatMonthYear","formatMonth","formatYear","DEFAULT_DATE_GRID_STRINGS","DEFAULT_DATE_FORMATTING","DEFAULT_CALENDAR_STRINGS","date","getDate","toString","strings","months","getMonth","getFullYear","shortMonths","days","shortDays","goToToday","weekNumberFormatString","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","prevYearRangeAriaLabel","nextYearRangeAriaLabel","closeButtonAriaLabel","selectedDateFormatString","todayDateFormatString","monthPickerHeaderAriaLabel","yearPickerHeaderAriaLabel","dayMarkedAriaLabel"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;IAAgBA,SAAS;eAATA;;IAKAC,kBAAkB;eAAlBA;;IAKAC,eAAe;eAAfA;;IAKAC,WAAW;eAAXA;;IAIAC,UAAU;eAAVA;;IACJC,yBAAyB;eAAzBA;;IAgDAC,uBAAuB;eAAvBA;;IAOAC,wBAAwB;eAAxBA;;;AA3EF,MAAMP,YAAY,CAACQ,OAAOA,KAAKC,OAAO,GAAGC,QAAQ;AAKjD,MAAMT,qBAAqB,CAACO,MAAMG,UAAUA,QAAQC,MAAM,CAACJ,KAAKK,QAAQ,GAAG,GAAG,MAAML,KAAKC,OAAO,KAAK,OAAOD,KAAKM,WAAW;AAK5H,MAAMZ,kBAAkB,CAACM,MAAMG,UAAUA,QAAQC,MAAM,CAACJ,KAAKK,QAAQ,GAAG,GAAG,MAAML,KAAKM,WAAW;AAKjG,MAAMX,cAAc,CAACK,MAAMG,UAAUA,QAAQC,MAAM,CAACJ,KAAKK,QAAQ,GAAG;AAIpE,MAAMT,aAAa,CAACI,OAAOA,KAAKM,WAAW,GAAGJ,QAAQ;AAC1D,MAAML,4BAA4B;IACrCO,QAAQ;QACJ;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACH;IACDG,aAAa;QACT;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACH;IACDC,MAAM;QACF;QACA;QACA;QACA;QACA;QACA;QACA;KACH;IACDC,WAAW;QACP;QACA;QACA;QACA;QACA;QACA;QACA;KACH;AACL;AACO,MAAMX,0BAA0B;IACnCN;IACAG;IACAC;IACAH;IACAC;AACJ;AACO,MAAMK,2BAA2B;IACpC,GAAGF,yBAAyB;IAC5Ba,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;AACxB"}
1
+ {"version":3,"sources":["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":["DEFAULT_CALENDAR_STRINGS","DEFAULT_DATE_FORMATTING","DEFAULT_DATE_GRID_STRINGS","formatDay","formatMonth","formatMonthDayYear","formatMonthYear","formatYear","date","getDate","toString","strings","months","getMonth","getFullYear","shortMonths","days","shortDays","goToToday","weekNumberFormatString","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","prevYearRangeAriaLabel","nextYearRangeAriaLabel","closeButtonAriaLabel","selectedDateFormatString","todayDateFormatString","monthPickerHeaderAriaLabel","yearPickerHeaderAriaLabel","dayMarkedAriaLabel"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA;;;CAGC;;;;;;;;;;;IA4DYA,wBAAAA;eAAAA;;IARAC,uBAAAA;eAAAA;;IApB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AAoB;AACtB"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["dateFormatting.types.ts"],"sourcesContent":["export interface DateGridStrings {\n /**\n * An array of strings for the full names of months.\n * The array is 0-based, so months[0] should be the full name of January.\n */\n months: string[];\n\n /**\n * An array of strings for the short names of months.\n * The array is 0-based, so shortMonths[0] should be the short name of January.\n */\n shortMonths: string[];\n\n /**\n * An array of strings for the full names of days of the week.\n * The array is 0-based, so days[0] should be the full name of Sunday.\n */\n days: string[];\n\n /**\n * An array of strings for the initials of the days of the week.\n * The array is 0-based, so days[0] should be the initial of Sunday.\n */\n shortDays: string[];\n}\n\nexport interface DateFormatting {\n /**\n * Get a localized string for a day.\n */\n formatDay: (date: Date) => string;\n\n /**\n * Get a localized string for a month.\n */\n formatMonth: (date: Date, strings: DateGridStrings) => string;\n\n /**\n * Get a localized string for a year.\n */\n formatYear: (date: Date) => string;\n\n /**\n * Get a localized string for a month, day, and year.\n */\n formatMonthDayYear: (date: Date, strings: DateGridStrings) => string;\n\n /**\n * Get a localized string for a month and year.\n */\n formatMonthYear: (date: Date, strings: DateGridStrings) => string;\n}\n\nexport interface CalendarStrings extends DateGridStrings {\n /**\n * String to render for button to direct the user to today's date.\n */\n goToToday: string;\n\n /**\n * Aria-label for the \"previous month\" button in day picker.\n */\n prevMonthAriaLabel?: string;\n\n /**\n * Aria-label for the \"next month\" button in day picker.\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Aria-label for the \"previous year\" button in month picker.\n */\n prevYearAriaLabel?: string;\n\n /**\n * Aria-label for the \"next year\" button in month picker.\n */\n nextYearAriaLabel?: string;\n\n /**\n * Aria-label for the \"previous year range\" button in year picker.\n */\n prevYearRangeAriaLabel?: string;\n\n /**\n * Aria-label for the \"next year range\" button in year picker.\n */\n nextYearRangeAriaLabel?: string;\n\n /**\n * Aria-label format string for the header button in the month picker. Should have 1 string param, e.g. \"`{0}`,\n * select to change the year\". This aria-label will only be applied if the year picker is enabled; otherwise\n * the label will default to the header string, e.g. \"2019\".\n */\n monthPickerHeaderAriaLabel?: string;\n\n /**\n * Aria-label format string for the header button in the year picker.\n * Should have 1 string param, e.g. \"`{0}`, select to change the month\"\n */\n yearPickerHeaderAriaLabel?: string;\n\n /**\n * Aria-label for the \"close\" button.\n */\n closeButtonAriaLabel?: string;\n\n /**\n * Aria-label format string for the week number header. Should have 1 string param, e.g. \"week number `{0}`\"\n */\n weekNumberFormatString?: string;\n\n /**\n * Aria-label format string for the currently selected date. Should have 1 string param, e.g. \"Selected date `{0}`\"\n */\n selectedDateFormatString?: string;\n\n /**\n * Aria-label format string for today's date. Should have 1 string param, e.g. \"Today's date `{0}`\"\n */\n todayDateFormatString?: string;\n\n /**\n * Aria-label for when a date is marked\n */\n dayMarkedAriaLabel?: string;\n}\n"],"names":[],"rangeMappings":"","mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './dateFormatting.defaults';\nexport * from './dateFormatting.types';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './dateFormatting.defaults';\nexport * from './dateFormatting.types';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["dateGrid.types.ts"],"sourcesContent":["import { DayOfWeek, DateRangeType, FirstWeekOfYear } from '../constants';\n\nexport interface Day {\n /** `Date.toString()` value of current date */\n key: string;\n /** `Date.getDate()` value of current date */\n date: string;\n /** `Date` object of current date */\n originalDate: Date;\n /** Is current date is in the same month as \"today\" date */\n isInMonth: boolean;\n /** Is current date is \"today\" date */\n isToday: boolean;\n /** Is current date is selected in range */\n isSelected: boolean;\n /** Is current date is selected */\n isSingleSelected: boolean;\n /** Is current date within restriction boundaries */\n isInBounds: boolean;\n /** Is current date marked */\n isMarked: boolean;\n}\n\nexport interface AvailableDateOptions extends RestrictedDatesOptions {\n /** Date from which we start the search */\n initialDate: Date;\n /** Ideal available date */\n targetDate: Date;\n /** Direction of search (`1` - search in future / `-1` search in past) */\n direction: number;\n}\n\nexport interface RestrictedDatesOptions {\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n}\n\nexport interface DayGridOptions extends RestrictedDatesOptions {\n /**\n * The first day of the week for your locale.\n */\n firstDayOfWeek: DayOfWeek;\n\n /**\n * Defines when the first week of the year should start, FirstWeekOfYear.FirstDay,\n * FirstWeekOfYear.FirstFullWeek or FirstWeekOfYear.FirstFourDayWeek are the possible values\n */\n firstWeekOfYear: FirstWeekOfYear;\n\n /**\n * The date range type indicating how many days should be selected as the user\n * selects days\n */\n dateRangeType: DateRangeType;\n\n /**\n * The number of days to select while dateRangeType === DateRangeType.Day. Used in order to have multi-day\n * views.\n */\n daysToSelectInDayView?: number;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n */\n showWeekNumbers?: boolean;\n\n /**\n * The days that are selectable when `dateRangeType` is WorkWeek.\n * If `dateRangeType` is not WorkWeek this property does nothing.\n */\n workWeekDays?: DayOfWeek[];\n\n /**\n * Which days in the generated grid should be marked.\n */\n markedDays?: Date[];\n\n /**\n * The currently selected date\n */\n selectedDate: Date;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * How many weeks to show by default. If not provided, will show enough weeks to display the current\n * month, between 4 and 6 depending\n */\n weeksToShow?: number;\n}\n"],"names":[],"rangeMappings":"","mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["findAvailableDate.js"],"sourcesContent":["import { isRestrictedDate } from './isRestrictedDate';\nimport { isAfterMaxDate } from './isAfterMaxDate';\nimport { isBeforeMinDate } from './isBeforeMinDate';\nimport { compareDatePart, addDays } from '../dateMath/dateMath';\n/**\n * Returns closest available date given the restriction `options`, or undefined otherwise\n * @param options - list of search options\n */ export const findAvailableDate = (options)=>{\n const { targetDate, initialDate, direction, ...restrictedDateOptions } = options;\n let availableDate = targetDate;\n // if the target date is available, return it immediately\n if (!isRestrictedDate(targetDate, restrictedDateOptions)) {\n return targetDate;\n }\n while(compareDatePart(initialDate, availableDate) !== 0 && isRestrictedDate(availableDate, restrictedDateOptions) && !isAfterMaxDate(availableDate, restrictedDateOptions) && !isBeforeMinDate(availableDate, restrictedDateOptions)){\n availableDate = addDays(availableDate, direction);\n }\n if (compareDatePart(initialDate, availableDate) !== 0 && !isRestrictedDate(availableDate, restrictedDateOptions)) {\n return availableDate;\n }\n return undefined;\n};\n"],"names":["findAvailableDate","options","targetDate","initialDate","direction","restrictedDateOptions","availableDate","isRestrictedDate","compareDatePart","isAfterMaxDate","isBeforeMinDate","addDays","undefined"],"mappings":";;;;+BAOiBA;;;eAAAA;;;kCAPgB;gCACF;iCACC;0BACS;AAI9B,MAAMA,oBAAoB,CAACC;IAClC,MAAM,EAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAE,GAAGC,uBAAuB,GAAGJ;IACzE,IAAIK,gBAAgBJ;IACpB,yDAAyD;IACzD,IAAI,CAACK,IAAAA,kCAAgB,EAACL,YAAYG,wBAAwB;QACtD,OAAOH;IACX;IACA,MAAMM,IAAAA,yBAAe,EAACL,aAAaG,mBAAmB,KAAKC,IAAAA,kCAAgB,EAACD,eAAeD,0BAA0B,CAACI,IAAAA,8BAAc,EAACH,eAAeD,0BAA0B,CAACK,IAAAA,gCAAe,EAACJ,eAAeD,uBAAuB;QACjOC,gBAAgBK,IAAAA,iBAAO,EAACL,eAAeF;IAC3C;IACA,IAAII,IAAAA,yBAAe,EAACL,aAAaG,mBAAmB,KAAK,CAACC,IAAAA,kCAAgB,EAACD,eAAeD,wBAAwB;QAC9G,OAAOC;IACX;IACA,OAAOM;AACX"}
1
+ {"version":3,"sources":["findAvailableDate.ts"],"sourcesContent":["import { AvailableDateOptions } from './dateGrid.types';\n\nimport { isRestrictedDate } from './isRestrictedDate';\n\nimport { isAfterMaxDate } from './isAfterMaxDate';\n\nimport { isBeforeMinDate } from './isBeforeMinDate';\nimport { compareDatePart, addDays } from '../dateMath/dateMath';\n\n/**\n * Returns closest available date given the restriction `options`, or undefined otherwise\n * @param options - list of search options\n */\nexport const findAvailableDate = (options: AvailableDateOptions): Date | undefined => {\n const { targetDate, initialDate, direction, ...restrictedDateOptions } = options;\n let availableDate = targetDate;\n // if the target date is available, return it immediately\n if (!isRestrictedDate(targetDate, restrictedDateOptions)) {\n return targetDate;\n }\n\n while (\n compareDatePart(initialDate, availableDate) !== 0 &&\n isRestrictedDate(availableDate, restrictedDateOptions) &&\n !isAfterMaxDate(availableDate, restrictedDateOptions) &&\n !isBeforeMinDate(availableDate, restrictedDateOptions)\n ) {\n availableDate = addDays(availableDate, direction);\n }\n\n if (compareDatePart(initialDate, availableDate) !== 0 && !isRestrictedDate(availableDate, restrictedDateOptions)) {\n return availableDate;\n }\n\n return undefined;\n};\n"],"names":["findAvailableDate","options","targetDate","initialDate","direction","restrictedDateOptions","availableDate","isRestrictedDate","compareDatePart","isAfterMaxDate","isBeforeMinDate","addDays","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;kCAXoB;gCAEF;iCAEC;0BACS;AAMlC,MAAMA,oBAAoB,CAACC;IAChC,MAAM,EAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAE,GAAGC,uBAAuB,GAAGJ;IACzE,IAAIK,gBAAgBJ;IACpB,yDAAyD;IACzD,IAAI,CAACK,IAAAA,kCAAAA,EAAiBL,YAAYG,wBAAwB;QACxD,OAAOH;IACT;IAEA,MACEM,IAAAA,yBAAAA,EAAgBL,aAAaG,mBAAmB,KAChDC,IAAAA,kCAAAA,EAAiBD,eAAeD,0BAChC,CAACI,IAAAA,8BAAAA,EAAeH,eAAeD,0BAC/B,CAACK,IAAAA,gCAAAA,EAAgBJ,eAAeD,uBAChC;QACAC,gBAAgBK,IAAAA,iBAAAA,EAAQL,eAAeF;IACzC;IAEA,IAAII,IAAAA,yBAAAA,EAAgBL,aAAaG,mBAAmB,KAAK,CAACC,IAAAA,kCAAAA,EAAiBD,eAAeD,wBAAwB;QAChH,OAAOC;IACT;IAEA,OAAOM;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["getBoundedDateRange.js"],"sourcesContent":["import { compareDatePart } from '../dateMath/dateMath';\n/**\n * Generates a list of dates, bounded by min and max dates\n * @param dateRange - input date range\n * @param minDate - min date to limit the range\n * @param maxDate - max date to limit the range\n */ export const getBoundedDateRange = (dateRange, minDate, maxDate)=>{\n let boundedDateRange = [\n ...dateRange\n ];\n if (minDate) {\n boundedDateRange = boundedDateRange.filter((date)=>compareDatePart(date, minDate) >= 0);\n }\n if (maxDate) {\n boundedDateRange = boundedDateRange.filter((date)=>compareDatePart(date, maxDate) <= 0);\n }\n return boundedDateRange;\n};\n"],"names":["getBoundedDateRange","dateRange","minDate","maxDate","boundedDateRange","filter","date","compareDatePart"],"mappings":";;;;+BAMiBA;;;eAAAA;;;0BANe;AAMrB,MAAMA,sBAAsB,CAACC,WAAWC,SAASC;IACxD,IAAIC,mBAAmB;WAChBH;KACN;IACD,IAAIC,SAAS;QACTE,mBAAmBA,iBAAiBC,MAAM,CAAC,CAACC,OAAOC,IAAAA,yBAAe,EAACD,MAAMJ,YAAY;IACzF;IACA,IAAIC,SAAS;QACTC,mBAAmBA,iBAAiBC,MAAM,CAAC,CAACC,OAAOC,IAAAA,yBAAe,EAACD,MAAMH,YAAY;IACzF;IACA,OAAOC;AACX"}
1
+ {"version":3,"sources":["getBoundedDateRange.ts"],"sourcesContent":["import { compareDatePart } from '../dateMath/dateMath';\n\n/**\n * Generates a list of dates, bounded by min and max dates\n * @param dateRange - input date range\n * @param minDate - min date to limit the range\n * @param maxDate - max date to limit the range\n */\nexport const getBoundedDateRange = (dateRange: Date[], minDate?: Date, maxDate?: Date): Date[] => {\n let boundedDateRange = [...dateRange];\n if (minDate) {\n boundedDateRange = boundedDateRange.filter((date: Date) => compareDatePart(date, minDate as Date) >= 0);\n }\n if (maxDate) {\n boundedDateRange = boundedDateRange.filter((date: Date) => compareDatePart(date, maxDate as Date) <= 0);\n }\n return boundedDateRange;\n};\n"],"names":["getBoundedDateRange","dateRange","minDate","maxDate","boundedDateRange","filter","date","compareDatePart"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;0BARmB;AAQzB,MAAMA,sBAAsB,CAACC,WAAmBC,SAAgBC;IACrE,IAAIC,mBAAmB;WAAIH;KAAU;IACrC,IAAIC,SAAS;QACXE,mBAAmBA,iBAAiBC,MAAM,CAAC,CAACC,OAAeC,IAAAA,yBAAAA,EAAgBD,MAAMJ,YAAoB;IACvG;IACA,IAAIC,SAAS;QACXC,mBAAmBA,iBAAiBC,MAAM,CAAC,CAACC,OAAeC,IAAAA,yBAAAA,EAAgBD,MAAMH,YAAoB;IACvG;IACA,OAAOC;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["getDateRangeTypeToUse.js"],"sourcesContent":["import { DateRangeType } from '../constants';\nimport { isContiguous } from './isContiguous';\n/**\n * Return corrected date range type, given `dateRangeType` and list of working days.\n * For non-contiguous working days and working week range type, returns general week range type.\n * For other cases returns input date range type.\n * @param dateRangeType - input type of range\n * @param workWeekDays - list of working days in a week\n */ export const getDateRangeTypeToUse = (dateRangeType, workWeekDays, firstDayOfWeek)=>{\n if (workWeekDays && dateRangeType === DateRangeType.WorkWeek) {\n if (!isContiguous(workWeekDays, true, firstDayOfWeek) || workWeekDays.length === 0) {\n return DateRangeType.Week;\n }\n }\n return dateRangeType;\n};\n"],"names":["getDateRangeTypeToUse","dateRangeType","workWeekDays","firstDayOfWeek","DateRangeType","WorkWeek","isContiguous","length","Week"],"mappings":";;;;+BAQiBA;;;eAAAA;;;2BARa;8BACD;AAOlB,MAAMA,wBAAwB,CAACC,eAAeC,cAAcC;IACnE,IAAID,gBAAgBD,kBAAkBG,wBAAa,CAACC,QAAQ,EAAE;QAC1D,IAAI,CAACC,IAAAA,0BAAY,EAACJ,cAAc,MAAMC,mBAAmBD,aAAaK,MAAM,KAAK,GAAG;YAChF,OAAOH,wBAAa,CAACI,IAAI;QAC7B;IACJ;IACA,OAAOP;AACX"}
1
+ {"version":3,"sources":["getDateRangeTypeToUse.ts"],"sourcesContent":["import { DateRangeType, DayOfWeek } from '../constants';\nimport { isContiguous } from './isContiguous';\n/**\n * Return corrected date range type, given `dateRangeType` and list of working days.\n * For non-contiguous working days and working week range type, returns general week range type.\n * For other cases returns input date range type.\n * @param dateRangeType - input type of range\n * @param workWeekDays - list of working days in a week\n */\nexport const getDateRangeTypeToUse = (\n dateRangeType: DateRangeType,\n workWeekDays: DayOfWeek[] | undefined,\n firstDayOfWeek: DayOfWeek,\n): DateRangeType => {\n if (workWeekDays && dateRangeType === DateRangeType.WorkWeek) {\n if (!isContiguous(workWeekDays, true, firstDayOfWeek) || workWeekDays.length === 0) {\n return DateRangeType.Week;\n }\n }\n\n return dateRangeType;\n};\n"],"names":["getDateRangeTypeToUse","dateRangeType","workWeekDays","firstDayOfWeek","DateRangeType","WorkWeek","isContiguous","length","Week"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;2BAT4B;8BACZ;AAQtB,MAAMA,wBAAwB,CACnCC,eACAC,cACAC;IAEA,IAAID,gBAAgBD,kBAAkBG,wBAAAA,CAAcC,QAAQ,EAAE;QAC5D,IAAI,CAACC,IAAAA,0BAAAA,EAAaJ,cAAc,MAAMC,mBAAmBD,aAAaK,MAAM,KAAK,GAAG;YAClF,OAAOH,wBAAAA,CAAcI,IAAI;QAC3B;IACF;IAEA,OAAOP;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["getDayGrid.js"],"sourcesContent":["import { addDays, compareDates, getDateRangeArray, isInDateRangeArray } from '../dateMath/dateMath';\nimport { DAYS_IN_WEEK } from '../constants';\nimport { getDateRangeTypeToUse } from './getDateRangeTypeToUse';\nimport { getBoundedDateRange } from './getBoundedDateRange';\nimport { isRestrictedDate } from './isRestrictedDate';\n/**\n * Generates a grid of days, given the `options`.\n * Returns one additional week at the begining from the previous range\n * and one at the end from the future range\n * @param options - parameters to specify date related restrictions for the resulting grid\n */ export const getDayGrid = (options)=>{\n const { selectedDate, dateRangeType, firstDayOfWeek, today, minDate, maxDate, weeksToShow, workWeekDays, daysToSelectInDayView, restrictedDates, markedDays } = options;\n const restrictedDateOptions = {\n minDate,\n maxDate,\n restrictedDates\n };\n const todaysDate = today || new Date();\n const navigatedDate = options.navigatedDate ? options.navigatedDate : todaysDate;\n let date;\n if (weeksToShow && weeksToShow <= 4) {\n // if showing less than a full month, just use date == navigatedDate\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), navigatedDate.getDate());\n } else {\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), 1);\n }\n const weeks = [];\n // Cycle the date backwards to get to the first day of the week.\n while(date.getDay() !== firstDayOfWeek){\n date.setDate(date.getDate() - 1);\n }\n // add the transition week as last week of previous range\n date = addDays(date, -DAYS_IN_WEEK);\n // a flag to indicate whether all days of the week are outside the month\n let isAllDaysOfWeekOutOfMonth = false;\n // in work week view if the days aren't contiguous we use week view instead\n const selectedDateRangeType = getDateRangeTypeToUse(dateRangeType, workWeekDays, firstDayOfWeek);\n let selectedDates = [];\n if (selectedDate) {\n selectedDates = getDateRangeArray(selectedDate, selectedDateRangeType, firstDayOfWeek, workWeekDays, daysToSelectInDayView);\n selectedDates = getBoundedDateRange(selectedDates, minDate, maxDate);\n }\n let shouldGetWeeks = true;\n for(let weekIndex = 0; shouldGetWeeks; weekIndex++){\n const week = [];\n isAllDaysOfWeekOutOfMonth = true;\n for(let dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++){\n const originalDate = new Date(date.getTime());\n const dayInfo = {\n key: date.toString(),\n date: date.getDate().toString(),\n originalDate,\n isInMonth: date.getMonth() === navigatedDate.getMonth(),\n isToday: compareDates(todaysDate, date),\n isSelected: isInDateRangeArray(date, selectedDates),\n isSingleSelected: selectedDates.length === 1 && compareDates(date, selectedDate),\n isInBounds: !isRestrictedDate(date, restrictedDateOptions),\n isMarked: (markedDays === null || markedDays === void 0 ? void 0 : markedDays.some((markedDay)=>compareDates(originalDate, markedDay))) || false\n };\n week.push(dayInfo);\n if (dayInfo.isInMonth) {\n isAllDaysOfWeekOutOfMonth = false;\n }\n date.setDate(date.getDate() + 1);\n }\n // We append the condition of the loop depending upon the showSixWeeksByDefault prop.\n shouldGetWeeks = weeksToShow ? weekIndex < weeksToShow + 1 : !isAllDaysOfWeekOutOfMonth || weekIndex === 0;\n // we don't check shouldGetWeeks before pushing because we want to add one extra week for transition state\n weeks.push(week);\n }\n return weeks;\n};\n"],"names":["getDayGrid","options","selectedDate","dateRangeType","firstDayOfWeek","today","minDate","maxDate","weeksToShow","workWeekDays","daysToSelectInDayView","restrictedDates","markedDays","restrictedDateOptions","todaysDate","Date","navigatedDate","date","getFullYear","getMonth","getDate","weeks","getDay","setDate","addDays","DAYS_IN_WEEK","isAllDaysOfWeekOutOfMonth","selectedDateRangeType","getDateRangeTypeToUse","selectedDates","getDateRangeArray","getBoundedDateRange","shouldGetWeeks","weekIndex","week","dayIndex","originalDate","getTime","dayInfo","key","toString","isInMonth","isToday","compareDates","isSelected","isInDateRangeArray","isSingleSelected","length","isInBounds","isRestrictedDate","isMarked","some","markedDay","push"],"mappings":";;;;+BAUiBA;;;eAAAA;;;0BAV4D;2BAChD;uCACS;qCACF;kCACH;AAMtB,MAAMA,aAAa,CAACC;IAC3B,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAEC,cAAc,EAAEC,KAAK,EAAEC,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AKuB,QAAQ;gBAClBvB,MAAMA,KAAKG,OAAO,GAAGoB,QAAQ;gBAC7BJ;gBACAK,WAAWxB,KAAKE,QAAQ,OAAOH,cAAcG,QAAQ;gBACrDuB,SAASC,IAAAA,sBAAY,EAAC7B,YAAYG;gBAClC2B,YAAYC,IAAAA,4BAAkB,EAAC5B,MAAMY;gBACrCiB,kBAAkBjB,cAAckB,MAAM,KAAK,KAAKJ,IAAAA,sBAAY,EAAC1B,MAAMf;gBACnE8C,YAAY,CAACC,IAAAA,kCAAgB,EAAChC,MAAMJ;gBACpCqC,UAAU,AAACtC,CAAAA,eAAe,QAAQA,eAAe,KAAK,IAAI,KAAK,IAAIA,WAAWuC,IAAI,CAAC,CAACC,YAAYT,IAAAA,sBAAY,EAACP,cAAcgB,WAAU,KAAM;YAC/I;YACAlB,KAAKmB,IAAI,CAACf;YACV,IAAIA,QAAQG,SAAS,EAAE;gBACnBf,4BAA4B;YAChC;YACAT,KAAKM,OAAO,CAACN,KAAKG,OAAO,KAAK;QAClC;QACA,qFAAqF;QACrFY,iBAAiBxB,cAAcyB,YAAYzB,cAAc,IAAI,CAACkB,6BAA6BO,cAAc;QACzG,0GAA0G;QAC1GZ,MAAMgC,IAAI,CAACnB;IACf;IACA,OAAOb;AACX"}
1
+ {"version":3,"sources":["getDayGrid.ts"],"sourcesContent":["import { addDays, compareDates, getDateRangeArray, isInDateRangeArray } from '../dateMath/dateMath';\nimport { DAYS_IN_WEEK } from '../constants';\nimport { Day, DayGridOptions } from './dateGrid.types';\nimport { getDateRangeTypeToUse } from './getDateRangeTypeToUse';\nimport { getBoundedDateRange } from './getBoundedDateRange';\nimport { isRestrictedDate } from './isRestrictedDate';\n\n/**\n * Generates a grid of days, given the `options`.\n * Returns one additional week at the begining from the previous range\n * and one at the end from the future range\n * @param options - parameters to specify date related restrictions for the resulting grid\n */\nexport const getDayGrid = (options: DayGridOptions): Day[][] => {\n const {\n selectedDate,\n dateRangeType,\n firstDayOfWeek,\n today,\n minDate,\n maxDate,\n weeksToShow,\n workWeekDays,\n daysToSelectInDayView,\n restrictedDates,\n markedDays,\n } = options;\n const restrictedDateOptions = { minDate, maxDate, restrictedDates };\n\n const todaysDate = today || new Date();\n\n const navigatedDate = options.navigatedDate ? options.navigatedDate : todaysDate;\n\n let date;\n if (weeksToShow && weeksToShow <= 4) {\n // if showing less than a full month, just use date == navigatedDate\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), navigatedDate.getDate());\n } else {\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), 1);\n }\n const weeks: Day[][] = [];\n\n // Cycle the date backwards to get to the first day of the week.\n while (date.getDay() !== firstDayOfWeek) {\n date.setDate(date.getDate() - 1);\n }\n\n // add the transition week as last week of previous range\n date = addDays(date, -DAYS_IN_WEEK);\n\n // a flag to indicate whether all days of the week are outside the month\n let isAllDaysOfWeekOutOfMonth = false;\n\n // in work week view if the days aren't contiguous we use week view instead\n const selectedDateRangeType = getDateRangeTypeToUse(dateRangeType, workWeekDays, firstDayOfWeek);\n\n let selectedDates: Date[] = [];\n\n if (selectedDate) {\n selectedDates = getDateRangeArray(\n selectedDate,\n selectedDateRangeType,\n firstDayOfWeek,\n workWeekDays,\n daysToSelectInDayView,\n );\n selectedDates = getBoundedDateRange(selectedDates, minDate, maxDate);\n }\n\n let shouldGetWeeks = true;\n\n for (let weekIndex = 0; shouldGetWeeks; weekIndex++) {\n const week: Day[] = [];\n\n isAllDaysOfWeekOutOfMonth = true;\n\n for (let dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++) {\n const originalDate = new Date(date.getTime());\n const dayInfo: Day = {\n key: date.toString(),\n date: date.getDate().toString(),\n originalDate,\n isInMonth: date.getMonth() === navigatedDate.getMonth(),\n isToday: compareDates(todaysDate, date),\n isSelected: isInDateRangeArray(date, selectedDates),\n isSingleSelected: selectedDates.length === 1 && compareDates(date, selectedDate),\n isInBounds: !isRestrictedDate(date, restrictedDateOptions),\n isMarked: markedDays?.some((markedDay: Date) => compareDates(originalDate, markedDay)) || false,\n };\n\n week.push(dayInfo);\n\n if (dayInfo.isInMonth) {\n isAllDaysOfWeekOutOfMonth = false;\n }\n\n date.setDate(date.getDate() + 1);\n }\n\n // We append the condition of the loop depending upon the showSixWeeksByDefault prop.\n shouldGetWeeks = weeksToShow ? weekIndex < weeksToShow + 1 : !isAllDaysOfWeekOutOfMonth || weekIndex === 0;\n\n // we don't check shouldGetWeeks before pushing because we want to add one extra week for transition state\n weeks.push(week);\n }\n\n return weeks;\n};\n"],"names":["getDayGrid","options","selectedDate","dateRangeType","firstDayOfWeek","today","minDate","maxDate","weeksToShow","workWeekDays","daysToSelectInDayView","restrictedDates","markedDays","restrictedDateOptions","todaysDate","Date","navigatedDate","date","getFullYear","getMonth","getDate","weeks","getDay","setDate","addDays","DAYS_IN_WEEK","isAllDaysOfWeekOutOfMonth","selectedDateRangeType","getDateRangeTypeToUse","selectedDates","getDateRangeArray","getBoundedDateRange","shouldGetWeeks","weekIndex","week","dayIndex","originalDate","getTime","dayInfo","key","toString","isInMonth","isToday","compareDates","isSelected","isInDateRangeArray","isSingleSelected","length","isInBounds","isRestrictedDate","isMarked","some","markedDay","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;0BAbgE;2BAChD;uCAES;qCACF;kCACH;AAQ1B,MAAMA,aAAa,CAACC;IACzB,MAAM,EACJC,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,OAAO,EACPC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,qBAAqB,EACrBC,eAAe,EACfC,UAAU,EACX,GAAGX;IACJ,MAAMY,wBAAwB;QAAEP;QAASC;QAASI;IAAgB;IAElE,MAAMG,aAAaT,SAAS,IAAIU;IAEhC,MAAMC,gBAAgBf,QAAQe,aAAa,GAAGf,QAAQe,aAAa,GA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CiB,kBAAkBjB,cAAckB,MAAM,KAAK,KAAKJ,IAAAA,sBAAAA,EAAa1B,MAAMf;gBACnE8C,YAAY,CAACC,IAAAA,kCAAAA,EAAiBhC,MAAMJ;gBACpCqC,UAAUtC,CAAAA,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,KAAAA,IAAAA,WAAYuC,IAAI,CAAC,CAACC,YAAoBT,IAAAA,sBAAAA,EAAaP,cAAcgB,WAAAA,KAAe;YAC5F;YAEAlB,KAAKmB,IAAI,CAACf;YAEV,IAAIA,QAAQG,SAAS,EAAE;gBACrBf,4BAA4B;YAC9B;YAEAT,KAAKM,OAAO,CAACN,KAAKG,OAAO,KAAK;QAChC;QAEA,qFAAqF;QACrFY,iBAAiBxB,cAAcyB,YAAYzB,cAAc,IAAI,CAACkB,6BAA6BO,cAAc;QAEzG,0GAA0G;QAC1GZ,MAAMgC,IAAI,CAACnB;IACb;IAEA,OAAOb;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './dateGrid.types';\nexport * from './findAvailableDate';\nexport * from './getBoundedDateRange';\nexport * from './getDayGrid';\nexport * from './isRestrictedDate';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './dateGrid.types';\nexport * from './findAvailableDate';\nexport * from './getBoundedDateRange';\nexport * from './getDayGrid';\nexport * from './isRestrictedDate';\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["isAfterMaxDate.js"],"sourcesContent":["import { compareDatePart } from '../dateMath/dateMath';\n/**\n * Checks if `date` happens later than max date\n * @param date - date to check\n * @param options - object with max date to check against\n */ export const isAfterMaxDate = (date, options)=>{\n const { maxDate } = options;\n return maxDate ? compareDatePart(date, maxDate) >= 1 : false;\n};\n"],"names":["isAfterMaxDate","date","options","maxDate","compareDatePart"],"mappings":";;;;+BAKiBA;;;eAAAA;;;0BALe;AAKrB,MAAMA,iBAAiB,CAACC,MAAMC;IACrC,MAAM,EAAEC,OAAO,EAAE,GAAGD;IACpB,OAAOC,UAAUC,IAAAA,yBAAe,EAACH,MAAME,YAAY,IAAI;AAC3D"}
1
+ {"version":3,"sources":["isAfterMaxDate.ts"],"sourcesContent":["import { RestrictedDatesOptions } from './dateGrid.types';\nimport { compareDatePart } from '../dateMath/dateMath';\n\n/**\n * Checks if `date` happens later than max date\n * @param date - date to check\n * @param options - object with max date to check against\n */\nexport const isAfterMaxDate = (date: Date, options: RestrictedDatesOptions): boolean => {\n const { maxDate } = options;\n return maxDate ? compareDatePart(date, maxDate) >= 1 : false;\n};\n"],"names":["isAfterMaxDate","date","options","maxDate","compareDatePart"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;0BAPmB;AAOzB,MAAMA,iBAAiB,CAACC,MAAYC;IACzC,MAAM,EAAEC,OAAO,EAAE,GAAGD;IACpB,OAAOC,UAAUC,IAAAA,yBAAAA,EAAgBH,MAAME,YAAY,IAAI;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["isBeforeMinDate.js"],"sourcesContent":["import { compareDatePart } from '../dateMath/dateMath';\n/**\n * Checks if `date` happens earlier than min date\n * @param date - date to check\n * @param options - object with min date to check against\n */ export const isBeforeMinDate = (date, options)=>{\n const { minDate } = options;\n return minDate ? compareDatePart(minDate, date) >= 1 : false;\n};\n"],"names":["isBeforeMinDate","date","options","minDate","compareDatePart"],"mappings":";;;;+BAKiBA;;;eAAAA;;;0BALe;AAKrB,MAAMA,kBAAkB,CAACC,MAAMC;IACtC,MAAM,EAAEC,OAAO,EAAE,GAAGD;IACpB,OAAOC,UAAUC,IAAAA,yBAAe,EAACD,SAASF,SAAS,IAAI;AAC3D"}
1
+ {"version":3,"sources":["isBeforeMinDate.ts"],"sourcesContent":["import { RestrictedDatesOptions } from './dateGrid.types';\nimport { compareDatePart } from '../dateMath/dateMath';\n\n/**\n * Checks if `date` happens earlier than min date\n * @param date - date to check\n * @param options - object with min date to check against\n */\nexport const isBeforeMinDate = (date: Date, options: RestrictedDatesOptions): boolean => {\n const { minDate } = options;\n return minDate ? compareDatePart(minDate, date) >= 1 : false;\n};\n"],"names":["isBeforeMinDate","date","options","minDate","compareDatePart"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;0BAPmB;AAOzB,MAAMA,kBAAkB,CAACC,MAAYC;IAC1C,MAAM,EAAEC,OAAO,EAAE,GAAGD;IACpB,OAAOC,UAAUC,IAAAA,yBAAAA,EAAgBD,SAASF,SAAS,IAAI;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["isContiguous.js"],"sourcesContent":["/**\n * Returns whether provided week days are contiguous.\n * @param days - list of days in a week\n * @param isSingleWeek - decides whether the contiguous logic applies across week boundaries or not\n * @param firstDayOfWeek - decides which day of week is the first one in the order.\n */ export const isContiguous = (days, isSingleWeek, firstDayOfWeek)=>{\n const daySet = new Set(days);\n let amountOfNoNeighbors = 0;\n for (const day of days){\n const nextDay = (day + 1) % 7;\n if (!(daySet.has(nextDay) && (!isSingleWeek || firstDayOfWeek !== nextDay))) {\n amountOfNoNeighbors++;\n }\n }\n // In case the full week is provided, then each day has a neighbor\n //, otherwise the last day does not have a neighbor.\n return amountOfNoNeighbors < 2;\n};\n"],"names":["isContiguous","days","isSingleWeek","firstDayOfWeek","daySet","Set","amountOfNoNeighbors","day","nextDay","has"],"mappings":"AAAA;;;;;CAKC;;;;+BAAgBA;;;eAAAA;;;AAAN,MAAMA,eAAe,CAACC,MAAMC,cAAcC;IACjD,MAAMC,SAAS,IAAIC,IAAIJ;IACvB,IAAIK,sBAAsB;IAC1B,KAAK,MAAMC,OAAON,KAAK;QACnB,MAAMO,UAAU,AAACD,CAAAA,MAAM,CAAA,IAAK;QAC5B,IAAI,CAAEH,CAAAA,OAAOK,GAAG,CAACD,YAAa,CAAA,CAACN,gBAAgBC,mBAAmBK,OAAM,CAAC,GAAI;YACzEF;QACJ;IACJ;IACA,kEAAkE;IAClE,oDAAoD;IACpD,OAAOA,sBAAsB;AACjC"}
1
+ {"version":3,"sources":["isContiguous.ts"],"sourcesContent":["import { DayOfWeek } from '../constants';\n\n/**\n * Returns whether provided week days are contiguous.\n * @param days - list of days in a week\n * @param isSingleWeek - decides whether the contiguous logic applies across week boundaries or not\n * @param firstDayOfWeek - decides which day of week is the first one in the order.\n */\nexport const isContiguous = (days: DayOfWeek[], isSingleWeek: boolean, firstDayOfWeek: DayOfWeek): boolean => {\n const daySet = new Set(days);\n let amountOfNoNeighbors = 0;\n for (const day of days) {\n const nextDay = (day + 1) % 7;\n if (!(daySet.has(nextDay) && (!isSingleWeek || firstDayOfWeek !== nextDay))) {\n amountOfNoNeighbors++;\n }\n }\n\n // In case the full week is provided, then each day has a neighbor\n //, otherwise the last day does not have a neighbor.\n return amountOfNoNeighbors < 2;\n};\n"],"names":["isContiguous","days","isSingleWeek","firstDayOfWeek","daySet","Set","amountOfNoNeighbors","day","nextDay","has"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA;;;;;CAKC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,eAAe,CAACC,MAAmBC,cAAuBC;IACrE,MAAMC,SAAS,IAAIC,IAAIJ;IACvB,IAAIK,sBAAsB;IAC1B,KAAK,MAAMC,OAAON,KAAM;QACtB,MAAMO,UAAU,AAACD,CAAAA,MAAM,CAAA,IAAK;QAC5B,IAAI,CAAEH,CAAAA,OAAOK,GAAG,CAACD,YAAa,CAAA,CAACN,gBAAgBC,mBAAmBK,OAAAA,CAAM,GAAK;YAC3EF;QACF;IACF;IAEA,kEAAkE;IAClE,oDAAoD;IACpD,OAAOA,sBAAsB;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["isRestrictedDate.js"],"sourcesContent":["import { compareDates } from '../dateMath/dateMath';\nimport { isBeforeMinDate } from './isBeforeMinDate';\nimport { isAfterMaxDate } from './isAfterMaxDate';\n/**\n * Checks if `date` falls into the restricted `options`\n * @param date - date to check\n * @param options - restriction options (min date, max date and list of restricted dates)\n */ export const isRestrictedDate = (date, options)=>{\n const { restrictedDates, minDate, maxDate } = options;\n if (!restrictedDates && !minDate && !maxDate) {\n return false;\n }\n const inRestrictedDates = restrictedDates && restrictedDates.some((rd)=>compareDates(rd, date));\n return inRestrictedDates || isBeforeMinDate(date, options) || isAfterMaxDate(date, options);\n};\n"],"names":["isRestrictedDate","date","options","restrictedDates","minDate","maxDate","inRestrictedDates","some","rd","compareDates","isBeforeMinDate","isAfterMaxDate"],"mappings":";;;;+BAOiBA;;;eAAAA;;;0BAPY;iCACG;gCACD;AAKpB,MAAMA,mBAAmB,CAACC,MAAMC;IACvC,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGH;IAC9C,IAAI,CAACC,mBAAmB,CAACC,WAAW,CAACC,SAAS;QAC1C,OAAO;IACX;IACA,MAAMC,oBAAoBH,mBAAmBA,gBAAgBI,IAAI,CAAC,CAACC,KAAKC,IAAAA,sBAAY,EAACD,IAAIP;IACzF,OAAOK,qBAAqBI,IAAAA,gCAAe,EAACT,MAAMC,YAAYS,IAAAA,8BAAc,EAACV,MAAMC;AACvF"}
1
+ {"version":3,"sources":["isRestrictedDate.ts"],"sourcesContent":["import { RestrictedDatesOptions } from './dateGrid.types';\nimport { compareDates } from '../dateMath/dateMath';\nimport { isBeforeMinDate } from './isBeforeMinDate';\nimport { isAfterMaxDate } from './isAfterMaxDate';\n\n/**\n * Checks if `date` falls into the restricted `options`\n * @param date - date to check\n * @param options - restriction options (min date, max date and list of restricted dates)\n */\nexport const isRestrictedDate = (date: Date, options: RestrictedDatesOptions): boolean => {\n const { restrictedDates, minDate, maxDate } = options;\n if (!restrictedDates && !minDate && !maxDate) {\n return false;\n }\n const inRestrictedDates = restrictedDates && restrictedDates.some((rd: Date) => compareDates(rd, date));\n return inRestrictedDates || isBeforeMinDate(date, options) || isAfterMaxDate(date, options);\n};\n"],"names":["isRestrictedDate","date","options","restrictedDates","minDate","maxDate","inRestrictedDates","some","rd","compareDates","isBeforeMinDate","isAfterMaxDate"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;0BATgB;iCACG;gCACD;AAOxB,MAAMA,mBAAmB,CAACC,MAAYC;IAC3C,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGH;IAC9C,IAAI,CAACC,mBAAmB,CAACC,WAAW,CAACC,SAAS;QAC5C,OAAO;IACT;IACA,MAAMC,oBAAoBH,mBAAmBA,gBAAgBI,IAAI,CAAC,CAACC,KAAaC,IAAAA,sBAAAA,EAAaD,IAAIP;IACjG,OAAOK,qBAAqBI,IAAAA,gCAAAA,EAAgBT,MAAMC,YAAYS,IAAAA,8BAAAA,EAAeV,MAAMC;AACrF"}
@@ -12,56 +12,56 @@ _export(exports, {
12
12
  addDays: function() {
13
13
  return addDays;
14
14
  },
15
- addWeeks: function() {
16
- return addWeeks;
17
- },
18
15
  addMonths: function() {
19
16
  return addMonths;
20
17
  },
18
+ addWeeks: function() {
19
+ return addWeeks;
20
+ },
21
21
  addYears: function() {
22
22
  return addYears;
23
23
  },
24
- getMonthStart: function() {
25
- return getMonthStart;
26
- },
27
- getMonthEnd: function() {
28
- return getMonthEnd;
29
- },
30
- getYearStart: function() {
31
- return getYearStart;
32
- },
33
- getYearEnd: function() {
34
- return getYearEnd;
35
- },
36
- setMonth: function() {
37
- return setMonth;
24
+ compareDatePart: function() {
25
+ return compareDatePart;
38
26
  },
39
27
  compareDates: function() {
40
28
  return compareDates;
41
29
  },
42
- compareDatePart: function() {
43
- return compareDatePart;
30
+ getDatePartHashValue: function() {
31
+ return getDatePartHashValue;
44
32
  },
45
33
  getDateRangeArray: function() {
46
34
  return getDateRangeArray;
47
35
  },
48
- isInDateRangeArray: function() {
49
- return isInDateRangeArray;
36
+ getEndDateOfWeek: function() {
37
+ return getEndDateOfWeek;
50
38
  },
51
- getWeekNumbersInMonth: function() {
52
- return getWeekNumbersInMonth;
39
+ getMonthEnd: function() {
40
+ return getMonthEnd;
53
41
  },
54
- getWeekNumber: function() {
55
- return getWeekNumber;
42
+ getMonthStart: function() {
43
+ return getMonthStart;
56
44
  },
57
45
  getStartDateOfWeek: function() {
58
46
  return getStartDateOfWeek;
59
47
  },
60
- getEndDateOfWeek: function() {
61
- return getEndDateOfWeek;
48
+ getWeekNumber: function() {
49
+ return getWeekNumber;
62
50
  },
63
- getDatePartHashValue: function() {
64
- return getDatePartHashValue;
51
+ getWeekNumbersInMonth: function() {
52
+ return getWeekNumbersInMonth;
53
+ },
54
+ getYearEnd: function() {
55
+ return getYearEnd;
56
+ },
57
+ getYearStart: function() {
58
+ return getYearStart;
59
+ },
60
+ isInDateRangeArray: function() {
61
+ return isInDateRangeArray;
62
+ },
63
+ setMonth: function() {
64
+ return setMonth;
65
65
  }
66
66
  });
67
67
  const _constants = require("../constants");
@@ -1 +1 @@
1
- {"version":3,"sources":["dateMath.js"],"sourcesContent":["import { DateRangeType, DayOfWeek, FirstWeekOfYear, MonthOfYear, TimeConstants } from '../constants';\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 */ export function addDays(date, days) {\n const result = new Date(date.getTime());\n result.setDate(result.getDate() + days);\n return result;\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 */ export function addWeeks(date, weeks) {\n return addDays(date, weeks * TimeConstants.DaysInOneWeek);\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 */ export function addMonths(date, months) {\n let result = new Date(date.getTime());\n const newMonth = result.getMonth() + months;\n result.setMonth(newMonth);\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 (result.getMonth() !== (newMonth % TimeConstants.MonthInOneYear + TimeConstants.MonthInOneYear) % TimeConstants.MonthInOneYear) {\n result = addDays(result, -result.getDate());\n }\n return result;\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 */ export function addYears(date, years) {\n let result = new Date(date.getTime());\n result.setFullYear(date.getFullYear() + years);\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 (result.getMonth() !== (date.getMonth() % TimeConstants.MonthInOneYear + TimeConstants.MonthInOneYear) % TimeConstants.MonthInOneYear) {\n result = addDays(result, -result.getDate());\n }\n return result;\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 */ export function getMonthStart(date) {\n return new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0);\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 */ export function getMonthEnd(date) {\n return new Date(date.getFullYear(), date.getMonth() + 1, 0, 0, 0, 0, 0);\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 */ export function getYearStart(date) {\n return new Date(date.getFullYear(), 0, 1, 0, 0, 0, 0);\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 */ export function getYearEnd(date) {\n return new Date(date.getFullYear() + 1, 0, 0, 0, 0, 0, 0);\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 */ export function setMonth(date, month) {\n return addMonths(date, month - date.getMonth());\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 */ export function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n } else if (!date1 || !date2) {\n return false;\n } else {\n return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();\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 */ export function compareDatePart(date1, date2) {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\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 */ export function getDateRangeArray(date, dateRangeType, firstDayOfWeek, workWeekDays, daysToSelectInDayView = 1) {\n const datesArray = [];\n let startDate;\n let endDate = null;\n if (!workWeekDays) {\n workWeekDays = [\n DayOfWeek.Monday,\n DayOfWeek.Tuesday,\n DayOfWeek.Wednesday,\n DayOfWeek.Thursday,\n DayOfWeek.Friday\n ];\n }\n daysToSelectInDayView = Math.max(daysToSelectInDayView, 1);\n switch(dateRangeType){\n case DateRangeType.Day:\n startDate = getDatePart(date);\n endDate = addDays(startDate, daysToSelectInDayView);\n break;\n case DateRangeType.Week:\n case DateRangeType.WorkWeek:\n startDate = getStartDateOfWeek(getDatePart(date), firstDayOfWeek);\n endDate = addDays(startDate, TimeConstants.DaysInOneWeek);\n break;\n case DateRangeType.Month:\n startDate = new Date(date.getFullYear(), date.getMonth(), 1);\n endDate = addMonths(startDate, 1);\n break;\n default:\n throw new Error('Unexpected object: ' + dateRangeType);\n }\n // Populate the dates array with the dates in range\n let nextDate = startDate;\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 return datesArray;\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 */ export function isInDateRangeArray(date, dateRange) {\n for (const dateInRange of dateRange){\n if (compareDates(date, dateInRange)) {\n return true;\n }\n }\n return false;\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 */ export function getWeekNumbersInMonth(weeksInMonth, firstDayOfWeek, firstWeekOfYear, navigatedDate) {\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 = dayOfMonth + (firstDayOfWeek + TimeConstants.DaysInOneWeek - 1) - adjustWeekDay(firstDayOfWeek, fistDayOfMonth.getDay());\n let endOfWeekRange = new Date(selectedYear, selectedMonth, endOfFirstWeek);\n dayOfMonth = endOfWeekRange.getDate();\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 * 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 */ export function getWeekNumber(date, firstDayOfWeek, firstWeekOfYear) {\n // First four-day week of the year - minumum days count\n const fourDayWeek = 4;\n switch(firstWeekOfYear){\n case FirstWeekOfYear.FirstFullWeek:\n return getWeekOfYearFullDays(date, firstDayOfWeek, TimeConstants.DaysInOneWeek);\n case FirstWeekOfYear.FirstFourDayWeek:\n return getWeekOfYearFullDays(date, firstDayOfWeek, fourDayWeek);\n default:\n return getFirstDayWeekOfYear(date, firstDayOfWeek);\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 */ export function getStartDateOfWeek(date, firstDayOfWeek) {\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 * 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 */ export function getEndDateOfWeek(date, firstDayOfWeek) {\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 * 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 */ function getDatePart(date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n}\n/**\n * Helper function to assist in date comparisons\n */ export function getDatePartHashValue(date) {\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 * 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 */ function getWeekOfYearFullDays(date, firstDayOfWeek, numberOfFullDays) {\n const dayOfYear = getDayOfYear(date) - 1;\n let num = date.getDay() - dayOfYear % TimeConstants.DaysInOneWeek;\n const lastDayOfPrevYear = new Date(date.getFullYear() - 1, MonthOfYear.December, 31);\n const daysInYear = getDayOfYear(lastDayOfPrevYear) - 1;\n let num2 = (firstDayOfWeek - num + 2 * TimeConstants.DaysInOneWeek) % TimeConstants.DaysInOneWeek;\n if (num2 !== 0 && num2 >= numberOfFullDays) {\n num2 -= TimeConstants.DaysInOneWeek;\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 num3 = daysInYear - num2;\n }\n return Math.floor(num3 / TimeConstants.DaysInOneWeek + 1);\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 */ function getFirstDayWeekOfYear(date, firstDayOfWeek) {\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 return Math.floor((num + num3) / TimeConstants.DaysInOneWeek + 1);\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 */ function adjustWeekDay(firstDayOfWeek, dateWeekDay) {\n return firstDayOfWeek !== DayOfWeek.Sunday && dateWeekDay < firstDayOfWeek ? dateWeekDay + TimeConstants.DaysInOneWeek : dateWeekDay;\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 */ function getDayOfYear(date) {\n const month = date.getMonth();\n const year = date.getFullYear();\n let daysUntilDate = 0;\n for(let i = 0; i < month; i++){\n daysUntilDate += daysInMonth(i + 1, year);\n }\n daysUntilDate += date.getDate();\n return daysUntilDate;\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 */ function daysInMonth(month, year) {\n return new Date(year, month, 0).getDate();\n}\n"],"names":["addDays","addWeeks","addMonths","addYears","getMonthStart","getMonthEnd","getYearStart","getYearEnd","setMonth","compareDates","compareDatePart","getDateRangeArray","isInDateRangeArray","getWeekNumbersInMonth","getWeekNumber","getStartDateOfWeek","getEndDateOfWeek","getDatePartHashValue","date","days","result","Date","getTime","setDate","getDate","weeks","TimeConstants","DaysInOneWeek","months","newMonth","getMonth","MonthInOneYear","years","setFullYear","getFullYear","month","date1","date2","dateRangeType","firstDayOfWeek","workWeekDays","daysToSelectInDayView","datesArray","startDate","endDate","DayOfWeek","Monday","Tuesday","Wednesday","Thursday","Friday","Math","max","DateRangeType","Day","getDatePart","Week","WorkWeek","Month","Error","nextDate","push","indexOf","getDay","dateRange","dateInRange","weeksInMonth","firstWeekOfYear","navigatedDate","selectedYear","selectedMonth","dayOfMonth","fistDayOfMonth","endOfFirstWeek","adjustWeekDay","endOfWeekRange","weeksArray","i","fourDayWeek","FirstWeekOfYear","FirstFullWeek","getWeekOfYearFullDays","FirstFourDayWeek","getFirstDayWeekOfYear","daysOffset","lastDayOfWeek","numberOfFullDays","dayOfYear","getDayOfYear","num","lastDayOfPrevYear","MonthOfYear","December","daysInYear","num2","num3","floor","dateWeekDay","Sunday","year","daysUntilDate","daysInMonth"],"mappings":";;;;;;;;;;;IAMoBA,OAAO;eAAPA;;IAUAC,QAAQ;eAARA;;IAUAC,SAAS;eAATA;;IAmBAC,QAAQ;eAARA;;IAeAC,aAAa;eAAbA;;IAOAC,WAAW;eAAXA;;IAOAC,YAAY;eAAZA;;IAOAC,UAAU;eAAVA;;IAUAC,QAAQ;eAARA;;IAMAC,YAAY;eAAZA;;IAeAC,eAAe;eAAfA;;IAaAC,iBAAiB;eAAjBA;;IAiDAC,kBAAkB;eAAlBA;;IAeAC,qBAAqB;eAArBA;;IAwBAC,aAAa;eAAbA;;IAiBAC,kBAAkB;eAAlBA;;IAaAC,gBAAgB;eAAhBA;;IAkBAC,oBAAoB;eAApBA;;;2BArQkE;AAM3E,SAASjB,QAAQkB,IAAI,EAAEC,IAAI;IAClC,MAAMC,SAAS,IAAIC,KAAKH,KAAKI,OAAO;IACpCF,OAAOG,OAAO,CAACH,OAAOI,OAAO,KAAKL;IAClC,OAAOC;AACX;AAMW,SA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D,CAAAA,OAAOvD,iBAAiB,IAAIb,wBAAa,CAACC,aAAa,AAAD,IAAKD,wBAAa,CAACC,aAAa;IACpG,OAAOwB,KAAK6C,KAAK,CAAC,AAACP,CAAAA,MAAMM,IAAG,IAAKrE,wBAAa,CAACC,aAAa,GAAG;AACnE;AACA;;;;;;;;CAQC,GAAG,SAAS+C,cAAcnC,cAAc,EAAE0D,WAAW;IAClD,OAAO1D,mBAAmBM,oBAAS,CAACqD,MAAM,IAAID,cAAc1D,iBAAiB0D,cAAcvE,wBAAa,CAACC,aAAa,GAAGsE;AAC7H;AACA;;;;;CAKC,GAAG,SAAST,aAAatE,IAAI;IAC1B,MAAMiB,QAAQjB,KAAKY,QAAQ;IAC3B,MAAMqE,OAAOjF,KAAKgB,WAAW;IAC7B,IAAIkE,gBAAgB;IACpB,IAAI,IAAIvB,IAAI,GAAGA,IAAI1C,OAAO0C,IAAI;QAC1BuB,iBAAiBC,YAAYxB,IAAI,GAAGsB;IACxC;IACAC,iBAAiBlF,KAAKM,OAAO;IAC7B,OAAO4E;AACX;AACA;;;;;CAKC,GAAG,SAASC,YAAYlE,KAAK,EAAEgE,IAAI;IAChC,OAAO,IAAI9E,KAAK8E,MAAMhE,OAAO,GAAGX,OAAO;AAC3C"}
1
+ {"version":3,"sources":["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":["addDays","addMonths","addWeeks","addYears","compareDatePart","compareDates","getDatePartHashValue","getDateRangeArray","getEndDateOfWeek","getMonthEnd","getMonthStart","getStartDateOfWeek","getWeekNumber","getWeekNumbersInMonth","getYearEnd","getYearStart","isInDateRangeArray","setMonth","date","days","result","Date","getTime","setDate","getDate","weeks","TimeConstants","DaysInOneWeek","months","newMonth","getMonth","MonthInOneYear","years","setFullYear","getFullYear","month","date1","date2","dateRangeType","firstDayOfWeek","workWeekDays","daysToSelectInDayView","datesArray","startDate","endDate","DayOfWeek","Monday","Tuesday","Wednesday","Thursday","Friday","Math","max","DateRangeType","Day","getDatePart","Week","WorkWeek","Month","Error","nextDate","push","indexOf","getDay","dateRange","dateInRange","weeksInMonth","firstWeekOfYear","navigatedDate","selectedYear","selectedMonth","dayOfMonth","fistDayOfMonth","endOfFirstWeek","adjustWeekDay","endOfWeekRange","weeksArray","i","fourDayWeek","FirstWeekOfYear","FirstFullWeek","getWeekOfYearFullDays","FirstFourDayWeek","getFirstDayWeekOfYear","daysOffset","lastDayOfWeek","numberOfFullDays","dayOfYear","getDayOfYear","num","lastDayOfPrevYear","MonthOfYear","December","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AbA,IAAiBD,wBAAAA,CAAcC,aAAa;IAEpG,OAAOwB,KAAK6C,KAAK,CAAC,AAACP,CAAAA,MAAMM,IAAAA,IAAQrE,wBAAAA,CAAcC,aAAa,GAAG;AACjE;AAEA;;;;;;;;CAQC,GACD,SAAS+C,cAAcnC,cAAyB,EAAE0D,WAAsB;IACtE,OAAO1D,mBAAmBM,oBAAAA,CAAUqD,MAAM,IAAID,cAAc1D,iBACxD0D,cAAcvE,wBAAAA,CAAcC,aAAa,GACzCsE;AACN;AAEA;;;;;CAKC,GACD,SAAST,aAAatE,IAAU;IAC9B,MAAMiB,QAAQjB,KAAKY,QAAQ;IAC3B,MAAMqE,OAAOjF,KAAKgB,WAAW;IAC7B,IAAIkE,gBAAgB;IAEpB,IAAK,IAAIvB,IAAI,GAAGA,IAAI1C,OAAO0C,IAAK;QAC9BuB,iBAAiBC,YAAYxB,IAAI,GAAGsB;IACtC;IAEAC,iBAAiBlF,KAAKM,OAAO;IAE7B,OAAO4E;AACT;AAEA;;;;;CAKC,GACD,SAASC,YAAYlE,KAAa,EAAEgE,IAAY;IAC9C,OAAO,IAAI9E,KAAK8E,MAAMhE,OAAO,GAAGX,OAAO;AACzC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './dateMath';\n"],"names":[],"mappings":";;;;;uBAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './dateMath';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
@@ -1 +1 @@
1
- {"version":3,"sources":["focus.js"],"sourcesContent":["let targetToFocusOnNextRepaint = undefined;\n/**\n * Sets focus to an element asynchronously. The focus will be set at the next browser repaint,\n * meaning it won't cause any extra recalculations. If more than one focusAsync is called during one frame,\n * only the latest called focusAsync element will actually be focused\n * @param element - The element to focus\n */ export function focusAsync(element, win) {\n if (element) {\n // An element was already queued to be focused, so replace that one with the new element\n if (targetToFocusOnNextRepaint) {\n targetToFocusOnNextRepaint = element;\n return;\n }\n targetToFocusOnNextRepaint = element;\n if (win) {\n // element.focus() is a no-op if the element is no longer in the DOM, meaning this is always safe\n win.requestAnimationFrame(()=>{\n targetToFocusOnNextRepaint && targetToFocusOnNextRepaint.focus();\n // We are done focusing for this frame, so reset the queued focus element\n targetToFocusOnNextRepaint = undefined;\n });\n }\n }\n}\n"],"names":["focusAsync","targetToFocusOnNextRepaint","undefined","element","win","requestAnimationFrame","focus"],"mappings":";;;;+BAMoBA;;;eAAAA;;;AANpB,IAAIC,6BAA6BC;AAMtB,SAASF,WAAWG,OAAO,EAAEC,GAAG;IACvC,IAAID,SAAS;QACT,wFAAwF;QACxF,IAAIF,4BAA4B;YAC5BA,6BAA6BE;YAC7B;QACJ;QACAF,6BAA6BE;QAC7B,IAAIC,KAAK;YACL,iGAAiG;YACjGA,IAAIC,qBAAqB,CAAC;gBACtBJ,8BAA8BA,2BAA2BK,KAAK;gBAC9D,yEAAyE;gBACzEL,6BAA6BC;YACjC;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["focus.ts"],"sourcesContent":["let targetToFocusOnNextRepaint: HTMLElement | { focus: () => void } | null | undefined = undefined;\n\n/**\n * Sets focus to an element asynchronously. The focus will be set at the next browser repaint,\n * meaning it won't cause any extra recalculations. If more than one focusAsync is called during one frame,\n * only the latest called focusAsync element will actually be focused\n * @param element - The element to focus\n */\nexport function focusAsync(\n element: HTMLElement | { focus: () => void } | undefined | null,\n win: Window | undefined | null,\n): void {\n if (element) {\n // An element was already queued to be focused, so replace that one with the new element\n if (targetToFocusOnNextRepaint) {\n targetToFocusOnNextRepaint = element;\n return;\n }\n\n targetToFocusOnNextRepaint = element;\n\n if (win) {\n // element.focus() is a no-op if the element is no longer in the DOM, meaning this is always safe\n win.requestAnimationFrame(() => {\n targetToFocusOnNextRepaint && targetToFocusOnNextRepaint.focus();\n\n // We are done focusing for this frame, so reset the queued focus element\n targetToFocusOnNextRepaint = undefined;\n });\n }\n }\n}\n"],"names":["focusAsync","targetToFocusOnNextRepaint","undefined","element","win","requestAnimationFrame","focus"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;AARhB,IAAIC,6BAAqFC;AAQlF,SAASF,WACdG,OAA+D,EAC/DC,GAA8B;IAE9B,IAAID,SAAS;QACX,wFAAwF;QACxF,IAAIF,4BAA4B;YAC9BA,6BAA6BE;YAC7B;QACF;QAEAF,6BAA6BE;QAE7B,IAAIC,KAAK;YACP,iGAAiG;YACjGA,IAAIC,qBAAqB,CAAC;gBACxBJ,8BAA8BA,2BAA2BK,KAAK;gBAE9D,yEAAyE;gBACzEL,6BAA6BC;YAC/B;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './animations';\nexport * from './constants';\nexport * from './dateFormatting';\nexport * from './dateGrid';\nexport * from './dateMath';\nexport * from './focus';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './animations';\nexport * from './constants';\nexport * from './dateFormatting';\nexport * from './dateGrid';\nexport * from './dateMath';\nexport * from './focus';\n"],"names":[],"rangeMappings":";;;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-calendar-compat",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Calendar compat component for Fluent UI v9",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -31,12 +31,12 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@fluentui/keyboard-keys": "^9.0.7",
34
- "@fluentui/react-icons": "^2.0.239",
35
- "@fluentui/react-jsx-runtime": "^9.0.39",
36
- "@fluentui/react-shared-contexts": "^9.19.0",
37
- "@fluentui/react-tabster": "^9.22.0",
34
+ "@fluentui/react-icons": "^2.0.245",
35
+ "@fluentui/react-jsx-runtime": "^9.0.41",
36
+ "@fluentui/react-shared-contexts": "^9.19.1",
37
+ "@fluentui/react-tabster": "^9.22.2",
38
38
  "@fluentui/react-theme": "^9.1.19",
39
- "@fluentui/react-utilities": "^9.18.10",
39
+ "@fluentui/react-utilities": "^9.18.12",
40
40
  "@griffel/react": "^1.5.22",
41
41
  "@swc/helpers": "^0.5.1"
42
42
  },