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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# react-native-bikram-sambat
|
|
2
|
+
|
|
3
|
+
A production-grade Bikram Sambat (BS) calendar engine and React Native date picker for React Native.
|
|
4
|
+
|
|
5
|
+
TypeScript-first helpers for BS/AD conversion, formatting, parsing, and calendar grid generation, plus ready-to-use React Native UI components with theming, dark mode, and accessibility.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install react-native-bikram-sambat
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
or
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
yarn add react-native-bikram-sambat
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Date Picker
|
|
22
|
+
|
|
23
|
+
The simplest way to let users pick a BS date:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import React, { useState } from 'react';
|
|
27
|
+
import { SafeAreaView } from 'react-native';
|
|
28
|
+
import {
|
|
29
|
+
NepaliDatePicker,
|
|
30
|
+
type BSDateValue
|
|
31
|
+
} from 'react-native-bikram-sambat';
|
|
32
|
+
|
|
33
|
+
export default function App() {
|
|
34
|
+
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
38
|
+
<NepaliDatePicker
|
|
39
|
+
value={date}
|
|
40
|
+
onChange={setDate}
|
|
41
|
+
placeholder="Select date"
|
|
42
|
+
locale="ne"
|
|
43
|
+
numerals="devanagari"
|
|
44
|
+
/>
|
|
45
|
+
</SafeAreaView>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Calendar Component
|
|
51
|
+
|
|
52
|
+
For inline calendar display:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import React, { useState } from 'react';
|
|
56
|
+
import { SafeAreaView } from 'react-native';
|
|
57
|
+
import { NepaliCalendar, type BSDateValue } from 'react-native-bikram-sambat';
|
|
58
|
+
|
|
59
|
+
export default function App() {
|
|
60
|
+
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
64
|
+
<NepaliCalendar value={date} onChange={setDate} />
|
|
65
|
+
</SafeAreaView>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Date Picker Modal
|
|
71
|
+
|
|
72
|
+
For custom modal control:
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import React, { useState } from 'react';
|
|
76
|
+
import { Button, SafeAreaView } from 'react-native';
|
|
77
|
+
import {
|
|
78
|
+
DatePickerModal,
|
|
79
|
+
type BSDateValue
|
|
80
|
+
} from 'react-native-bikram-sambat';
|
|
81
|
+
|
|
82
|
+
export default function App() {
|
|
83
|
+
const [visible, setVisible] = useState(false);
|
|
84
|
+
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
88
|
+
<Button title="Open date picker" onPress={() => setVisible(true)} />
|
|
89
|
+
|
|
90
|
+
<DatePickerModal
|
|
91
|
+
visible={visible}
|
|
92
|
+
value={date}
|
|
93
|
+
onChange={setDate}
|
|
94
|
+
onClose={() => setVisible(false)}
|
|
95
|
+
locale="ne"
|
|
96
|
+
numerals="devanagari"
|
|
97
|
+
/>
|
|
98
|
+
</SafeAreaView>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Range Picker
|
|
104
|
+
|
|
105
|
+
For selecting a date range:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import React, { useState } from 'react';
|
|
109
|
+
import { SafeAreaView } from 'react-native';
|
|
110
|
+
import {
|
|
111
|
+
NepaliRangePicker,
|
|
112
|
+
type DateRangeValue
|
|
113
|
+
} from 'react-native-bikram-sambat';
|
|
114
|
+
|
|
115
|
+
export default function App() {
|
|
116
|
+
const [range, setRange] = useState<DateRangeValue>({
|
|
117
|
+
start: null,
|
|
118
|
+
end: null,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
123
|
+
<NepaliRangePicker
|
|
124
|
+
value={range}
|
|
125
|
+
onChange={setRange}
|
|
126
|
+
placeholder="Select date range"
|
|
127
|
+
locale="ne"
|
|
128
|
+
numerals="devanagari"
|
|
129
|
+
/>
|
|
130
|
+
</SafeAreaView>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Range Picker Modal
|
|
136
|
+
|
|
137
|
+
For custom range picker modal control:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import React, { useState } from 'react';
|
|
141
|
+
import { Button, SafeAreaView } from 'react-native';
|
|
142
|
+
import {
|
|
143
|
+
RangePickerModal,
|
|
144
|
+
type DateRangeValue
|
|
145
|
+
} from 'react-native-bikram-sambat';
|
|
146
|
+
|
|
147
|
+
export default function App() {
|
|
148
|
+
const [visible, setVisible] = useState(false);
|
|
149
|
+
const [range, setRange] = useState<DateRangeValue>({
|
|
150
|
+
start: null,
|
|
151
|
+
end: null,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
156
|
+
<Button title="Open range picker" onPress={() => setVisible(true)} />
|
|
157
|
+
|
|
158
|
+
<RangePickerModal
|
|
159
|
+
visible={visible}
|
|
160
|
+
value={range}
|
|
161
|
+
onChange={setRange}
|
|
162
|
+
onClose={() => setVisible(false)}
|
|
163
|
+
locale="ne"
|
|
164
|
+
numerals="devanagari"
|
|
165
|
+
/>
|
|
166
|
+
</SafeAreaView>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Core Utilities
|
|
172
|
+
|
|
173
|
+
### BS ⇄ AD Conversion
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import { toBS, toAD, isValidBSDate, isValidADDate } from 'react-native-bikram-sambat';
|
|
177
|
+
|
|
178
|
+
const bs = toBS({ calendar: 'AD', year: 2024, month: 4, day: 13 });
|
|
179
|
+
const ad = toAD({ calendar: 'BS', year: 2081, month: 1, day: 1 });
|
|
180
|
+
|
|
181
|
+
const valid = isValidBSDate({ calendar: 'BS', year: 2081, month: 1, day: 1 });
|
|
182
|
+
const validAD = isValidADDate({ calendar: 'AD', year: 2024, month: 4, day: 13 });
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Formatting and Parsing
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
import { formatBS, parseBS, toNepaliNumerals, toLatinNumerals } from 'react-native-bikram-sambat';
|
|
189
|
+
|
|
190
|
+
const date = { calendar: 'BS', year: 2081, month: 1, day: 5 };
|
|
191
|
+
|
|
192
|
+
formatBS(date, 'yyyy-MM-dd'); // '2081-01-05'
|
|
193
|
+
formatBS(date, 'dd MMMM yyyy'); // '05 Baisakh 2081'
|
|
194
|
+
formatBS(date, 'dd MMMM yyyy', { locale: 'ne', numerals: 'devanagari' }); // '०५ बैशाख २०८१'
|
|
195
|
+
|
|
196
|
+
parseBS('2081-01-05', 'yyyy-MM-dd'); // { calendar: 'BS', year: 2081, month: 1, day: 5 }
|
|
197
|
+
|
|
198
|
+
toNepaliNumerals('2081'); // '२०८१'
|
|
199
|
+
toLatinNumerals('२०८१'); // '2081'
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Date Arithmetic
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import { compareBS, addBSDays, subBSDays, todayBS } from 'react-native-bikram-sambat';
|
|
206
|
+
|
|
207
|
+
const today = todayBS();
|
|
208
|
+
const future = addBSDays(today, 30);
|
|
209
|
+
const past = subBSDays(today, 30);
|
|
210
|
+
const cmp = compareBS(future, past); // > 0
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Date Keys
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
import { createBSDateKey, parseBSDateKey } from 'react-native-bikram-sambat';
|
|
217
|
+
|
|
218
|
+
const key = createBSDateKey({ calendar: 'BS', year: 2081, month: 1, day: 1 });
|
|
219
|
+
// '2081-01-01'
|
|
220
|
+
|
|
221
|
+
const parsed = parseBSDateKey('2081-01-01');
|
|
222
|
+
// { calendar: 'BS', year: 2081, month: 1, day: 1 }
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Supported Range
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { getSupportedBSRange, isBSDateInSupportedRange } from 'react-native-bikram-sambat';
|
|
229
|
+
|
|
230
|
+
const range = getSupportedBSRange(); // { start: 2081, end: 2081 }
|
|
231
|
+
const inRange = isBSDateInSupportedRange({ calendar: 'BS', year: 2081, month: 1, day: 1 });
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Calendar Grid
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { getCalendarMonthGrid } from 'react-native-bikram-sambat';
|
|
238
|
+
|
|
239
|
+
const grid = getCalendarMonthGrid({
|
|
240
|
+
year: 2081,
|
|
241
|
+
month: 1,
|
|
242
|
+
weekStartsOn: 0, // 0 = Sunday
|
|
243
|
+
minDate: { calendar: 'BS', year: 2081, month: 1, day: 1 },
|
|
244
|
+
maxDate: { calendar: 'BS', year: 2081, month: 12, day: 30 },
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// grid.weeks is a 2D array of cells
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## TypeScript Usage
|
|
251
|
+
|
|
252
|
+
All public APIs are fully typed:
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
import {
|
|
256
|
+
type BSDateValue,
|
|
257
|
+
type ADDateValue,
|
|
258
|
+
type DateRangeValue,
|
|
259
|
+
type CalendarTheme,
|
|
260
|
+
type CalendarMarkedDate,
|
|
261
|
+
type NepaliCalendarProps,
|
|
262
|
+
type NepaliDatePickerProps,
|
|
263
|
+
type DatePickerModalProps,
|
|
264
|
+
type NepaliRangePickerProps,
|
|
265
|
+
type RangePickerModalProps,
|
|
266
|
+
type CalendarLocale,
|
|
267
|
+
type LocaleCode,
|
|
268
|
+
type NumeralSystem,
|
|
269
|
+
} from 'react-native-bikram-sambat';
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Theme Customization
|
|
273
|
+
|
|
274
|
+
### Light and Dark Mode
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import { NepaliCalendar } from 'react-native-bikram-sambat';
|
|
278
|
+
|
|
279
|
+
// System default (auto-detects device theme)
|
|
280
|
+
<NepaliCalendar colorScheme="system" />
|
|
281
|
+
|
|
282
|
+
// Force dark mode
|
|
283
|
+
<NepaliCalendar colorScheme="dark" />
|
|
284
|
+
|
|
285
|
+
// Force light mode
|
|
286
|
+
<NepaliCalendar colorScheme="light" />
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Custom Theme Override
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
import { NepaliDatePicker, type CalendarTheme } from 'react-native-bikram-sambat';
|
|
293
|
+
|
|
294
|
+
const customTheme: Partial<CalendarTheme> = {
|
|
295
|
+
colors: {
|
|
296
|
+
primary: '#7c3aed',
|
|
297
|
+
primaryText: '#ffffff',
|
|
298
|
+
},
|
|
299
|
+
radius: {
|
|
300
|
+
day: 16,
|
|
301
|
+
calendar: 16,
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
<NepaliDatePicker theme={customTheme} />
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Local Package Testing
|
|
309
|
+
|
|
310
|
+
When developing locally, test the package before publishing:
|
|
311
|
+
|
|
312
|
+
```sh
|
|
313
|
+
npm run typecheck
|
|
314
|
+
npm test
|
|
315
|
+
npm run build
|
|
316
|
+
npm pack --dry-run
|
|
317
|
+
npm pack
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
This produces a `.tgz` file. Test it in another React Native CLI app:
|
|
321
|
+
|
|
322
|
+
```sh
|
|
323
|
+
cd /path/to/your/app
|
|
324
|
+
npm install ../Calender/react-native-bikram-sambat-0.1.0.tgz
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Supported BS Range
|
|
328
|
+
|
|
329
|
+
The package currently supports the verified BS date range included in its data table. Dates outside the supported range will throw or return `false` depending on the API.
|
|
330
|
+
|
|
331
|
+
Core conversion functions throw `RangeError` for out-of-range dates.
|
|
332
|
+
UI components handle invalid dates gracefully without crashing.
|
|
333
|
+
|
|
334
|
+
## Screenshot
|
|
335
|
+
|
|
336
|
+

|
|
337
|
+
|
|
338
|
+
## License
|
|
339
|
+
|
|
340
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "HEADER_NEXT_MONTH_LABEL", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _labels.HEADER_NEXT_MONTH_LABEL;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "HEADER_PREV_MONTH_LABEL", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _labels.HEADER_PREV_MONTH_LABEL;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getDayAccessibilityLabel", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _labels.getDayAccessibilityLabel;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _labels = require("./labels");
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_labels","require"],"sourceRoot":"../../../src","sources":["accessibility/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HEADER_PREV_MONTH_LABEL = exports.HEADER_NEXT_MONTH_LABEL = void 0;
|
|
7
|
+
exports.getDayAccessibilityLabel = getDayAccessibilityLabel;
|
|
8
|
+
var _format = require("../core/format");
|
|
9
|
+
function getDayAccessibilityLabel(date, locale, selected, today, disabled) {
|
|
10
|
+
const dateStr = (0, _format.formatBS)(date, 'yyyy MMMM d', {
|
|
11
|
+
locale
|
|
12
|
+
});
|
|
13
|
+
if (disabled) return `${dateStr}, disabled`;
|
|
14
|
+
if (selected) return `${dateStr}, selected`;
|
|
15
|
+
if (today) return `${dateStr}, today`;
|
|
16
|
+
return dateStr;
|
|
17
|
+
}
|
|
18
|
+
const HEADER_PREV_MONTH_LABEL = exports.HEADER_PREV_MONTH_LABEL = 'Previous month';
|
|
19
|
+
const HEADER_NEXT_MONTH_LABEL = exports.HEADER_NEXT_MONTH_LABEL = 'Next month';
|
|
20
|
+
//# sourceMappingURL=labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_format","require","getDayAccessibilityLabel","date","locale","selected","today","disabled","dateStr","formatBS","HEADER_PREV_MONTH_LABEL","exports","HEADER_NEXT_MONTH_LABEL"],"sourceRoot":"../../../src","sources":["accessibility/labels.ts"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,wBAAwBA,CACtCC,IAAiB,EACjBC,MAAsB,EACtBC,QAAiB,EACjBC,KAAc,EACdC,QAAiB,EACT;EACR,MAAMC,OAAO,GAAG,IAAAC,gBAAQ,EAACN,IAAI,EAAE,aAAa,EAAE;IAAEC;EAAO,CAAC,CAAC;EAEzD,IAAIG,QAAQ,EAAE,OAAO,GAAGC,OAAO,YAAY;EAC3C,IAAIH,QAAQ,EAAE,OAAO,GAAGG,OAAO,YAAY;EAC3C,IAAIF,KAAK,EAAE,OAAO,GAAGE,OAAO,SAAS;EAErC,OAAOA,OAAO;AAChB;AAEO,MAAME,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,gBAAgB;AAChD,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["calendar/calendar-types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCalendarMonthGrid = getCalendarMonthGrid;
|
|
7
|
+
var _dateKey = require("../core/dateKey");
|
|
8
|
+
var _validation = require("../core/validation");
|
|
9
|
+
var _bsData = require("../core/bsData");
|
|
10
|
+
var _arithmetic = require("../core/arithmetic");
|
|
11
|
+
var _conversion = require("../core/conversion");
|
|
12
|
+
function getWeekday(bsDate) {
|
|
13
|
+
const ad = (0, _conversion.toAD)(bsDate);
|
|
14
|
+
const utcDate = new Date(Date.UTC(ad.year, ad.month - 1, ad.day));
|
|
15
|
+
return utcDate.getUTCDay();
|
|
16
|
+
}
|
|
17
|
+
function safeGetBSMonthLength(year, month) {
|
|
18
|
+
try {
|
|
19
|
+
return (0, _validation.getBSMonthLength)(year, month);
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function safeCreateBSDateKey(date) {
|
|
25
|
+
try {
|
|
26
|
+
return (0, _dateKey.createBSDateKey)(date);
|
|
27
|
+
} catch {
|
|
28
|
+
return `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function isDateInRange(year) {
|
|
32
|
+
const range = (0, _bsData.getSupportedBSYearRange)();
|
|
33
|
+
return year >= range.min && year <= range.max;
|
|
34
|
+
}
|
|
35
|
+
function makeCell(year, month, day, inCurrentMonth, todayDate, minDate, maxDate) {
|
|
36
|
+
const date = {
|
|
37
|
+
calendar: 'BS',
|
|
38
|
+
year,
|
|
39
|
+
month,
|
|
40
|
+
day
|
|
41
|
+
};
|
|
42
|
+
const key = safeCreateBSDateKey(date);
|
|
43
|
+
const inRange = isDateInRange(year);
|
|
44
|
+
const isToday = inRange && todayDate !== null && (0, _arithmetic.compareBS)(date, todayDate) === 0;
|
|
45
|
+
const isDisabled = !inRange || minDate !== undefined && (0, _arithmetic.compareBS)(date, minDate) < 0 || maxDate !== undefined && (0, _arithmetic.compareBS)(date, maxDate) > 0;
|
|
46
|
+
return {
|
|
47
|
+
key,
|
|
48
|
+
date,
|
|
49
|
+
day,
|
|
50
|
+
inCurrentMonth,
|
|
51
|
+
isToday,
|
|
52
|
+
isDisabled
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function getCalendarMonthGrid(options) {
|
|
56
|
+
const {
|
|
57
|
+
year,
|
|
58
|
+
month,
|
|
59
|
+
weekStartsOn = 0,
|
|
60
|
+
minDate,
|
|
61
|
+
maxDate
|
|
62
|
+
} = options;
|
|
63
|
+
const monthLength = (0, _validation.getBSMonthLength)(year, month);
|
|
64
|
+
const firstDay = {
|
|
65
|
+
calendar: 'BS',
|
|
66
|
+
year,
|
|
67
|
+
month,
|
|
68
|
+
day: 1
|
|
69
|
+
};
|
|
70
|
+
const firstWeekday = getWeekday(firstDay);
|
|
71
|
+
const leadingDays = (firstWeekday - weekStartsOn + 7) % 7;
|
|
72
|
+
let prevMonth = month - 1;
|
|
73
|
+
let prevYear = year;
|
|
74
|
+
if (prevMonth < 1) {
|
|
75
|
+
prevMonth = 12;
|
|
76
|
+
prevYear -= 1;
|
|
77
|
+
}
|
|
78
|
+
const prevMonthLength = safeGetBSMonthLength(prevYear, prevMonth) ?? 30;
|
|
79
|
+
let todayDate = null;
|
|
80
|
+
try {
|
|
81
|
+
todayDate = options.today ?? (0, _arithmetic.todayBS)();
|
|
82
|
+
} catch {
|
|
83
|
+
todayDate = null;
|
|
84
|
+
}
|
|
85
|
+
const cells = [];
|
|
86
|
+
for (let i = 0; i < leadingDays; i++) {
|
|
87
|
+
const day = prevMonthLength - leadingDays + i + 1;
|
|
88
|
+
cells.push(makeCell(prevYear, prevMonth, day, false, todayDate, minDate, maxDate));
|
|
89
|
+
}
|
|
90
|
+
for (let day = 1; day <= monthLength; day++) {
|
|
91
|
+
cells.push(makeCell(year, month, day, true, todayDate, minDate, maxDate));
|
|
92
|
+
}
|
|
93
|
+
let nextMonth = month + 1;
|
|
94
|
+
let nextYear = year;
|
|
95
|
+
if (nextMonth > 12) {
|
|
96
|
+
nextMonth = 1;
|
|
97
|
+
nextYear += 1;
|
|
98
|
+
}
|
|
99
|
+
let trailingDay = 1;
|
|
100
|
+
while (cells.length % 7 !== 0) {
|
|
101
|
+
cells.push(makeCell(nextYear, nextMonth, trailingDay, false, todayDate, minDate, maxDate));
|
|
102
|
+
trailingDay += 1;
|
|
103
|
+
}
|
|
104
|
+
const weeks = [];
|
|
105
|
+
for (let i = 0; i < cells.length; i += 7) {
|
|
106
|
+
weeks.push(cells.slice(i, i + 7));
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
year,
|
|
110
|
+
month,
|
|
111
|
+
weeks
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=get-calendar-month-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateKey","require","_validation","_bsData","_arithmetic","_conversion","getWeekday","bsDate","ad","toAD","utcDate","Date","UTC","year","month","day","getUTCDay","safeGetBSMonthLength","getBSMonthLength","safeCreateBSDateKey","date","createBSDateKey","String","padStart","isDateInRange","range","getSupportedBSYearRange","min","max","makeCell","inCurrentMonth","todayDate","minDate","maxDate","calendar","key","inRange","isToday","compareBS","isDisabled","undefined","getCalendarMonthGrid","options","weekStartsOn","monthLength","firstDay","firstWeekday","leadingDays","prevMonth","prevYear","prevMonthLength","today","todayBS","cells","i","push","nextMonth","nextYear","trailingDay","length","weeks","slice"],"sourceRoot":"../../../src","sources":["calendar/get-calendar-month-grid.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getCalendarMonthGrid", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _getCalendarMonthGrid.getCalendarMonthGrid;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _getCalendarMonthGrid = require("./get-calendar-month-grid");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_getCalendarMonthGrid","require"],"sourceRoot":"../../../src","sources":["calendar/index.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,qBAAA,GAAAC,OAAA","ignoreList":[]}
|