react-native-bikram-sambat 0.1.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/LICENSE +21 -0
- package/README.md +340 -0
- package/lib/commonjs/accessibility/index.js +25 -0
- package/lib/commonjs/accessibility/index.js.map +1 -0
- package/lib/commonjs/accessibility/labels.js +20 -0
- package/lib/commonjs/accessibility/labels.js.map +1 -0
- package/lib/commonjs/calendar/calendar-types.js +6 -0
- package/lib/commonjs/calendar/calendar-types.js.map +1 -0
- package/lib/commonjs/calendar/get-calendar-month-grid.js +114 -0
- package/lib/commonjs/calendar/get-calendar-month-grid.js.map +1 -0
- package/lib/commonjs/calendar/index.js +13 -0
- package/lib/commonjs/calendar/index.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +137 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +116 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +114 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarWeekdays.js +44 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarWeekdays.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +288 -0
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/index.js +13 -0
- package/lib/commonjs/components/NepaliCalendar/index.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/types.js +6 -0
- package/lib/commonjs/components/NepaliCalendar/types.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +185 -0
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +148 -0
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/index.js +20 -0
- package/lib/commonjs/components/NepaliDatePicker/index.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/types.js +6 -0
- package/lib/commonjs/components/NepaliDatePicker/types.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +187 -0
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +275 -0
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/index.js +57 -0
- package/lib/commonjs/components/NepaliRangePicker/index.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js +70 -0
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/types.js +6 -0
- package/lib/commonjs/components/NepaliRangePicker/types.js.map +1 -0
- package/lib/commonjs/core/arithmetic.js +36 -0
- package/lib/commonjs/core/arithmetic.js.map +1 -0
- package/lib/commonjs/core/bsData.js +89 -0
- package/lib/commonjs/core/bsData.js.map +1 -0
- package/lib/commonjs/core/conversion.js +53 -0
- package/lib/commonjs/core/conversion.js.map +1 -0
- package/lib/commonjs/core/dateKey.js +31 -0
- package/lib/commonjs/core/dateKey.js.map +1 -0
- package/lib/commonjs/core/epochDay.js +47 -0
- package/lib/commonjs/core/epochDay.js.map +1 -0
- package/lib/commonjs/core/format/format.js +86 -0
- package/lib/commonjs/core/format/format.js.map +1 -0
- package/lib/commonjs/core/format/index.js +20 -0
- package/lib/commonjs/core/format/index.js.map +1 -0
- package/lib/commonjs/core/format/parse.js +41 -0
- package/lib/commonjs/core/format/parse.js.map +1 -0
- package/lib/commonjs/core/format/tokens.js +9 -0
- package/lib/commonjs/core/format/tokens.js.map +1 -0
- package/lib/commonjs/core/index.js +116 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/core/locale/en.js +15 -0
- package/lib/commonjs/core/locale/en.js.map +1 -0
- package/lib/commonjs/core/locale/index.js +20 -0
- package/lib/commonjs/core/locale/index.js.map +1 -0
- package/lib/commonjs/core/locale/ne.js +15 -0
- package/lib/commonjs/core/locale/ne.js.map +1 -0
- package/lib/commonjs/core/locale/types.js +2 -0
- package/lib/commonjs/core/locale/types.js.map +1 -0
- package/lib/commonjs/core/numerals/index.js +19 -0
- package/lib/commonjs/core/numerals/index.js.map +1 -0
- package/lib/commonjs/core/numerals/nepali-numerals.js +28 -0
- package/lib/commonjs/core/numerals/nepali-numerals.js.map +1 -0
- package/lib/commonjs/core/types.js +2 -0
- package/lib/commonjs/core/types.js.map +1 -0
- package/lib/commonjs/core/validation.js +125 -0
- package/lib/commonjs/core/validation.js.map +1 -0
- package/lib/commonjs/core/validation.test.js +248 -0
- package/lib/commonjs/core/validation.test.js.map +1 -0
- package/lib/commonjs/exports.test.js +133 -0
- package/lib/commonjs/exports.test.js.map +1 -0
- package/lib/commonjs/index.js +94 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/phase2.test.js +446 -0
- package/lib/commonjs/phase2.test.js.map +1 -0
- package/lib/commonjs/phase3.test.js +91 -0
- package/lib/commonjs/phase3.test.js.map +1 -0
- package/lib/commonjs/phase4.test.js +89 -0
- package/lib/commonjs/phase4.test.js.map +1 -0
- package/lib/commonjs/phase5.test.js +246 -0
- package/lib/commonjs/phase5.test.js.map +1 -0
- package/lib/commonjs/phase7.test.js +284 -0
- package/lib/commonjs/phase7.test.js.map +1 -0
- package/lib/commonjs/range-helpers.test.js +182 -0
- package/lib/commonjs/range-helpers.test.js.map +1 -0
- package/lib/commonjs/theme/create-theme.js +37 -0
- package/lib/commonjs/theme/create-theme.js.map +1 -0
- package/lib/commonjs/theme/default-theme.js +99 -0
- package/lib/commonjs/theme/default-theme.js.map +1 -0
- package/lib/commonjs/theme/index.js +26 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/types.js +6 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/utils/date-helpers.js +106 -0
- package/lib/commonjs/utils/date-helpers.js.map +1 -0
- package/lib/commonjs/utils/index.js +49 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/accessibility/index.js +4 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/labels.js +15 -0
- package/lib/module/accessibility/labels.js.map +1 -0
- package/lib/module/calendar/calendar-types.js +4 -0
- package/lib/module/calendar/calendar-types.js.map +1 -0
- package/lib/module/calendar/get-calendar-month-grid.js +111 -0
- package/lib/module/calendar/get-calendar-month-grid.js.map +1 -0
- package/lib/module/calendar/index.js +4 -0
- package/lib/module/calendar/index.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarDay.js +132 -0
- package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarGrid.js +111 -0
- package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarHeader.js +109 -0
- package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarWeekdays.js +39 -0
- package/lib/module/components/NepaliCalendar/CalendarWeekdays.js.map +1 -0
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js +283 -0
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -0
- package/lib/module/components/NepaliCalendar/index.js +4 -0
- package/lib/module/components/NepaliCalendar/index.js.map +1 -0
- package/lib/module/components/NepaliCalendar/types.js +4 -0
- package/lib/module/components/NepaliCalendar/types.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js +180 -0
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +143 -0
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/index.js +5 -0
- package/lib/module/components/NepaliDatePicker/index.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/types.js +4 -0
- package/lib/module/components/NepaliDatePicker/types.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +182 -0
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js +270 -0
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/index.js +6 -0
- package/lib/module/components/NepaliRangePicker/index.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/range-utils.js +61 -0
- package/lib/module/components/NepaliRangePicker/range-utils.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/types.js +4 -0
- package/lib/module/components/NepaliRangePicker/types.js.map +1 -0
- package/lib/module/core/arithmetic.js +29 -0
- package/lib/module/core/arithmetic.js.map +1 -0
- package/lib/module/core/bsData.js +82 -0
- package/lib/module/core/bsData.js.map +1 -0
- package/lib/module/core/conversion.js +48 -0
- package/lib/module/core/conversion.js.map +1 -0
- package/lib/module/core/dateKey.js +26 -0
- package/lib/module/core/dateKey.js.map +1 -0
- package/lib/module/core/epochDay.js +39 -0
- package/lib/module/core/epochDay.js.map +1 -0
- package/lib/module/core/format/format.js +82 -0
- package/lib/module/core/format/format.js.map +1 -0
- package/lib/module/core/format/index.js +5 -0
- package/lib/module/core/format/index.js.map +1 -0
- package/lib/module/core/format/parse.js +37 -0
- package/lib/module/core/format/parse.js.map +1 -0
- package/lib/module/core/format/tokens.js +5 -0
- package/lib/module/core/format/tokens.js.map +1 -0
- package/lib/module/core/index.js +13 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/locale/en.js +11 -0
- package/lib/module/core/locale/en.js.map +1 -0
- package/lib/module/core/locale/index.js +5 -0
- package/lib/module/core/locale/index.js.map +1 -0
- package/lib/module/core/locale/ne.js +11 -0
- package/lib/module/core/locale/ne.js.map +1 -0
- package/lib/module/core/locale/types.js +2 -0
- package/lib/module/core/locale/types.js.map +1 -0
- package/lib/module/core/numerals/index.js +4 -0
- package/lib/module/core/numerals/index.js.map +1 -0
- package/lib/module/core/numerals/nepali-numerals.js +23 -0
- package/lib/module/core/numerals/nepali-numerals.js.map +1 -0
- package/lib/module/core/types.js +2 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/validation.js +115 -0
- package/lib/module/core/validation.js.map +1 -0
- package/lib/module/core/validation.test.js +248 -0
- package/lib/module/core/validation.test.js.map +1 -0
- package/lib/module/exports.test.js +133 -0
- package/lib/module/exports.test.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/phase2.test.js +446 -0
- package/lib/module/phase2.test.js.map +1 -0
- package/lib/module/phase3.test.js +91 -0
- package/lib/module/phase3.test.js.map +1 -0
- package/lib/module/phase4.test.js +89 -0
- package/lib/module/phase4.test.js.map +1 -0
- package/lib/module/phase5.test.js +246 -0
- package/lib/module/phase5.test.js.map +1 -0
- package/lib/module/phase7.test.js +284 -0
- package/lib/module/phase7.test.js.map +1 -0
- package/lib/module/range-helpers.test.js +182 -0
- package/lib/module/range-helpers.test.js.map +1 -0
- package/lib/module/theme/create-theme.js +33 -0
- package/lib/module/theme/create-theme.js.map +1 -0
- package/lib/module/theme/default-theme.js +95 -0
- package/lib/module/theme/default-theme.js.map +1 -0
- package/lib/module/theme/index.js +5 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/types.js +4 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/utils/date-helpers.js +96 -0
- package/lib/module/utils/date-helpers.js.map +1 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/src/accessibility/index.d.ts +2 -0
- package/lib/typescript/src/accessibility/index.d.ts.map +1 -0
- package/lib/typescript/src/accessibility/labels.d.ts +6 -0
- package/lib/typescript/src/accessibility/labels.d.ts.map +1 -0
- package/lib/typescript/src/calendar/calendar-types.d.ts +23 -0
- package/lib/typescript/src/calendar/calendar-types.d.ts.map +1 -0
- package/lib/typescript/src/calendar/get-calendar-month-grid.d.ts +3 -0
- package/lib/typescript/src/calendar/get-calendar-month-grid.d.ts.map +1 -0
- package/lib/typescript/src/calendar/index.d.ts +3 -0
- package/lib/typescript/src/calendar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +23 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +25 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +17 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarWeekdays.d.ts +11 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarWeekdays.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +4 -0
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/index.d.ts +3 -0
- package/lib/typescript/src/components/NepaliCalendar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts +52 -0
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +4 -0
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +4 -0
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +4 -0
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +50 -0
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +4 -0
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +4 -0
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +5 -0
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +13 -0
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +61 -0
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +1 -0
- package/lib/typescript/src/core/arithmetic.d.ts +6 -0
- package/lib/typescript/src/core/arithmetic.d.ts.map +1 -0
- package/lib/typescript/src/core/bsData.d.ts +39 -0
- package/lib/typescript/src/core/bsData.d.ts.map +1 -0
- package/lib/typescript/src/core/conversion.d.ts +4 -0
- package/lib/typescript/src/core/conversion.d.ts.map +1 -0
- package/lib/typescript/src/core/dateKey.d.ts +4 -0
- package/lib/typescript/src/core/dateKey.d.ts.map +1 -0
- package/lib/typescript/src/core/epochDay.d.ts +7 -0
- package/lib/typescript/src/core/epochDay.d.ts.map +1 -0
- package/lib/typescript/src/core/format/format.d.ts +8 -0
- package/lib/typescript/src/core/format/format.d.ts.map +1 -0
- package/lib/typescript/src/core/format/index.d.ts +5 -0
- package/lib/typescript/src/core/format/index.d.ts.map +1 -0
- package/lib/typescript/src/core/format/parse.d.ts +7 -0
- package/lib/typescript/src/core/format/parse.d.ts.map +1 -0
- package/lib/typescript/src/core/format/tokens.d.ts +4 -0
- package/lib/typescript/src/core/format/tokens.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +11 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/en.d.ts +3 -0
- package/lib/typescript/src/core/locale/en.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/index.d.ts +4 -0
- package/lib/typescript/src/core/locale/index.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/ne.d.ts +3 -0
- package/lib/typescript/src/core/locale/ne.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/types.d.ts +11 -0
- package/lib/typescript/src/core/locale/types.d.ts.map +1 -0
- package/lib/typescript/src/core/numerals/index.d.ts +2 -0
- package/lib/typescript/src/core/numerals/index.d.ts.map +1 -0
- package/lib/typescript/src/core/numerals/nepali-numerals.d.ts +3 -0
- package/lib/typescript/src/core/numerals/nepali-numerals.d.ts.map +1 -0
- package/lib/typescript/src/core/types.d.ts +14 -0
- package/lib/typescript/src/core/types.d.ts.map +1 -0
- package/lib/typescript/src/core/validation.d.ts +17 -0
- package/lib/typescript/src/core/validation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/create-theme.d.ts +6 -0
- package/lib/typescript/src/theme/create-theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/default-theme.d.ts +4 -0
- package/lib/typescript/src/theme/default-theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +4 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/types.d.ts +43 -0
- package/lib/typescript/src/theme/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/date-helpers.d.ts +27 -0
- package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +2 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/package.json +85 -0
- package/src/accessibility/index.ts +5 -0
- package/src/accessibility/labels.ts +22 -0
- package/src/calendar/calendar-types.ts +25 -0
- package/src/calendar/get-calendar-month-grid.ts +125 -0
- package/src/calendar/index.ts +2 -0
- package/src/components/NepaliCalendar/CalendarDay.tsx +198 -0
- package/src/components/NepaliCalendar/CalendarGrid.tsx +159 -0
- package/src/components/NepaliCalendar/CalendarHeader.tsx +126 -0
- package/src/components/NepaliCalendar/CalendarWeekdays.tsx +49 -0
- package/src/components/NepaliCalendar/NepaliCalendar.tsx +279 -0
- package/src/components/NepaliCalendar/index.ts +6 -0
- package/src/components/NepaliCalendar/types.ts +62 -0
- package/src/components/NepaliDatePicker/DatePickerModal.tsx +220 -0
- package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +171 -0
- package/src/components/NepaliDatePicker/index.ts +3 -0
- package/src/components/NepaliDatePicker/types.ts +70 -0
- package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +206 -0
- package/src/components/NepaliRangePicker/RangePickerModal.tsx +336 -0
- package/src/components/NepaliRangePicker/index.ts +11 -0
- package/src/components/NepaliRangePicker/range-utils.ts +75 -0
- package/src/components/NepaliRangePicker/types.ts +84 -0
- package/src/core/arithmetic.ts +34 -0
- package/src/core/bsData.ts +115 -0
- package/src/core/conversion.ts +73 -0
- package/src/core/dateKey.ts +31 -0
- package/src/core/epochDay.ts +49 -0
- package/src/core/format/format.ts +108 -0
- package/src/core/format/index.ts +4 -0
- package/src/core/format/parse.ts +68 -0
- package/src/core/format/tokens.ts +35 -0
- package/src/core/index.ts +10 -0
- package/src/core/locale/en.ts +23 -0
- package/src/core/locale/index.ts +3 -0
- package/src/core/locale/ne.ts +31 -0
- package/src/core/locale/types.ts +12 -0
- package/src/core/numerals/index.ts +1 -0
- package/src/core/numerals/nepali-numerals.ts +27 -0
- package/src/core/types.ts +15 -0
- package/src/core/validation.test.ts +207 -0
- package/src/core/validation.ts +141 -0
- package/src/exports.test.ts +135 -0
- package/src/index.ts +8 -0
- package/src/phase2.test.ts +424 -0
- package/src/phase3.test.ts +83 -0
- package/src/phase4.test.ts +86 -0
- package/src/phase5.test.ts +257 -0
- package/src/phase7.test.ts +307 -0
- package/src/range-helpers.test.ts +153 -0
- package/src/theme/create-theme.ts +29 -0
- package/src/theme/default-theme.ts +99 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/types.ts +44 -0
- package/src/utils/date-helpers.ts +146 -0
- package/src/utils/index.ts +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FORMAT_TOKENS","exports","NUMERIC_TOKENS","Set"],"sourceRoot":"../../../../src","sources":["core/format/tokens.ts"],"mappings":";;;;;;AAaO,MAAMA,aAAqC,GAAAC,OAAA,CAAAD,aAAA,GAAG,CACnD,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,GAAG,EACH,IAAI,EACJ,GAAG,CACJ;AAEM,MAAME,cAAwC,GAAAD,OAAA,CAAAC,cAAA,GAAG,IAAIC,GAAG,CAAC,CAC9D,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,GAAG,CACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _types = require("./types");
|
|
7
|
+
Object.keys(_types).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _types[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _epochDay = require("./epochDay");
|
|
18
|
+
Object.keys(_epochDay).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _epochDay[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _epochDay[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _bsData = require("./bsData");
|
|
29
|
+
Object.keys(_bsData).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _bsData[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _bsData[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _conversion = require("./conversion");
|
|
40
|
+
Object.keys(_conversion).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _conversion[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _conversion[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _dateKey = require("./dateKey");
|
|
51
|
+
Object.keys(_dateKey).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _dateKey[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _dateKey[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _validation = require("./validation");
|
|
62
|
+
Object.keys(_validation).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _validation[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _validation[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _arithmetic = require("./arithmetic");
|
|
73
|
+
Object.keys(_arithmetic).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _arithmetic[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _arithmetic[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _numerals = require("./numerals");
|
|
84
|
+
Object.keys(_numerals).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _numerals[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _numerals[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _locale = require("./locale");
|
|
95
|
+
Object.keys(_locale).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _locale[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _locale[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _format = require("./format");
|
|
106
|
+
Object.keys(_format).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _format[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _format[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_epochDay","_bsData","_conversion","_dateKey","_validation","_arithmetic","_numerals","_locale","_format"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,SAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,SAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,SAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;M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AAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,OAAA,CAAAb,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EN_LOCALE = void 0;
|
|
7
|
+
const EN_LOCALE = exports.EN_LOCALE = {
|
|
8
|
+
code: 'en',
|
|
9
|
+
months: ['Baisakh', 'Jestha', 'Ashadh', 'Shrawan', 'Bhadra', 'Ashwin', 'Kartik', 'Mangsir', 'Poush', 'Magh', 'Falgun', 'Chaitra'],
|
|
10
|
+
monthsShort: ['Bai', 'Jes', 'Ash', 'Shr', 'Bha', 'Asw', 'Kar', 'Man', 'Pou', 'Mag', 'Fal', 'Cha'],
|
|
11
|
+
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
12
|
+
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
13
|
+
today: 'Today'
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EN_LOCALE","exports","code","months","monthsShort","weekdays","weekdaysShort","today"],"sourceRoot":"../../../../src","sources":["core/locale/en.ts"],"mappings":";;;;;;AAEO,MAAMA,SAAyB,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvCE,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,CACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,CACV;EACDC,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;EACjGC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;EACxFC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;EAChEC,KAAK,EAAE;AACT,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EN_LOCALE", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _en.EN_LOCALE;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "NE_LOCALE", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ne.NE_LOCALE;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _en = require("./en");
|
|
19
|
+
var _ne = require("./ne");
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_en","require","_ne"],"sourceRoot":"../../../../src","sources":["core/locale/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NE_LOCALE = void 0;
|
|
7
|
+
const NE_LOCALE = exports.NE_LOCALE = {
|
|
8
|
+
code: 'ne',
|
|
9
|
+
months: ['बैशाख', 'जेठ', 'असार', 'श्रावण', 'भाद्र', 'आश्विन', 'कार्तिक', 'मंसिर', 'पौष', 'माघ', 'फाल्गुन', 'चैत्र'],
|
|
10
|
+
monthsShort: ['बै', 'जे', 'अ', 'श्रा', 'भा', 'आ', 'का', 'मं', 'पौ', 'मा', 'फा', 'चै'],
|
|
11
|
+
weekdays: ['आइतबार', 'सोमबार', 'मंगलबार', 'बुधबार', 'बिहीबार', 'शुक्रबार', 'शनिबार'],
|
|
12
|
+
weekdaysShort: ['आइत', 'सोम', 'मंगल', 'बुध', 'बिही', 'शुक्र', 'शनि'],
|
|
13
|
+
today: 'आज'
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=ne.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NE_LOCALE","exports","code","months","monthsShort","weekdays","weekdaysShort","today"],"sourceRoot":"../../../../src","sources":["core/locale/ne.ts"],"mappings":";;;;;;AAEO,MAAMA,SAAyB,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvCE,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,CACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,KAAK,EACL,KAAK,EACL,SAAS,EACT,OAAO,CACR;EACDC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EACrFC,QAAQ,EAAE,CACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,CACT;EACDC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;EACpEC,KAAK,EAAE;AACT,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/locale/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "toLatinNumerals", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _nepaliNumerals.toLatinNumerals;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "toNepaliNumerals", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _nepaliNumerals.toNepaliNumerals;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _nepaliNumerals = require("./nepali-numerals");
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_nepaliNumerals","require"],"sourceRoot":"../../../../src","sources":["core/numerals/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toLatinNumerals = toLatinNumerals;
|
|
7
|
+
exports.toNepaliNumerals = toNepaliNumerals;
|
|
8
|
+
const DEVANAGARI_DIGITS = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'];
|
|
9
|
+
const LATIN_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
10
|
+
function toNepaliNumerals(value) {
|
|
11
|
+
const str = typeof value === 'number' ? String(value) : value;
|
|
12
|
+
return str.replace(/[0-9]/g, digit => DEVANAGARI_DIGITS[Number(digit)]);
|
|
13
|
+
}
|
|
14
|
+
function toLatinNumerals(value) {
|
|
15
|
+
const str = typeof value === 'number' ? String(value) : value;
|
|
16
|
+
let result = '';
|
|
17
|
+
for (let i = 0; i < str.length; i++) {
|
|
18
|
+
const char = str[i];
|
|
19
|
+
const index = DEVANAGARI_DIGITS.indexOf(char);
|
|
20
|
+
if (index !== -1) {
|
|
21
|
+
result += LATIN_DIGITS[index];
|
|
22
|
+
} else {
|
|
23
|
+
result += char;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=nepali-numerals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEVANAGARI_DIGITS","LATIN_DIGITS","toNepaliNumerals","value","str","String","replace","digit","Number","toLatinNumerals","result","i","length","char","index","indexOf"],"sourceRoot":"../../../../src","sources":["core/numerals/nepali-numerals.ts"],"mappings":";;;;;;;AAAA,MAAMA,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAC5E,MAAMC,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAEhE,SAASC,gBAAgBA,CAACC,KAAsB,EAAU;EAC/D,MAAMC,GAAG,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGE,MAAM,CAACF,KAAK,CAAC,GAAGA,KAAK;EAE7D,OAAOC,GAAG,CAACE,OAAO,CAAC,QAAQ,EAAGC,KAAK,IAAKP,iBAAiB,CAACQ,MAAM,CAACD,KAAK,CAAC,CAAC,CAAC;AAC3E;AAEO,SAASE,eAAeA,CAACN,KAAsB,EAAU;EAC9D,MAAMC,GAAG,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGE,MAAM,CAACF,KAAK,CAAC,GAAGA,KAAK;EAE7D,IAAIO,MAAM,GAAG,EAAE;EAEf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,GAAG,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IACnC,MAAME,IAAI,GAAGT,GAAG,CAACO,CAAC,CAAC;IACnB,MAAMG,KAAK,GAAGd,iBAAiB,CAACe,OAAO,CAACF,IAAI,CAAC;IAE7C,IAAIC,KAAK,KAAK,CAAC,CAAC,EAAE;MAChBJ,MAAM,IAAIT,YAAY,CAACa,KAAK,CAAC;IAC/B,CAAC,MAAM;MACLJ,MAAM,IAAIG,IAAI;IAChB;EACF;EAEA,OAAOH,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["core/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clampBSDateToSupportedRange = clampBSDateToSupportedRange;
|
|
7
|
+
exports.getBSMonthLength = getBSMonthLength;
|
|
8
|
+
exports.getDefaultSupportedBSDate = getDefaultSupportedBSDate;
|
|
9
|
+
exports.getSafeCalendarMonth = getSafeCalendarMonth;
|
|
10
|
+
exports.isBSDateInSupportedRange = isBSDateInSupportedRange;
|
|
11
|
+
exports.isValidADDate = isValidADDate;
|
|
12
|
+
exports.isValidBSDate = isValidBSDate;
|
|
13
|
+
var _bsData = require("./bsData");
|
|
14
|
+
var _epochDay = require("./epochDay");
|
|
15
|
+
function getBSMonthLength(year, month) {
|
|
16
|
+
const monthLengths = _bsData.BS_CALENDAR_DATA.monthLengthsByYear[year];
|
|
17
|
+
if (!monthLengths) {
|
|
18
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
19
|
+
throw new RangeError(`BS year ${year} is outside the supported data range (${range.min}–${range.max}).`);
|
|
20
|
+
}
|
|
21
|
+
if (!Number.isInteger(month) || month < 1 || month > 12) {
|
|
22
|
+
throw new RangeError(`BS month must be an integer from 1 to 12.`);
|
|
23
|
+
}
|
|
24
|
+
return monthLengths[month - 1];
|
|
25
|
+
}
|
|
26
|
+
function isValidBSDate(date) {
|
|
27
|
+
if (date.calendar !== 'BS' || !Number.isInteger(date.year) || !Number.isInteger(date.month) || !Number.isInteger(date.day) || date.month < 1 || date.month > 12) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
31
|
+
if (date.year < range.min || date.year > range.max) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const monthLengths = _bsData.BS_CALENDAR_DATA.monthLengthsByYear[date.year];
|
|
35
|
+
if (!monthLengths) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return date.day >= 1 && date.day <= monthLengths[date.month - 1];
|
|
39
|
+
}
|
|
40
|
+
function isBSDateInSupportedRange(date) {
|
|
41
|
+
if (date.calendar !== 'BS' || !Number.isInteger(date.year) || !Number.isInteger(date.month) || !Number.isInteger(date.day)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
45
|
+
return date.year >= range.min && date.year <= range.max;
|
|
46
|
+
}
|
|
47
|
+
function clampBSDateToSupportedRange(date) {
|
|
48
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
49
|
+
if (date.year < range.min) {
|
|
50
|
+
return {
|
|
51
|
+
calendar: 'BS',
|
|
52
|
+
year: range.min,
|
|
53
|
+
month: 1,
|
|
54
|
+
day: 1
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (date.year > range.max) {
|
|
58
|
+
return {
|
|
59
|
+
calendar: 'BS',
|
|
60
|
+
year: range.max,
|
|
61
|
+
month: 12,
|
|
62
|
+
day: 30
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const monthLengths = _bsData.BS_CALENDAR_DATA.monthLengthsByYear[date.year];
|
|
66
|
+
if (!monthLengths) {
|
|
67
|
+
return {
|
|
68
|
+
calendar: 'BS',
|
|
69
|
+
year: range.min,
|
|
70
|
+
month: 1,
|
|
71
|
+
day: 1
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const clampedMonth = Math.max(1, Math.min(12, date.month));
|
|
75
|
+
const maxDay = monthLengths[clampedMonth - 1];
|
|
76
|
+
const clampedDay = Math.max(1, Math.min(maxDay, date.day));
|
|
77
|
+
return {
|
|
78
|
+
calendar: 'BS',
|
|
79
|
+
year: date.year,
|
|
80
|
+
month: clampedMonth,
|
|
81
|
+
day: clampedDay
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function getDefaultSupportedBSDate() {
|
|
85
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
86
|
+
return {
|
|
87
|
+
calendar: 'BS',
|
|
88
|
+
year: range.min,
|
|
89
|
+
month: 1,
|
|
90
|
+
day: 1
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function getSafeCalendarMonth(input) {
|
|
94
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
95
|
+
if (input?.value && isBSDateInSupportedRange(input.value)) {
|
|
96
|
+
return {
|
|
97
|
+
year: input.value.year,
|
|
98
|
+
month: input.value.month
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (input?.defaultValue && isBSDateInSupportedRange(input.defaultValue)) {
|
|
102
|
+
return {
|
|
103
|
+
year: input.defaultValue.year,
|
|
104
|
+
month: input.defaultValue.month
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (input?.year != null && input?.month != null && input.year >= range.min && input.year <= range.max && input.month >= 1 && input.month <= 12) {
|
|
108
|
+
return {
|
|
109
|
+
year: input.year,
|
|
110
|
+
month: input.month
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
year: range.min,
|
|
115
|
+
month: 1
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function isValidADDate(date) {
|
|
119
|
+
if (date.calendar !== 'AD' || !Number.isInteger(date.year) || !Number.isInteger(date.month) || !Number.isInteger(date.day) || date.month < 1 || date.month > 12 || date.day < 1) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const value = new Date((0, _epochDay.utcMillisForADDate)(date));
|
|
123
|
+
return value.getUTCFullYear() === date.year && value.getUTCMonth() + 1 === date.month && value.getUTCDate() === date.day;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_bsData","require","_epochDay","getBSMonthLength","year","month","monthLengths","BS_CALENDAR_DATA","monthLengthsByYear","range","getSupportedBSYearRange","RangeError","min","max","Number","isInteger","isValidBSDate","date","calendar","day","isBSDateInSupportedRange","clampBSDateToSupportedRange","clampedMonth","Math","maxDay","clampedDay","getDefaultSupportedBSDate","getSafeCalendarMonth","input","value","defaultValue","isValidADDate","Date","utcMillisForADDate","getUTCFullYear","getUTCMonth","getUTCDate"],"sourceRoot":"../../../src","sources":["core/validation.ts"],"mappings":";;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,SAASE,gBAAgBA,CAACC,IAAY,EAAEC,KAAa,EAAU;EACpE,MAAMC,YAAY,GAAGC,wBAAgB,CAACC,kBAAkB,CAACJ,IAAI,CAAC;EAE9D,IAAI,CAACE,YAAY,EAAE;IACjB,MAAMG,KAAK,GAAG,IAAAC,+BAAuB,EAAC,CAAC;IACvC,MAAM,IAAIC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AAK,CAACxB,IAAI,IAAIK,KAAK,CAACG,GAAG,IACvBgB,KAAK,CAACxB,IAAI,IAAIK,KAAK,CAACI,GAAG,IACvBe,KAAK,CAACvB,KAAK,IAAI,CAAC,IAChBuB,KAAK,CAACvB,KAAK,IAAI,EAAE,EACjB;IACA,OAAO;MAAED,IAAI,EAAEwB,KAAK,CAACxB,IAAI;MAAEC,KAAK,EAAEuB,KAAK,CAACvB;IAAM,CAAC;EACjD;EAEA,OAAO;IAAED,IAAI,EAAEK,KAAK,CAACG,GAAG;IAAEP,KAAK,EAAE;EAAE,CAAC;AACtC;AAEO,SAAS0B,aAAaA,CAACd,IAAiB,EAAW;EACxD,IACEA,IAAI,CAACC,QAAQ,KAAK,IAAI,IACtB,CAACJ,MAAM,CAACC,SAAS,CAACE,IAAI,CAACb,IAAI,CAAC,IAC5B,CAACU,MAAM,CAACC,SAAS,CAACE,IAAI,CAACZ,KAAK,CAAC,IAC7B,CAACS,MAAM,CAACC,SAAS,CAACE,IAAI,CAACE,GAAG,CAAC,IAC3BF,IAAI,CAACZ,KAAK,GAAG,CAAC,IACdY,IAAI,CAACZ,KAAK,GAAG,EAAE,IACfY,IAAI,CAACE,GAAG,GAAG,CAAC,EACZ;IACA,OAAO,KAAK;EACd;EAEA,MAAMU,KAAK,GAAG,IAAIG,IAAI,CAAC,IAAAC,4BAAkB,EAAChB,IAAI,CAAC,CAAC;EAEhD,OACEY,KAAK,CAACK,cAAc,CAAC,CAAC,KAAKjB,IAAI,CAACb,IAAI,IACpCyB,KAAK,CAACM,WAAW,CAAC,CAAC,GAAG,CAAC,KAAKlB,IAAI,CAACZ,KAAK,IACtCwB,KAAK,CAACO,UAAU,CAAC,CAAC,KAAKnB,IAAI,CAACE,GAAG;AAEnC","ignoreList":[]}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _index = require("./index");
|
|
4
|
+
describe('BS date validation', () => {
|
|
5
|
+
it('accepts dates inside the available placeholder data range', () => {
|
|
6
|
+
expect((0, _index.isValidBSDate)({
|
|
7
|
+
calendar: 'BS',
|
|
8
|
+
year: 2081,
|
|
9
|
+
month: 1,
|
|
10
|
+
day: 1
|
|
11
|
+
})).toBe(true);
|
|
12
|
+
expect((0, _index.isValidBSDate)({
|
|
13
|
+
calendar: 'BS',
|
|
14
|
+
year: 2081,
|
|
15
|
+
month: 4,
|
|
16
|
+
day: 31
|
|
17
|
+
})).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
it('rejects dates outside month lengths or available data', () => {
|
|
20
|
+
expect((0, _index.isValidBSDate)({
|
|
21
|
+
calendar: 'BS',
|
|
22
|
+
year: 2081,
|
|
23
|
+
month: 8,
|
|
24
|
+
day: 30
|
|
25
|
+
})).toBe(false);
|
|
26
|
+
expect((0, _index.isValidBSDate)({
|
|
27
|
+
calendar: 'BS',
|
|
28
|
+
year: 2082,
|
|
29
|
+
month: 1,
|
|
30
|
+
day: 1
|
|
31
|
+
})).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
it('rejects dates outside the supported year range', () => {
|
|
34
|
+
expect((0, _index.isValidBSDate)({
|
|
35
|
+
calendar: 'BS',
|
|
36
|
+
year: 2080,
|
|
37
|
+
month: 1,
|
|
38
|
+
day: 1
|
|
39
|
+
})).toBe(false);
|
|
40
|
+
expect((0, _index.isValidBSDate)({
|
|
41
|
+
calendar: 'BS',
|
|
42
|
+
year: 2082,
|
|
43
|
+
month: 1,
|
|
44
|
+
day: 1
|
|
45
|
+
})).toBe(false);
|
|
46
|
+
expect((0, _index.isValidBSDate)({
|
|
47
|
+
calendar: 'BS',
|
|
48
|
+
year: 2000,
|
|
49
|
+
month: 1,
|
|
50
|
+
day: 1
|
|
51
|
+
})).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
it('returns month lengths for supported BS years', () => {
|
|
54
|
+
expect((0, _index.getBSMonthLength)(2081, 1)).toBe(31);
|
|
55
|
+
expect((0, _index.getBSMonthLength)(2081, 8)).toBe(29);
|
|
56
|
+
});
|
|
57
|
+
it('throws for unsupported years with range in message', () => {
|
|
58
|
+
expect(() => (0, _index.getBSMonthLength)(2082, 1)).toThrow(/2081–2081/);
|
|
59
|
+
expect(() => (0, _index.getBSMonthLength)(2080, 1)).toThrow(/2081–2081/);
|
|
60
|
+
expect(() => (0, _index.getBSMonthLength)(2081, 0)).toThrow(RangeError);
|
|
61
|
+
expect(() => (0, _index.getBSMonthLength)(2081, 13)).toThrow(RangeError);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('supported BS range', () => {
|
|
65
|
+
it('exports start and end year constants', () => {
|
|
66
|
+
expect(_index.SUPPORTED_BS_START_YEAR).toBe(2081);
|
|
67
|
+
expect(_index.SUPPORTED_BS_END_YEAR).toBe(2081);
|
|
68
|
+
});
|
|
69
|
+
it('getSupportedBSRange returns correct range', () => {
|
|
70
|
+
const range = (0, _index.getSupportedBSRange)();
|
|
71
|
+
expect(range).toEqual({
|
|
72
|
+
start: 2081,
|
|
73
|
+
end: 2081
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('AD date validation', () => {
|
|
78
|
+
it('accepts real AD dates and rejects calendar overflows', () => {
|
|
79
|
+
expect((0, _index.isValidADDate)({
|
|
80
|
+
calendar: 'AD',
|
|
81
|
+
year: 2024,
|
|
82
|
+
month: 2,
|
|
83
|
+
day: 29
|
|
84
|
+
})).toBe(true);
|
|
85
|
+
expect((0, _index.isValidADDate)({
|
|
86
|
+
calendar: 'AD',
|
|
87
|
+
year: 2023,
|
|
88
|
+
month: 2,
|
|
89
|
+
day: 29
|
|
90
|
+
})).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
it('handles AD years 0 through 99 without Date.UTC remapping', () => {
|
|
93
|
+
expect((0, _index.isValidADDate)({
|
|
94
|
+
calendar: 'AD',
|
|
95
|
+
year: 1,
|
|
96
|
+
month: 1,
|
|
97
|
+
day: 1
|
|
98
|
+
})).toBe(true);
|
|
99
|
+
expect((0, _index.isValidADDate)({
|
|
100
|
+
calendar: 'AD',
|
|
101
|
+
year: 1,
|
|
102
|
+
month: 2,
|
|
103
|
+
day: 29
|
|
104
|
+
})).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe('BS date keys', () => {
|
|
108
|
+
it('creates stable YYYY-MM-DD keys', () => {
|
|
109
|
+
expect((0, _index.createBSDateKey)({
|
|
110
|
+
calendar: 'BS',
|
|
111
|
+
year: 2081,
|
|
112
|
+
month: 1,
|
|
113
|
+
day: 3
|
|
114
|
+
})).toBe('2081-01-03');
|
|
115
|
+
});
|
|
116
|
+
it('parses valid keys', () => {
|
|
117
|
+
expect((0, _index.parseBSDateKey)('2081-01-03')).toEqual({
|
|
118
|
+
calendar: 'BS',
|
|
119
|
+
year: 2081,
|
|
120
|
+
month: 1,
|
|
121
|
+
day: 3
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
it('rejects malformed or invalid keys', () => {
|
|
125
|
+
expect((0, _index.parseBSDateKey)('2081-1-03')).toBeNull();
|
|
126
|
+
expect((0, _index.parseBSDateKey)('2081-08-30')).toBeNull();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
describe('Stage 1 conversion architecture', () => {
|
|
130
|
+
it('round-trips the placeholder anchor date', () => {
|
|
131
|
+
const bs = {
|
|
132
|
+
calendar: 'BS',
|
|
133
|
+
year: 2081,
|
|
134
|
+
month: 1,
|
|
135
|
+
day: 1
|
|
136
|
+
};
|
|
137
|
+
const ad = {
|
|
138
|
+
calendar: 'AD',
|
|
139
|
+
year: 2024,
|
|
140
|
+
month: 4,
|
|
141
|
+
day: 13
|
|
142
|
+
};
|
|
143
|
+
expect((0, _index.toAD)(bs)).toEqual(ad);
|
|
144
|
+
expect((0, _index.toBS)(ad)).toEqual(bs);
|
|
145
|
+
});
|
|
146
|
+
it('converts dates at the end of the available placeholder range', () => {
|
|
147
|
+
const bs = {
|
|
148
|
+
calendar: 'BS',
|
|
149
|
+
year: 2081,
|
|
150
|
+
month: 12,
|
|
151
|
+
day: 30
|
|
152
|
+
};
|
|
153
|
+
const ad = (0, _index.toAD)(bs);
|
|
154
|
+
expect((0, _index.toBS)(ad)).toEqual(bs);
|
|
155
|
+
});
|
|
156
|
+
it('throws instead of guessing outside the available placeholder range', () => {
|
|
157
|
+
expect(() => (0, _index.toBS)({
|
|
158
|
+
calendar: 'AD',
|
|
159
|
+
year: 2024,
|
|
160
|
+
month: 4,
|
|
161
|
+
day: 12
|
|
162
|
+
})).toThrow(RangeError);
|
|
163
|
+
expect(() => (0, _index.toAD)({
|
|
164
|
+
calendar: 'BS',
|
|
165
|
+
year: 2082,
|
|
166
|
+
month: 1,
|
|
167
|
+
day: 1
|
|
168
|
+
})).toThrow(RangeError);
|
|
169
|
+
});
|
|
170
|
+
it('requires year data to start at the BS anchor year', () => {
|
|
171
|
+
expect(() => (0, _index.createBSYearOffsets)({
|
|
172
|
+
anchorBS: {
|
|
173
|
+
calendar: 'BS',
|
|
174
|
+
year: 2081,
|
|
175
|
+
month: 1,
|
|
176
|
+
day: 1
|
|
177
|
+
},
|
|
178
|
+
anchorAD: {
|
|
179
|
+
calendar: 'AD',
|
|
180
|
+
year: 2024,
|
|
181
|
+
month: 4,
|
|
182
|
+
day: 13
|
|
183
|
+
},
|
|
184
|
+
monthLengthsByYear: {
|
|
185
|
+
2082: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]
|
|
186
|
+
}
|
|
187
|
+
})).toThrow(/contiguous/);
|
|
188
|
+
});
|
|
189
|
+
it('requires the BS anchor to be the first day of a BS year', () => {
|
|
190
|
+
expect(() => (0, _index.createBSYearOffsets)({
|
|
191
|
+
anchorBS: {
|
|
192
|
+
calendar: 'BS',
|
|
193
|
+
year: 2081,
|
|
194
|
+
month: 1,
|
|
195
|
+
day: 2
|
|
196
|
+
},
|
|
197
|
+
anchorAD: {
|
|
198
|
+
calendar: 'AD',
|
|
199
|
+
year: 2024,
|
|
200
|
+
month: 4,
|
|
201
|
+
day: 14
|
|
202
|
+
},
|
|
203
|
+
monthLengthsByYear: {
|
|
204
|
+
2081: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30]
|
|
205
|
+
}
|
|
206
|
+
})).toThrow(/first day/);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
describe('UTC epoch-day utilities', () => {
|
|
210
|
+
it('round-trips AD dates through integer epoch days', () => {
|
|
211
|
+
const ad = {
|
|
212
|
+
calendar: 'AD',
|
|
213
|
+
year: 2024,
|
|
214
|
+
month: 4,
|
|
215
|
+
day: 13
|
|
216
|
+
};
|
|
217
|
+
expect((0, _index.epochDayToADDate)((0, _index.jsDateToEpochDay)(new Date(Date.UTC(2024, 3, 13))))).toEqual(ad);
|
|
218
|
+
});
|
|
219
|
+
it('round-trips AD years 0 through 99 through epoch days', () => {
|
|
220
|
+
const ad = {
|
|
221
|
+
calendar: 'AD',
|
|
222
|
+
year: 1,
|
|
223
|
+
month: 1,
|
|
224
|
+
day: 1
|
|
225
|
+
};
|
|
226
|
+
expect((0, _index.epochDayToADDate)((0, _index.adDateToEpochDay)(ad))).toEqual(ad);
|
|
227
|
+
});
|
|
228
|
+
it('reads JS Date UTC parts without remapping years 0 through 99', () => {
|
|
229
|
+
const value = new Date(0);
|
|
230
|
+
value.setUTCFullYear(1, 0, 1);
|
|
231
|
+
value.setUTCHours(0, 0, 0, 0);
|
|
232
|
+
expect((0, _index.epochDayToADDate)((0, _index.jsDateToEpochDay)(value))).toEqual({
|
|
233
|
+
calendar: 'AD',
|
|
234
|
+
year: 1,
|
|
235
|
+
month: 1,
|
|
236
|
+
day: 1
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
it('returns UTC-midnight Date objects from epoch days', () => {
|
|
240
|
+
const jsDate = (0, _index.epochDayToJSDate)((0, _index.jsDateToEpochDay)(new Date(Date.UTC(2024, 3, 13, 23, 59, 59))));
|
|
241
|
+
expect(jsDate.toISOString()).toBe('2024-04-13T00:00:00.000Z');
|
|
242
|
+
});
|
|
243
|
+
it('rejects fractional epoch days', () => {
|
|
244
|
+
expect(() => (0, _index.epochDayToADDate)(1.5)).toThrow(RangeError);
|
|
245
|
+
expect(() => (0, _index.epochDayToJSDate)(1.5)).toThrow(RangeError);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
//# sourceMappingURL=validation.test.js.map
|