react-day-picker 9.9.0 → 9.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -6
- package/buddhist.d.ts +1 -0
- package/buddhist.js +2 -0
- package/dist/cjs/DayPicker.js +11 -5
- package/dist/cjs/buddhist/index.d.ts +26 -0
- package/dist/cjs/buddhist/index.js +80 -0
- package/dist/cjs/buddhist/lib/format.d.ts +3 -0
- package/dist/cjs/buddhist/lib/format.js +30 -0
- package/dist/cjs/classes/DateLib.d.ts +14 -0
- package/dist/cjs/classes/DateLib.js +56 -0
- package/dist/cjs/ethiopic/index.d.ts +44 -0
- package/dist/cjs/ethiopic/index.js +77 -0
- package/dist/cjs/ethiopic/lib/addMonths.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/addMonths.js +27 -0
- package/dist/cjs/ethiopic/lib/addYears.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/addYears.js +26 -0
- package/dist/cjs/ethiopic/lib/differenceInCalendarMonths.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/differenceInCalendarMonths.js +17 -0
- package/dist/cjs/ethiopic/lib/eachMonthOfInterval.d.ts +11 -0
- package/dist/cjs/ethiopic/lib/eachMonthOfInterval.js +30 -0
- package/dist/cjs/ethiopic/lib/endOfMonth.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/endOfMonth.js +17 -0
- package/dist/cjs/ethiopic/lib/endOfWeek.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/endOfWeek.js +16 -0
- package/dist/cjs/ethiopic/lib/endOfYear.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/endOfYear.js +15 -0
- package/dist/cjs/ethiopic/lib/format.d.ts +22 -0
- package/dist/cjs/ethiopic/lib/format.js +135 -0
- package/dist/cjs/ethiopic/lib/formatNumber.d.ts +19 -0
- package/dist/cjs/ethiopic/lib/formatNumber.js +32 -0
- package/dist/cjs/ethiopic/lib/getMonth.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/getMonth.js +14 -0
- package/dist/cjs/ethiopic/lib/getWeek.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/getWeek.js +44 -0
- package/dist/cjs/ethiopic/lib/getYear.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/getYear.js +14 -0
- package/dist/cjs/ethiopic/lib/index.d.ts +21 -0
- package/dist/cjs/ethiopic/lib/index.js +37 -0
- package/dist/cjs/ethiopic/lib/isSameMonth.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/isSameMonth.js +16 -0
- package/dist/cjs/ethiopic/lib/isSameYear.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/isSameYear.js +16 -0
- package/dist/cjs/ethiopic/lib/newDate.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/newDate.js +25 -0
- package/dist/cjs/ethiopic/lib/setMonth.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/setMonth.js +17 -0
- package/dist/cjs/ethiopic/lib/setYear.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/setYear.js +19 -0
- package/dist/cjs/ethiopic/lib/startOfDay.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/startOfDay.js +14 -0
- package/dist/cjs/ethiopic/lib/startOfMonth.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/startOfMonth.js +14 -0
- package/dist/cjs/ethiopic/lib/startOfWeek.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/startOfWeek.js +15 -0
- package/dist/cjs/ethiopic/lib/startOfYear.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/startOfYear.js +14 -0
- package/dist/cjs/ethiopic/locale/am-ET.d.ts +4 -0
- package/dist/cjs/ethiopic/locale/am-ET.js +99 -0
- package/dist/cjs/ethiopic/utils/EthiopicDate.d.ts +17 -0
- package/dist/cjs/ethiopic/utils/EthiopicDate.js +2 -0
- package/dist/cjs/ethiopic/utils/daysInMonth.d.ts +13 -0
- package/dist/cjs/ethiopic/utils/daysInMonth.js +22 -0
- package/dist/cjs/ethiopic/utils/index.d.ts +6 -0
- package/dist/cjs/ethiopic/utils/index.js +22 -0
- package/dist/cjs/ethiopic/utils/isEthiopicDateValid.d.ts +2 -0
- package/dist/cjs/ethiopic/utils/isEthiopicDateValid.js +15 -0
- package/dist/cjs/ethiopic/utils/isEthiopicLeapYear.d.ts +7 -0
- package/dist/cjs/ethiopic/utils/isEthiopicLeapYear.js +12 -0
- package/dist/cjs/ethiopic/utils/toEthiopicDate.d.ts +17 -0
- package/dist/cjs/ethiopic/utils/toEthiopicDate.js +54 -0
- package/dist/cjs/ethiopic/utils/toGeezNumerals.d.ts +8 -0
- package/dist/cjs/ethiopic/utils/toGeezNumerals.js +51 -0
- package/dist/cjs/ethiopic/utils/toGregorianDate.d.ts +9 -0
- package/dist/cjs/ethiopic/utils/toGregorianDate.js +59 -0
- package/dist/cjs/formatters/formatCaption.d.ts +1 -1
- package/dist/cjs/formatters/formatCaption.js +3 -2
- package/dist/cjs/hebrew/index.d.ts +26 -0
- package/dist/cjs/hebrew/index.js +74 -0
- package/dist/cjs/hebrew/lib/addMonths.d.ts +1 -0
- package/dist/cjs/hebrew/lib/addMonths.js +15 -0
- package/dist/cjs/hebrew/lib/addYears.d.ts +1 -0
- package/dist/cjs/hebrew/lib/addYears.js +12 -0
- package/dist/cjs/hebrew/lib/differenceInCalendarMonths.d.ts +1 -0
- package/dist/cjs/hebrew/lib/differenceInCalendarMonths.js +10 -0
- package/dist/cjs/hebrew/lib/eachMonthOfInterval.d.ts +2 -0
- package/dist/cjs/hebrew/lib/eachMonthOfInterval.js +23 -0
- package/dist/cjs/hebrew/lib/endOfMonth.d.ts +1 -0
- package/dist/cjs/hebrew/lib/endOfMonth.js +10 -0
- package/dist/cjs/hebrew/lib/endOfYear.d.ts +1 -0
- package/dist/cjs/hebrew/lib/endOfYear.js +11 -0
- package/dist/cjs/hebrew/lib/findMonthIndexByCode.d.ts +1 -0
- package/dist/cjs/hebrew/lib/findMonthIndexByCode.js +13 -0
- package/dist/cjs/hebrew/lib/format.d.ts +3 -0
- package/dist/cjs/hebrew/lib/format.js +152 -0
- package/dist/cjs/hebrew/lib/getMonth.d.ts +1 -0
- package/dist/cjs/hebrew/lib/getMonth.js +7 -0
- package/dist/cjs/hebrew/lib/getYear.d.ts +1 -0
- package/dist/cjs/hebrew/lib/getYear.js +7 -0
- package/dist/cjs/hebrew/lib/index.d.ts +16 -0
- package/dist/cjs/hebrew/lib/index.js +32 -0
- package/dist/cjs/hebrew/lib/isSameMonth.d.ts +1 -0
- package/dist/cjs/hebrew/lib/isSameMonth.js +9 -0
- package/dist/cjs/hebrew/lib/isSameYear.d.ts +1 -0
- package/dist/cjs/hebrew/lib/isSameYear.js +7 -0
- package/dist/cjs/hebrew/lib/newDate.d.ts +1 -0
- package/dist/cjs/hebrew/lib/newDate.js +7 -0
- package/dist/cjs/hebrew/lib/setMonth.d.ts +1 -0
- package/dist/cjs/hebrew/lib/setMonth.js +12 -0
- package/dist/cjs/hebrew/lib/setYear.d.ts +1 -0
- package/dist/cjs/hebrew/lib/setYear.js +31 -0
- package/dist/cjs/hebrew/lib/startOfMonth.d.ts +1 -0
- package/dist/cjs/hebrew/lib/startOfMonth.js +8 -0
- package/dist/cjs/hebrew/lib/startOfYear.d.ts +1 -0
- package/dist/cjs/hebrew/lib/startOfYear.js +8 -0
- package/dist/cjs/hebrew/utils/calendarMath.d.ts +17 -0
- package/dist/cjs/hebrew/utils/calendarMath.js +139 -0
- package/dist/cjs/hebrew/utils/constants.d.ts +13 -0
- package/dist/cjs/hebrew/utils/constants.js +36 -0
- package/dist/cjs/hebrew/utils/dateConversion.d.ts +5 -0
- package/dist/cjs/hebrew/utils/dateConversion.js +67 -0
- package/dist/cjs/hebrew/utils/serial.d.ts +9 -0
- package/dist/cjs/hebrew/utils/serial.js +76 -0
- package/dist/cjs/labels/labelGrid.d.ts +1 -1
- package/dist/cjs/labels/labelGrid.js +3 -2
- package/dist/cjs/types/props.d.ts +7 -0
- package/dist/cjs/types/shared.d.ts +6 -1
- package/dist/esm/DayPicker.js +11 -5
- package/dist/esm/buddhist/index.d.ts +26 -0
- package/dist/esm/buddhist/index.js +39 -0
- package/dist/esm/buddhist/lib/format.d.ts +3 -0
- package/dist/esm/buddhist/lib/format.js +27 -0
- package/dist/esm/classes/DateLib.d.ts +14 -0
- package/dist/esm/classes/DateLib.js +56 -0
- package/dist/esm/ethiopic/index.d.ts +44 -0
- package/dist/esm/ethiopic/index.js +34 -0
- package/dist/esm/ethiopic/lib/addMonths.d.ts +9 -0
- package/dist/esm/ethiopic/lib/addMonths.js +24 -0
- package/dist/esm/ethiopic/lib/addYears.d.ts +9 -0
- package/dist/esm/ethiopic/lib/addYears.js +23 -0
- package/dist/esm/ethiopic/lib/differenceInCalendarMonths.d.ts +8 -0
- package/dist/esm/ethiopic/lib/differenceInCalendarMonths.js +14 -0
- package/dist/esm/ethiopic/lib/eachMonthOfInterval.d.ts +11 -0
- package/dist/esm/ethiopic/lib/eachMonthOfInterval.js +27 -0
- package/dist/esm/ethiopic/lib/endOfMonth.d.ts +8 -0
- package/dist/esm/ethiopic/lib/endOfMonth.js +14 -0
- package/dist/esm/ethiopic/lib/endOfWeek.d.ts +9 -0
- package/dist/esm/ethiopic/lib/endOfWeek.js +13 -0
- package/dist/esm/ethiopic/lib/endOfYear.d.ts +7 -0
- package/dist/esm/ethiopic/lib/endOfYear.js +12 -0
- package/dist/esm/ethiopic/lib/format.d.ts +22 -0
- package/dist/esm/ethiopic/lib/format.js +131 -0
- package/dist/esm/ethiopic/lib/formatNumber.d.ts +19 -0
- package/dist/esm/ethiopic/lib/formatNumber.js +29 -0
- package/dist/esm/ethiopic/lib/getMonth.d.ts +7 -0
- package/dist/esm/ethiopic/lib/getMonth.js +11 -0
- package/dist/esm/ethiopic/lib/getWeek.d.ts +9 -0
- package/dist/esm/ethiopic/lib/getWeek.js +41 -0
- package/dist/esm/ethiopic/lib/getYear.d.ts +7 -0
- package/dist/esm/ethiopic/lib/getYear.js +11 -0
- package/dist/esm/ethiopic/lib/index.d.ts +21 -0
- package/dist/esm/ethiopic/lib/index.js +21 -0
- package/dist/esm/ethiopic/lib/isSameMonth.d.ts +8 -0
- package/dist/esm/ethiopic/lib/isSameMonth.js +13 -0
- package/dist/esm/ethiopic/lib/isSameYear.d.ts +8 -0
- package/dist/esm/ethiopic/lib/isSameYear.js +13 -0
- package/dist/esm/ethiopic/lib/newDate.d.ts +9 -0
- package/dist/esm/ethiopic/lib/newDate.js +22 -0
- package/dist/esm/ethiopic/lib/setMonth.d.ts +8 -0
- package/dist/esm/ethiopic/lib/setMonth.js +14 -0
- package/dist/esm/ethiopic/lib/setYear.d.ts +8 -0
- package/dist/esm/ethiopic/lib/setYear.js +16 -0
- package/dist/esm/ethiopic/lib/startOfDay.d.ts +7 -0
- package/dist/esm/ethiopic/lib/startOfDay.js +11 -0
- package/dist/esm/ethiopic/lib/startOfMonth.d.ts +7 -0
- package/dist/esm/ethiopic/lib/startOfMonth.js +11 -0
- package/dist/esm/ethiopic/lib/startOfWeek.d.ts +9 -0
- package/dist/esm/ethiopic/lib/startOfWeek.js +12 -0
- package/dist/esm/ethiopic/lib/startOfYear.d.ts +7 -0
- package/dist/esm/ethiopic/lib/startOfYear.js +11 -0
- package/dist/esm/ethiopic/locale/am-ET.d.ts +4 -0
- package/dist/esm/ethiopic/locale/am-ET.js +96 -0
- package/dist/esm/ethiopic/utils/EthiopicDate.d.ts +17 -0
- package/dist/esm/ethiopic/utils/EthiopicDate.js +1 -0
- package/dist/esm/ethiopic/utils/daysInMonth.d.ts +13 -0
- package/dist/esm/ethiopic/utils/daysInMonth.js +19 -0
- package/dist/esm/ethiopic/utils/index.d.ts +6 -0
- package/dist/esm/ethiopic/utils/index.js +6 -0
- package/dist/esm/ethiopic/utils/isEthiopicDateValid.d.ts +2 -0
- package/dist/esm/ethiopic/utils/isEthiopicDateValid.js +12 -0
- package/dist/esm/ethiopic/utils/isEthiopicLeapYear.d.ts +7 -0
- package/dist/esm/ethiopic/utils/isEthiopicLeapYear.js +9 -0
- package/dist/esm/ethiopic/utils/toEthiopicDate.d.ts +17 -0
- package/dist/esm/ethiopic/utils/toEthiopicDate.js +50 -0
- package/dist/esm/ethiopic/utils/toGeezNumerals.d.ts +8 -0
- package/dist/esm/ethiopic/utils/toGeezNumerals.js +48 -0
- package/dist/esm/ethiopic/utils/toGregorianDate.d.ts +9 -0
- package/dist/esm/ethiopic/utils/toGregorianDate.js +55 -0
- package/dist/esm/formatters/formatCaption.d.ts +1 -1
- package/dist/esm/formatters/formatCaption.js +3 -2
- package/dist/esm/hebrew/index.d.ts +26 -0
- package/dist/esm/hebrew/index.js +33 -0
- package/dist/esm/hebrew/lib/addMonths.d.ts +1 -0
- package/dist/esm/hebrew/lib/addMonths.js +12 -0
- package/dist/esm/hebrew/lib/addYears.d.ts +1 -0
- package/dist/esm/hebrew/lib/addYears.js +9 -0
- package/dist/esm/hebrew/lib/differenceInCalendarMonths.d.ts +1 -0
- package/dist/esm/hebrew/lib/differenceInCalendarMonths.js +7 -0
- package/dist/esm/hebrew/lib/eachMonthOfInterval.d.ts +2 -0
- package/dist/esm/hebrew/lib/eachMonthOfInterval.js +20 -0
- package/dist/esm/hebrew/lib/endOfMonth.d.ts +1 -0
- package/dist/esm/hebrew/lib/endOfMonth.js +7 -0
- package/dist/esm/hebrew/lib/endOfYear.d.ts +1 -0
- package/dist/esm/hebrew/lib/endOfYear.js +8 -0
- package/dist/esm/hebrew/lib/findMonthIndexByCode.d.ts +1 -0
- package/dist/esm/hebrew/lib/findMonthIndexByCode.js +10 -0
- package/dist/esm/hebrew/lib/format.d.ts +3 -0
- package/dist/esm/hebrew/lib/format.js +149 -0
- package/dist/esm/hebrew/lib/getMonth.d.ts +1 -0
- package/dist/esm/hebrew/lib/getMonth.js +4 -0
- package/dist/esm/hebrew/lib/getYear.d.ts +1 -0
- package/dist/esm/hebrew/lib/getYear.js +4 -0
- package/dist/esm/hebrew/lib/index.d.ts +16 -0
- package/dist/esm/hebrew/lib/index.js +16 -0
- package/dist/esm/hebrew/lib/isSameMonth.d.ts +1 -0
- package/dist/esm/hebrew/lib/isSameMonth.js +6 -0
- package/dist/esm/hebrew/lib/isSameYear.d.ts +1 -0
- package/dist/esm/hebrew/lib/isSameYear.js +4 -0
- package/dist/esm/hebrew/lib/newDate.d.ts +1 -0
- package/dist/esm/hebrew/lib/newDate.js +4 -0
- package/dist/esm/hebrew/lib/setMonth.d.ts +1 -0
- package/dist/esm/hebrew/lib/setMonth.js +9 -0
- package/dist/esm/hebrew/lib/setYear.d.ts +1 -0
- package/dist/esm/hebrew/lib/setYear.js +28 -0
- package/dist/esm/hebrew/lib/startOfMonth.d.ts +1 -0
- package/dist/esm/hebrew/lib/startOfMonth.js +5 -0
- package/dist/esm/hebrew/lib/startOfYear.d.ts +1 -0
- package/dist/esm/hebrew/lib/startOfYear.js +5 -0
- package/dist/esm/hebrew/utils/calendarMath.d.ts +17 -0
- package/dist/esm/hebrew/utils/calendarMath.js +130 -0
- package/dist/esm/hebrew/utils/constants.d.ts +13 -0
- package/dist/esm/hebrew/utils/constants.js +33 -0
- package/dist/esm/hebrew/utils/dateConversion.d.ts +5 -0
- package/dist/esm/hebrew/utils/dateConversion.js +63 -0
- package/dist/esm/hebrew/utils/serial.d.ts +9 -0
- package/dist/esm/hebrew/utils/serial.js +70 -0
- package/dist/esm/labels/labelGrid.d.ts +1 -1
- package/dist/esm/labels/labelGrid.js +3 -2
- package/dist/esm/types/props.d.ts +7 -0
- package/dist/esm/types/shared.d.ts +6 -1
- package/hebrew.d.ts +1 -0
- package/hebrew.js +2 -0
- package/package.json +35 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ See **[daypicker.dev](https://daypicker.dev)** for guides, examples and API refe
|
|
|
18
18
|
- 🎨 Minimal design that can be [easily styled](https://daypicker.dev/docs/styling) with CSS or any CSS framework.
|
|
19
19
|
- 📅 Supports [selections](https://daypicker.dev/docs/selection-modes) of single days, multiple days, ranges of days, or [custom selections](https://daypicker.dev/guides/custom-selections).
|
|
20
20
|
- 🌍 Can be [localized](https://daypicker.dev/docs/localization) into any language and [time zones](https://daypicker.dev/docs/time-zone).
|
|
21
|
-
- 🌐 Support for [ISO 8601](https://daypicker.dev/docs/localization#iso-week-dates), [Persian](https://daypicker.dev/docs/localization#persian-calendar), and [broadcast](https://daypicker.dev/docs/localization#broadcast-calendar) calendar.
|
|
21
|
+
- 🌐 Support for [ISO 8601](https://daypicker.dev/docs/localization#iso-week-dates), [Persian](https://daypicker.dev/docs/localization#persian-calendar), [Buddhist (Thai)](https://daypicker.dev/docs/localization#buddhist-thai-calendar), [Ethiopic](https://daypicker.dev/docs/localization#ethiopic-calendar), [Hebrew](https://daypicker.dev/docs/localization#hebrew-calendar) and [broadcast](https://daypicker.dev/docs/localization#broadcast-calendar) calendar.
|
|
22
22
|
- 🦮 Complies with WCAG 2.1 AA requirements for [accessibility](https://daypicker.dev/guides/accessibility).
|
|
23
23
|
- ⚙️ [Customizable components](https://daypicker.dev/guides/custom-components) to extend the rendered elements.
|
|
24
24
|
- 🔤 Easy integration [with input fields](https://daypicker.dev/guides/input-fields).
|
|
@@ -70,8 +70,27 @@ Ask for help and share your experience with DayPicker:
|
|
|
70
70
|
- 💬 [Discussion forums](https://github.com/gpbl/react-day-picker/discussions) - Get support and provide feedback.
|
|
71
71
|
- 🪳 [Report an issue](https://github.com/gpbl/react-day-picker/issues/new/choose) - Report bugs or request features.
|
|
72
72
|
|
|
73
|
-
##
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
## Sponsors
|
|
74
|
+
|
|
75
|
+
Thank you to everyone supporting DayPicker - your sponsorship keeps this project maintained and evolving.
|
|
76
|
+
|
|
77
|
+
<p>
|
|
78
|
+
<a href="https://github.com/CHECK24" title="CHECK24"><img src="https://github.com/CHECK24.png?size=64" alt="CHECK24" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
79
|
+
<a href="https://github.com/oluwatunmiisheii" title="oluwatunmiisheii"><img src="https://github.com/oluwatunmiisheii.png?size=64" alt="oluwatunmiisheii" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
80
|
+
<a href="https://github.com/severinlandolt" title="severinlandolt"><img src="https://github.com/severinlandolt.png?size=64" alt="severinlandolt" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
81
|
+
<a href="https://github.com/syntaxfm" title="syntaxfm"><img src="https://github.com/syntaxfm.png?size=64" alt="syntaxfm" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
82
|
+
<a href="https://github.com/thnxdev" title="thnxdev"><img src="https://github.com/thnxdev.png?size=64" alt="thnxdev" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
83
|
+
<a href="https://github.com/katyabilokur" title="katyabilokur"><img src="https://github.com/katyabilokur.png?size=64" alt="katyabilokur" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
84
|
+
<a href="https://github.com/bedandbreakfasteu" title="bedandbreakfasteu"><img src="https://github.com/bedandbreakfasteu.png?size=64" alt="bedandbreakfasteu" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
85
|
+
<a href="https://github.com/codecov" title="codecov"><img src="https://github.com/codecov.png?size=64" alt="codecov" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
86
|
+
<a href="https://github.com/manavm1990" title="manavm1990"><img src="https://github.com/manavm1990.png?size=64" alt="manavm1990" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
87
|
+
<a href="https://github.com/Thinkmill" title="Thinkmill"><img src="https://github.com/Thinkmill.png?size=64" alt="Thinkmill" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
88
|
+
<a href="https://github.com/AlexKDawson" title="AlexKDawson"><img src="https://github.com/AlexKDawson.png?size=64" alt="AlexKDawson" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
89
|
+
<a href="https://github.com/dimitur2204" title="dimitur2204"><img src="https://github.com/dimitur2204.png?size=64" alt="dimitur2204" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
90
|
+
<a href="https://github.com/indeedeng" title="indeedeng"><img src="https://github.com/indeedeng.png?size=64" alt="indeedeng" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
91
|
+
<a href="https://github.com/flexbox" title="flexbox"><img src="https://github.com/flexbox.png?size=64" alt="flexbox" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
92
|
+
<a href="https://github.com/github" title="github"><img src="https://github.com/github.png?size=64" alt="github" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
93
|
+
<a href="https://github.com/tjfred35" title="tjfred35"><img src="https://github.com/tjfred35.png?size=64" alt="tjfred35" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
- 🎗️ Become a sponsor: https://github.com/sponsors/gpbl
|
package/buddhist.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/cjs/buddhist/index.d.ts";
|
package/buddhist.js
ADDED
package/dist/cjs/DayPicker.js
CHANGED
|
@@ -245,7 +245,7 @@ function DayPicker(initialProps) {
|
|
|
245
245
|
formatters,
|
|
246
246
|
};
|
|
247
247
|
return (react_1.default.createElement(useDayPicker_js_1.dayPickerContext.Provider, { value: contextValue },
|
|
248
|
-
react_1.default.createElement(components.Root, { rootRef: props.animate ? rootElRef : undefined, className: className, style: style, dir: props.dir, id: props.id, lang: props.lang, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], ...dataAttributes },
|
|
248
|
+
react_1.default.createElement(components.Root, { rootRef: props.animate ? rootElRef : undefined, className: className, style: style, dir: props.dir, id: props.id, lang: props.lang, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes },
|
|
249
249
|
react_1.default.createElement(components.Months, { className: classNames[UI_js_1.UI.Months], style: styles?.[UI_js_1.UI.Months] },
|
|
250
250
|
!props.hideNavigation && !navLayout && (react_1.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.Nav], style: styles?.[UI_js_1.UI.Nav], "aria-label": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),
|
|
251
251
|
months.map((calendarMonth, displayIndex) => {
|
|
@@ -257,10 +257,16 @@ function DayPicker(initialProps) {
|
|
|
257
257
|
displayIndex === 0 && (react_1.default.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI_js_1.UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : undefined },
|
|
258
258
|
react_1.default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
|
|
259
259
|
react_1.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.MonthCaption], style: styles?.[UI_js_1.UI.MonthCaption], calendarMonth: calendarMonth, displayIndex: displayIndex }, captionLayout?.startsWith("dropdown") ? (react_1.default.createElement(components.DropdownNav, { className: classNames[UI_js_1.UI.Dropdowns], style: styles?.[UI_js_1.UI.Dropdowns] },
|
|
260
|
-
|
|
261
|
-
captionLayout === "dropdown
|
|
262
|
-
|
|
263
|
-
captionLayout === "dropdown
|
|
260
|
+
(() => {
|
|
261
|
+
const monthControl = captionLayout === "dropdown" ||
|
|
262
|
+
captionLayout === "dropdown-months" ? (react_1.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI_js_1.UI.MonthsDropdown], "aria-label": labelMonthDropdown(), classNames: classNames, components: components, disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date), options: (0, getMonthOptions_js_1.getMonthOptions)(calendarMonth.date, navStart, navEnd, formatters, dateLib), style: styles?.[UI_js_1.UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) })) : (react_1.default.createElement("span", { key: "month" }, formatMonthDropdown(calendarMonth.date, dateLib)));
|
|
263
|
+
const yearControl = captionLayout === "dropdown" ||
|
|
264
|
+
captionLayout === "dropdown-years" ? (react_1.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI_js_1.UI.YearsDropdown], "aria-label": labelYearDropdown(dateLib.options), classNames: classNames, components: components, disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date), options: (0, getYearOptions_js_1.getYearOptions)(navStart, navEnd, formatters, dateLib, Boolean(props.reverseYears)), style: styles?.[UI_js_1.UI.Dropdown], value: dateLib.getYear(calendarMonth.date) })) : (react_1.default.createElement("span", { key: "year" }, formatYearDropdown(calendarMonth.date, dateLib)));
|
|
265
|
+
const controls = dateLib.getMonthYearOrder() === "year-first"
|
|
266
|
+
? [yearControl, monthControl]
|
|
267
|
+
: [monthControl, yearControl];
|
|
268
|
+
return controls;
|
|
269
|
+
})(),
|
|
264
270
|
react_1.default.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
265
271
|
border: 0,
|
|
266
272
|
clip: "rect(0 0 0 0)",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Locale } from "date-fns";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DateLib, type DateLibOptions } from "../index.js";
|
|
4
|
+
import type { DayPickerProps } from "../types/props.js";
|
|
5
|
+
export declare const th: Locale;
|
|
6
|
+
export declare const enUS: Locale;
|
|
7
|
+
/**
|
|
8
|
+
* Render the Buddhist (Thai) calendar.
|
|
9
|
+
*
|
|
10
|
+
* Months/weeks are Gregorian; displayed year is Buddhist Era (BE = CE + 543).
|
|
11
|
+
* Thai digits are used by default.
|
|
12
|
+
*
|
|
13
|
+
* Defaults:
|
|
14
|
+
*
|
|
15
|
+
* - `locale`: `th`
|
|
16
|
+
* - `dir`: `ltr`
|
|
17
|
+
* - `numerals`: `thai`
|
|
18
|
+
*/
|
|
19
|
+
export declare function DayPicker(props: DayPickerProps & {
|
|
20
|
+
locale?: Locale;
|
|
21
|
+
dir?: DayPickerProps["dir"];
|
|
22
|
+
numerals?: DayPickerProps["numerals"];
|
|
23
|
+
dateLib?: DayPickerProps["dateLib"];
|
|
24
|
+
}): React.JSX.Element;
|
|
25
|
+
/** Returns the date library used in the Buddhist calendar. */
|
|
26
|
+
export declare const getDateLib: (options?: DateLibOptions) => DateLib;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getDateLib = exports.enUS = exports.th = void 0;
|
|
40
|
+
exports.DayPicker = DayPicker;
|
|
41
|
+
const locales = __importStar(require("date-fns/locale"));
|
|
42
|
+
const react_1 = __importDefault(require("react"));
|
|
43
|
+
const index_js_1 = require("../index.js");
|
|
44
|
+
const format_js_1 = require("./lib/format.js");
|
|
45
|
+
// Adapter to match DateLib's format signature without using `any`.
|
|
46
|
+
const buddhistFormat = (date, formatStr, options) => {
|
|
47
|
+
return (0, format_js_1.format)(date, formatStr, options);
|
|
48
|
+
};
|
|
49
|
+
exports.th = locales.th;
|
|
50
|
+
exports.enUS = locales.enUS;
|
|
51
|
+
/**
|
|
52
|
+
* Render the Buddhist (Thai) calendar.
|
|
53
|
+
*
|
|
54
|
+
* Months/weeks are Gregorian; displayed year is Buddhist Era (BE = CE + 543).
|
|
55
|
+
* Thai digits are used by default.
|
|
56
|
+
*
|
|
57
|
+
* Defaults:
|
|
58
|
+
*
|
|
59
|
+
* - `locale`: `th`
|
|
60
|
+
* - `dir`: `ltr`
|
|
61
|
+
* - `numerals`: `thai`
|
|
62
|
+
*/
|
|
63
|
+
function DayPicker(props) {
|
|
64
|
+
const dateLib = (0, exports.getDateLib)({
|
|
65
|
+
locale: props.locale ?? exports.th,
|
|
66
|
+
weekStartsOn: props.broadcastCalendar ? 1 : props.weekStartsOn,
|
|
67
|
+
firstWeekContainsDate: props.firstWeekContainsDate,
|
|
68
|
+
useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
|
|
69
|
+
useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,
|
|
70
|
+
timeZone: props.timeZone,
|
|
71
|
+
});
|
|
72
|
+
return (react_1.default.createElement(index_js_1.DayPicker, { ...props, locale: props.locale ?? exports.th, numerals: props.numerals ?? "thai", dir: props.dir ?? "ltr", dateLib: dateLib }));
|
|
73
|
+
}
|
|
74
|
+
/** Returns the date library used in the Buddhist calendar. */
|
|
75
|
+
const getDateLib = (options) => {
|
|
76
|
+
return new index_js_1.DateLib(options, {
|
|
77
|
+
format: buddhistFormat,
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
exports.getDateLib = getDateLib;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.format = format;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
/** Format override adding +543 to year tokens for Buddhist Era (BE). */
|
|
6
|
+
function format(date, formatStr, options) {
|
|
7
|
+
const beYear = date.getFullYear() + 543;
|
|
8
|
+
switch (formatStr) {
|
|
9
|
+
case "LLLL y":
|
|
10
|
+
case "LLLL yyyy":
|
|
11
|
+
return `${(0, date_fns_1.format)(date, "LLLL", options)} ${beYear}`;
|
|
12
|
+
case "LLLL":
|
|
13
|
+
return (0, date_fns_1.format)(date, "LLLL", options);
|
|
14
|
+
case "yyyy":
|
|
15
|
+
return String(beYear).padStart(4, "0");
|
|
16
|
+
case "y":
|
|
17
|
+
return String(beYear);
|
|
18
|
+
case "yyyy-MM":
|
|
19
|
+
return `${beYear}-${(0, date_fns_1.format)(date, "MM", options)}`;
|
|
20
|
+
case "yyyy-MM-dd":
|
|
21
|
+
return `${beYear}-${(0, date_fns_1.format)(date, "MM", options)}-${(0, date_fns_1.format)(date, "dd", options)}`;
|
|
22
|
+
case "PPP":
|
|
23
|
+
case "PPPP": {
|
|
24
|
+
const raw = (0, date_fns_1.format)(date, formatStr, options);
|
|
25
|
+
return raw.replace(/(.*)(\d{4})(?!.*\d)/, (_m, pre) => `${pre}${beYear}`);
|
|
26
|
+
}
|
|
27
|
+
default:
|
|
28
|
+
return (0, date_fns_1.format)(date, formatStr, options);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -13,6 +13,8 @@ export type FormatOptions = DateLibOptions;
|
|
|
13
13
|
* @deprecated Use {@link DateLibOptions} instead.
|
|
14
14
|
*/
|
|
15
15
|
export type LabelOptions = DateLibOptions;
|
|
16
|
+
/** Indicates the preferred ordering of month and year for localized labels. */
|
|
17
|
+
export type MonthYearOrder = "month-first" | "year-first";
|
|
16
18
|
/**
|
|
17
19
|
* The options for the `DateLib` class.
|
|
18
20
|
*
|
|
@@ -85,6 +87,18 @@ export declare class DateLib {
|
|
|
85
87
|
* @returns The formatted number as a string.
|
|
86
88
|
*/
|
|
87
89
|
formatNumber(value: number | string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the preferred ordering for month and year labels for the current
|
|
92
|
+
* locale.
|
|
93
|
+
*/
|
|
94
|
+
getMonthYearOrder(): MonthYearOrder;
|
|
95
|
+
/**
|
|
96
|
+
* Formats the month/year pair respecting locale conventions.
|
|
97
|
+
*
|
|
98
|
+
* @since 9.11.0
|
|
99
|
+
*/
|
|
100
|
+
formatMonthYear(date: Date): string;
|
|
101
|
+
private static readonly yearFirstLocales;
|
|
88
102
|
/**
|
|
89
103
|
* Reference to the built-in Date constructor.
|
|
90
104
|
*
|
|
@@ -482,8 +482,64 @@ class DateLib {
|
|
|
482
482
|
formatNumber(value) {
|
|
483
483
|
return this.replaceDigits(value.toString());
|
|
484
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* Returns the preferred ordering for month and year labels for the current
|
|
487
|
+
* locale.
|
|
488
|
+
*/
|
|
489
|
+
getMonthYearOrder() {
|
|
490
|
+
const code = this.options.locale?.code;
|
|
491
|
+
if (!code) {
|
|
492
|
+
return "month-first";
|
|
493
|
+
}
|
|
494
|
+
return DateLib.yearFirstLocales.has(code) ? "year-first" : "month-first";
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Formats the month/year pair respecting locale conventions.
|
|
498
|
+
*
|
|
499
|
+
* @since 9.11.0
|
|
500
|
+
*/
|
|
501
|
+
formatMonthYear(date) {
|
|
502
|
+
const { locale, timeZone, numerals } = this.options;
|
|
503
|
+
const localeCode = locale?.code;
|
|
504
|
+
if (localeCode && DateLib.yearFirstLocales.has(localeCode)) {
|
|
505
|
+
try {
|
|
506
|
+
const intl = new Intl.DateTimeFormat(localeCode, {
|
|
507
|
+
month: "long",
|
|
508
|
+
year: "numeric",
|
|
509
|
+
timeZone,
|
|
510
|
+
numberingSystem: numerals,
|
|
511
|
+
});
|
|
512
|
+
const formatted = intl.format(date);
|
|
513
|
+
return formatted;
|
|
514
|
+
}
|
|
515
|
+
catch {
|
|
516
|
+
// Fallback to date-fns formatting below.
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
const pattern = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
|
|
520
|
+
return this.format(date, pattern);
|
|
521
|
+
}
|
|
485
522
|
}
|
|
486
523
|
exports.DateLib = DateLib;
|
|
524
|
+
DateLib.yearFirstLocales = new Set([
|
|
525
|
+
"eu",
|
|
526
|
+
"hu",
|
|
527
|
+
"ja",
|
|
528
|
+
"ja-Hira",
|
|
529
|
+
"ja-JP",
|
|
530
|
+
"ko",
|
|
531
|
+
"ko-KR",
|
|
532
|
+
"lt",
|
|
533
|
+
"lt-LT",
|
|
534
|
+
"lv",
|
|
535
|
+
"lv-LV",
|
|
536
|
+
"mn",
|
|
537
|
+
"mn-MN",
|
|
538
|
+
"zh",
|
|
539
|
+
"zh-CN",
|
|
540
|
+
"zh-HK",
|
|
541
|
+
"zh-TW",
|
|
542
|
+
]);
|
|
487
543
|
/** The default locale (English). */
|
|
488
544
|
var en_US_2 = require("date-fns/locale/en-US");
|
|
489
545
|
Object.defineProperty(exports, "defaultLocale", { enumerable: true, get: function () { return en_US_2.enUS; } });
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Locale } from "date-fns";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DateLib, type DateLibOptions } from "../index.js";
|
|
4
|
+
import type { DayPickerProps } from "../types/props.js";
|
|
5
|
+
export { enUS } from "date-fns/locale/en-US";
|
|
6
|
+
/**
|
|
7
|
+
* Render the Ethiopic calendar.
|
|
8
|
+
*
|
|
9
|
+
* Defaults:
|
|
10
|
+
*
|
|
11
|
+
* - `locale`: `am-ET` (Amharic) via an Intl-backed date-fns locale
|
|
12
|
+
* - `numerals`: `geez` (Ethiopic digits)
|
|
13
|
+
*
|
|
14
|
+
* Notes:
|
|
15
|
+
*
|
|
16
|
+
* - Weekday names are taken from `Intl.DateTimeFormat(locale.code)`.
|
|
17
|
+
* - Month names are Amharic by default; they switch to Latin transliteration when
|
|
18
|
+
* `locale.code` starts with `en` or when `numerals` is `latn`.
|
|
19
|
+
* - Time tokens like `hh:mm a` are formatted via `Intl.DateTimeFormat` using the
|
|
20
|
+
* provided `locale`.
|
|
21
|
+
*
|
|
22
|
+
* @see https://daypicker.dev/docs/localization#ethiopic-calendar
|
|
23
|
+
*/
|
|
24
|
+
export declare function DayPicker(props: DayPickerProps & {
|
|
25
|
+
/**
|
|
26
|
+
* The locale to use in the calendar.
|
|
27
|
+
*
|
|
28
|
+
* @default `am-ET`
|
|
29
|
+
*/
|
|
30
|
+
locale?: Locale;
|
|
31
|
+
/**
|
|
32
|
+
* The numeral system to use when formatting dates.
|
|
33
|
+
*
|
|
34
|
+
* - `latn`: Latin (Western Arabic)
|
|
35
|
+
* - `geez`: Ge'ez (Ethiopic numerals)
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue `geez` (Ethiopic numerals)
|
|
38
|
+
* @see https://daypicker.dev/docs/translation#numeral-systems
|
|
39
|
+
*/
|
|
40
|
+
numerals?: DayPickerProps["numerals"];
|
|
41
|
+
}): React.JSX.Element;
|
|
42
|
+
/** Returns the date library used in the calendar. */
|
|
43
|
+
export declare const getDateLib: (options?: DateLibOptions) => DateLib;
|
|
44
|
+
export { amET } from "./locale/am-ET.js";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.amET = exports.getDateLib = exports.enUS = void 0;
|
|
40
|
+
exports.DayPicker = DayPicker;
|
|
41
|
+
const react_1 = __importDefault(require("react"));
|
|
42
|
+
const index_js_1 = require("../index.js");
|
|
43
|
+
const ethiopicDateLib = __importStar(require("./lib/index.js"));
|
|
44
|
+
const am_ET_js_1 = __importDefault(require("./locale/am-ET.js"));
|
|
45
|
+
var en_US_1 = require("date-fns/locale/en-US");
|
|
46
|
+
Object.defineProperty(exports, "enUS", { enumerable: true, get: function () { return en_US_1.enUS; } });
|
|
47
|
+
/**
|
|
48
|
+
* Render the Ethiopic calendar.
|
|
49
|
+
*
|
|
50
|
+
* Defaults:
|
|
51
|
+
*
|
|
52
|
+
* - `locale`: `am-ET` (Amharic) via an Intl-backed date-fns locale
|
|
53
|
+
* - `numerals`: `geez` (Ethiopic digits)
|
|
54
|
+
*
|
|
55
|
+
* Notes:
|
|
56
|
+
*
|
|
57
|
+
* - Weekday names are taken from `Intl.DateTimeFormat(locale.code)`.
|
|
58
|
+
* - Month names are Amharic by default; they switch to Latin transliteration when
|
|
59
|
+
* `locale.code` starts with `en` or when `numerals` is `latn`.
|
|
60
|
+
* - Time tokens like `hh:mm a` are formatted via `Intl.DateTimeFormat` using the
|
|
61
|
+
* provided `locale`.
|
|
62
|
+
*
|
|
63
|
+
* @see https://daypicker.dev/docs/localization#ethiopic-calendar
|
|
64
|
+
*/
|
|
65
|
+
function DayPicker(props) {
|
|
66
|
+
return (react_1.default.createElement(index_js_1.DayPicker, { ...props, locale: props.locale ?? am_ET_js_1.default, numerals: props.numerals ?? "geez",
|
|
67
|
+
// Pass overrides, not a DateLib instance
|
|
68
|
+
dateLib: ethiopicDateLib }));
|
|
69
|
+
}
|
|
70
|
+
/** Returns the date library used in the calendar. */
|
|
71
|
+
const getDateLib = (options) => {
|
|
72
|
+
return new index_js_1.DateLib(options, ethiopicDateLib);
|
|
73
|
+
};
|
|
74
|
+
exports.getDateLib = getDateLib;
|
|
75
|
+
// Export a minimal Amharic (Ethiopia) date-fns locale that uses Intl
|
|
76
|
+
var am_ET_js_2 = require("./locale/am-ET.js");
|
|
77
|
+
Object.defineProperty(exports, "amET", { enumerable: true, get: function () { return am_ET_js_2.amET; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the specified number of months to the given Ethiopian date. Handles
|
|
3
|
+
* month overflow and year boundaries correctly.
|
|
4
|
+
*
|
|
5
|
+
* @param date - The starting gregorian date
|
|
6
|
+
* @param amount - The number of months to add (can be negative)
|
|
7
|
+
* @returns A new gregorian date with the months added
|
|
8
|
+
*/
|
|
9
|
+
export declare function addMonths(date: Date, amount: number): Date;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addMonths = addMonths;
|
|
4
|
+
const daysInMonth_js_1 = require("../utils/daysInMonth.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* Adds the specified number of months to the given Ethiopian date. Handles
|
|
8
|
+
* month overflow and year boundaries correctly.
|
|
9
|
+
*
|
|
10
|
+
* @param date - The starting gregorian date
|
|
11
|
+
* @param amount - The number of months to add (can be negative)
|
|
12
|
+
* @returns A new gregorian date with the months added
|
|
13
|
+
*/
|
|
14
|
+
function addMonths(date, amount) {
|
|
15
|
+
const { year, month, day } = (0, index_js_1.toEthiopicDate)(date);
|
|
16
|
+
let newMonth = month + amount;
|
|
17
|
+
const yearAdjustment = Math.floor((newMonth - 1) / 13);
|
|
18
|
+
newMonth = ((newMonth - 1) % 13) + 1;
|
|
19
|
+
if (newMonth < 1) {
|
|
20
|
+
newMonth += 13;
|
|
21
|
+
}
|
|
22
|
+
const newYear = year + yearAdjustment;
|
|
23
|
+
// Adjust day if it exceeds the month length
|
|
24
|
+
const monthLength = (0, daysInMonth_js_1.daysInMonth)(newMonth, newYear);
|
|
25
|
+
const newDay = Math.min(day, monthLength);
|
|
26
|
+
return (0, index_js_1.toGregorianDate)({ year: newYear, month: newMonth, day: newDay });
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the specified number of years to the given Ethiopian date. Handles leap
|
|
3
|
+
* year transitions for Pagume month.
|
|
4
|
+
*
|
|
5
|
+
* @param date - The starting gregorian date
|
|
6
|
+
* @param amount - The number of years to add (can be negative)
|
|
7
|
+
* @returns A new gregorian date with the years added
|
|
8
|
+
*/
|
|
9
|
+
export declare function addYears(date: Date, amount: number): Date;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addYears = addYears;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Adds the specified number of years to the given Ethiopian date. Handles leap
|
|
7
|
+
* year transitions for Pagume month.
|
|
8
|
+
*
|
|
9
|
+
* @param date - The starting gregorian date
|
|
10
|
+
* @param amount - The number of years to add (can be negative)
|
|
11
|
+
* @returns A new gregorian date with the years added
|
|
12
|
+
*/
|
|
13
|
+
function addYears(date, amount) {
|
|
14
|
+
const etDate = (0, index_js_1.toEthiopicDate)(date);
|
|
15
|
+
const day = (0, index_js_1.isEthiopicLeapYear)(etDate.year) &&
|
|
16
|
+
etDate.month === 13 &&
|
|
17
|
+
etDate.day === 6 &&
|
|
18
|
+
amount % 4 !== 0
|
|
19
|
+
? 5
|
|
20
|
+
: etDate.day;
|
|
21
|
+
return (0, index_js_1.toGregorianDate)({
|
|
22
|
+
month: etDate.month,
|
|
23
|
+
day: day,
|
|
24
|
+
year: etDate.year + amount,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Difference in calendar months
|
|
3
|
+
*
|
|
4
|
+
* @param {Date} dateLeft - The later date
|
|
5
|
+
* @param {Date} dateRight - The earlier date
|
|
6
|
+
* @returns {number} The number of calendar months between the two dates
|
|
7
|
+
*/
|
|
8
|
+
export declare function differenceInCalendarMonths(dateLeft: Date, dateRight: Date): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.differenceInCalendarMonths = differenceInCalendarMonths;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Difference in calendar months
|
|
7
|
+
*
|
|
8
|
+
* @param {Date} dateLeft - The later date
|
|
9
|
+
* @param {Date} dateRight - The earlier date
|
|
10
|
+
* @returns {number} The number of calendar months between the two dates
|
|
11
|
+
*/
|
|
12
|
+
function differenceInCalendarMonths(dateLeft, dateRight) {
|
|
13
|
+
const ethiopicLeft = (0, index_js_1.toEthiopicDate)(dateLeft);
|
|
14
|
+
const ethiopicRight = (0, index_js_1.toEthiopicDate)(dateRight);
|
|
15
|
+
return ((ethiopicLeft.year - ethiopicRight.year) * 13 +
|
|
16
|
+
(ethiopicLeft.month - ethiopicRight.month));
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Interval } from "date-fns";
|
|
2
|
+
/**
|
|
3
|
+
* Each month of an interval
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} interval - The interval object
|
|
6
|
+
* @param {Date} interval.start - The start date of the interval
|
|
7
|
+
* @param {Date} interval.end - The end date of the interval
|
|
8
|
+
* @returns {Date[]} An array of dates representing the start of each month in
|
|
9
|
+
* the interval
|
|
10
|
+
*/
|
|
11
|
+
export declare function eachMonthOfInterval(interval: Interval): Date[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eachMonthOfInterval = eachMonthOfInterval;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Each month of an interval
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} interval - The interval object
|
|
9
|
+
* @param {Date} interval.start - The start date of the interval
|
|
10
|
+
* @param {Date} interval.end - The end date of the interval
|
|
11
|
+
* @returns {Date[]} An array of dates representing the start of each month in
|
|
12
|
+
* the interval
|
|
13
|
+
*/
|
|
14
|
+
function eachMonthOfInterval(interval) {
|
|
15
|
+
const start = (0, index_js_1.toEthiopicDate)(new Date(interval.start));
|
|
16
|
+
const end = (0, index_js_1.toEthiopicDate)(new Date(interval.end));
|
|
17
|
+
const dates = [];
|
|
18
|
+
let currentYear = start.year;
|
|
19
|
+
let currentMonth = start.month;
|
|
20
|
+
while (currentYear < end.year ||
|
|
21
|
+
(currentYear === end.year && currentMonth <= end.month)) {
|
|
22
|
+
dates.push((0, index_js_1.toGregorianDate)({ year: currentYear, month: currentMonth, day: 1 }));
|
|
23
|
+
currentMonth++;
|
|
24
|
+
if (currentMonth > 13) {
|
|
25
|
+
currentMonth = 1;
|
|
26
|
+
currentYear++;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return dates;
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the last day of the Ethiopian month for the given date.
|
|
3
|
+
*
|
|
4
|
+
* @param date - The gregorian date to get the end of month for
|
|
5
|
+
* @returns A new gregorian date representing the last day of the Ethiopian
|
|
6
|
+
* month
|
|
7
|
+
*/
|
|
8
|
+
export declare function endOfMonth(date: Date): Date;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.endOfMonth = endOfMonth;
|
|
4
|
+
const daysInMonth_js_1 = require("../utils/daysInMonth.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the last day of the Ethiopian month for the given date.
|
|
8
|
+
*
|
|
9
|
+
* @param date - The gregorian date to get the end of month for
|
|
10
|
+
* @returns A new gregorian date representing the last day of the Ethiopian
|
|
11
|
+
* month
|
|
12
|
+
*/
|
|
13
|
+
function endOfMonth(date) {
|
|
14
|
+
const { year, month } = (0, index_js_1.toEthiopicDate)(date);
|
|
15
|
+
const day = (0, daysInMonth_js_1.daysInMonth)(month, year);
|
|
16
|
+
return (0, index_js_1.toGregorianDate)({ year, month, day: day });
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EndOfWeekOptions } from "date-fns";
|
|
2
|
+
/**
|
|
3
|
+
* End of week
|
|
4
|
+
*
|
|
5
|
+
* @param {Date} date - The original date
|
|
6
|
+
* @param {EndOfWeekOptions} [options] - The options object
|
|
7
|
+
* @returns {Date} The end of the week
|
|
8
|
+
*/
|
|
9
|
+
export declare function endOfWeek(date: Date, options?: EndOfWeekOptions): Date;
|