react-native-bikram-sambat 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +44 -211
- package/lib/commonjs/accessibility/index.js +1 -1
- package/lib/commonjs/accessibility/labels.js +3 -4
- package/lib/commonjs/accessibility/labels.js.map +1 -1
- package/lib/commonjs/calendar/get-calendar-month-grid.js +5 -5
- package/lib/commonjs/calendar/index.js +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +10 -43
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +8 -25
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +26 -14
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +119 -87
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/index.js +1 -1
- package/lib/commonjs/core/arithmetic.js +3 -3
- package/lib/commonjs/core/bsData.js +107 -8
- package/lib/commonjs/core/bsData.js.map +1 -1
- package/lib/commonjs/core/conversion.js +4 -4
- package/lib/commonjs/core/conversion.js.map +1 -1
- package/lib/commonjs/core/dateKey.js +1 -1
- package/lib/commonjs/core/format/format.js +9 -9
- package/lib/commonjs/core/format/format.js.map +1 -1
- package/lib/commonjs/core/format/index.js +2 -2
- package/lib/commonjs/core/format/parse.js +3 -3
- package/lib/commonjs/core/format/parse.js.map +1 -1
- package/lib/commonjs/core/index.js +19 -19
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/locale/index.js +2 -2
- package/lib/commonjs/core/numerals/index.js +1 -1
- package/lib/commonjs/core/validation.js +4 -3
- package/lib/commonjs/core/validation.js.map +1 -1
- package/lib/commonjs/index.js +24 -46
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme/create-theme.js +1 -1
- package/lib/commonjs/theme/default-theme.js +2 -22
- package/lib/commonjs/theme/default-theme.js.map +1 -1
- package/lib/commonjs/theme/index.js +2 -2
- package/lib/commonjs/utils/date-helpers.js +4 -12
- package/lib/commonjs/utils/date-helpers.js.map +1 -1
- package/lib/commonjs/utils/index.js +1 -1
- package/lib/module/accessibility/index.js +1 -1
- package/lib/module/accessibility/index.js.map +1 -1
- package/lib/module/accessibility/labels.js +2 -3
- package/lib/module/accessibility/labels.js.map +1 -1
- package/lib/module/calendar/get-calendar-month-grid.js +6 -6
- package/lib/module/calendar/get-calendar-month-grid.js.map +1 -1
- package/lib/module/calendar/index.js +1 -1
- package/lib/module/calendar/index.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarDay.js +9 -42
- package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarGrid.js +8 -25
- package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarHeader.js +22 -10
- package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js +102 -70
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/module/components/NepaliCalendar/index.js +1 -1
- package/lib/module/components/NepaliCalendar/index.js.map +1 -1
- package/lib/module/core/arithmetic.js +3 -3
- package/lib/module/core/arithmetic.js.map +1 -1
- package/lib/module/core/bsData.js +107 -8
- package/lib/module/core/bsData.js.map +1 -1
- package/lib/module/core/conversion.js +4 -4
- package/lib/module/core/conversion.js.map +1 -1
- package/lib/module/core/dateKey.js +1 -1
- package/lib/module/core/dateKey.js.map +1 -1
- package/lib/module/core/format/format.js +6 -6
- package/lib/module/core/format/format.js.map +1 -1
- package/lib/module/core/format/index.js +2 -2
- package/lib/module/core/format/index.js.map +1 -1
- package/lib/module/core/format/parse.js +2 -2
- package/lib/module/core/format/parse.js.map +1 -1
- package/lib/module/core/index.js +10 -10
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/locale/index.js +2 -2
- package/lib/module/core/locale/index.js.map +1 -1
- package/lib/module/core/numerals/index.js +1 -1
- package/lib/module/core/numerals/index.js.map +1 -1
- package/lib/module/core/validation.js +4 -3
- package/lib/module/core/validation.js.map +1 -1
- package/lib/module/index.js +6 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/theme/create-theme.js +1 -1
- package/lib/module/theme/create-theme.js.map +1 -1
- package/lib/module/theme/default-theme.js +2 -22
- package/lib/module/theme/default-theme.js.map +1 -1
- package/lib/module/theme/index.js +2 -2
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/utils/date-helpers.js +2 -10
- package/lib/module/utils/date-helpers.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/src/accessibility/labels.d.ts +1 -1
- package/lib/typescript/src/accessibility/labels.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +1 -5
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +1 -4
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +1 -1
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts +6 -10
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -1
- package/lib/typescript/src/core/bsData.d.ts.map +1 -1
- package/lib/typescript/src/core/validation.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +0 -10
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/date-helpers.d.ts +0 -4
- package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -1
- package/package.json +4 -8
- package/src/accessibility/labels.ts +0 -2
- package/src/components/NepaliCalendar/CalendarDay.tsx +6 -65
- package/src/components/NepaliCalendar/CalendarGrid.tsx +12 -32
- package/src/components/NepaliCalendar/CalendarHeader.tsx +18 -2
- package/src/components/NepaliCalendar/NepaliCalendar.tsx +128 -56
- package/src/components/NepaliCalendar/types.ts +3 -12
- package/src/core/bsData.ts +105 -6
- package/src/core/conversion.ts +1 -1
- package/src/core/validation.ts +7 -1
- package/src/index.ts +0 -2
- package/src/theme/default-theme.ts +0 -20
- package/src/theme/types.ts +0 -10
- package/src/utils/date-helpers.ts +0 -12
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +0 -185
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +0 -148
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/index.js +0 -20
- package/lib/commonjs/components/NepaliDatePicker/index.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/types.js +0 -6
- package/lib/commonjs/components/NepaliDatePicker/types.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +0 -187
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +0 -275
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/index.js +0 -57
- package/lib/commonjs/components/NepaliRangePicker/index.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js +0 -70
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/types.js +0 -6
- package/lib/commonjs/components/NepaliRangePicker/types.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js +0 -180
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +0 -143
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/index.js +0 -5
- package/lib/module/components/NepaliDatePicker/index.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/types.js +0 -4
- package/lib/module/components/NepaliDatePicker/types.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +0 -182
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js +0 -270
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/index.js +0 -6
- package/lib/module/components/NepaliRangePicker/index.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/range-utils.js +0 -61
- package/lib/module/components/NepaliRangePicker/range-utils.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/types.js +0 -4
- package/lib/module/components/NepaliRangePicker/types.js.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +0 -50
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +0 -4
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +0 -4
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +0 -5
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +0 -13
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +0 -61
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +0 -1
- package/src/components/NepaliDatePicker/DatePickerModal.tsx +0 -220
- package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +0 -171
- package/src/components/NepaliDatePicker/index.ts +0 -3
- package/src/components/NepaliDatePicker/types.ts +0 -70
- package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +0 -206
- package/src/components/NepaliRangePicker/RangePickerModal.tsx +0 -336
- package/src/components/NepaliRangePicker/index.ts +0 -11
- package/src/components/NepaliRangePicker/range-utils.ts +0 -75
- package/src/components/NepaliRangePicker/types.ts +0 -84
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on Keep a Changelog and this project follows Semantic Versioning.
|
|
6
6
|
|
|
7
|
+
## [0.1.4] - 2026-05-16
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added a verified built-in Bikram Sambat dataset covering BS years `2000` through `2100`.
|
|
12
|
+
- Added focused domain-based test files for calendar grids, formatting, numerals, arithmetic, range helpers, accessibility labels, date helpers, and theme defaults.
|
|
13
|
+
- Added a direct Node-based release build script for consistent local and publish-time builds.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Updated conversion and validation logic to use the full supported BS range instead of the previous single-year placeholder.
|
|
18
|
+
- Reorganized the test suite to use production-style names instead of milestone or phase-based filenames.
|
|
19
|
+
- Updated the README to document the actual supported conversion range and package behavior.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Fixed end-of-range validation clamping so the max supported BS date resolves to the real last day in the dataset.
|
|
24
|
+
- Fixed release builds in this environment by avoiding the failing wrapper-based TypeScript build path.
|
|
25
|
+
|
|
7
26
|
## [0.1.2] - 2026-05-16
|
|
8
27
|
|
|
9
28
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
# React Native Bikram Sambat Calendar
|
|
1
|
+
# React Native Bikram Sambat Calendar
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|

|
|
7
7
|
|
|
8
|
-
`react-native-bikram-sambat`
|
|
8
|
+
`react-native-bikram-sambat` provides a clean inline Bikram Sambat calendar UI for React Native, plus TypeScript date utilities for AD/BS conversion, formatting, parsing, validation, and calendar grid generation.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The package does not include a date picker modal or range picker. You can place `NepaliCalendar` inside your own screen, bottom sheet, modal, or form flow.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
14
|
+
- Inline `NepaliCalendar` UI component
|
|
15
|
+
- Shows the current BS month by default
|
|
16
|
+
- Month navigation
|
|
17
|
+
- Press the header year to open an inline year selector
|
|
18
|
+
- Optional `onDayPress` callback for custom behavior
|
|
19
|
+
- AD to BS and BS to AD conversion helpers
|
|
19
20
|
- English and Nepali locale support
|
|
20
21
|
- Latin and Devanagari numeral support
|
|
21
|
-
-
|
|
22
|
-
-
|
|
22
|
+
- Theme overrides and dark mode support
|
|
23
|
+
- TypeScript-first exports
|
|
24
|
+
|
|
25
|
+
The built-in conversion dataset supports BS years `2000` through `2100`.
|
|
23
26
|
|
|
24
27
|
## Installation
|
|
25
28
|
|
|
@@ -33,241 +36,71 @@ or
|
|
|
33
36
|
yarn add react-native-bikram-sambat
|
|
34
37
|
```
|
|
35
38
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
import React, { useState } from 'react';
|
|
40
|
-
import { SafeAreaView } from 'react-native';
|
|
41
|
-
import {
|
|
42
|
-
NepaliDatePicker,
|
|
43
|
-
type BSDateValue,
|
|
44
|
-
} from 'react-native-bikram-sambat';
|
|
45
|
-
|
|
46
|
-
export default function App() {
|
|
47
|
-
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
51
|
-
<NepaliDatePicker
|
|
52
|
-
value={date}
|
|
53
|
-
onChange={setDate}
|
|
54
|
-
placeholder="Select date"
|
|
55
|
-
locale="ne"
|
|
56
|
-
numerals="devanagari"
|
|
57
|
-
/>
|
|
58
|
-
</SafeAreaView>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## AD to BS Example
|
|
64
|
-
|
|
65
|
-
Use the built-in AD to BS converter when you need to convert a Gregorian date to a Bikram Sambat date.
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
import { toBS } from 'react-native-bikram-sambat';
|
|
69
|
-
|
|
70
|
-
const bsDate = toBS({
|
|
71
|
-
calendar: 'AD',
|
|
72
|
-
year: 2024,
|
|
73
|
-
month: 4,
|
|
74
|
-
day: 13,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Example result shape:
|
|
78
|
-
// { calendar: 'BS', year: 2081, month: 1, day: 1 }
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## BS to AD Example
|
|
82
|
-
|
|
83
|
-
Use the BS to AD converter when your app stores Bikram Sambat values and needs Gregorian output.
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
import { toAD } from 'react-native-bikram-sambat';
|
|
87
|
-
|
|
88
|
-
const adDate = toAD({
|
|
89
|
-
calendar: 'BS',
|
|
90
|
-
year: 2081,
|
|
91
|
-
month: 1,
|
|
92
|
-
day: 1,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// Example result shape:
|
|
96
|
-
// { calendar: 'AD', year: 2024, month: 4, day: 13 }
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## React Native Date Picker Example
|
|
100
|
-
|
|
101
|
-
```tsx
|
|
102
|
-
import React, { useState } from 'react';
|
|
103
|
-
import { SafeAreaView } from 'react-native';
|
|
104
|
-
import {
|
|
105
|
-
NepaliDatePicker,
|
|
106
|
-
type BSDateValue,
|
|
107
|
-
} from 'react-native-bikram-sambat';
|
|
108
|
-
|
|
109
|
-
export default function App() {
|
|
110
|
-
const [selectedDate, setSelectedDate] = useState<BSDateValue | null>(null);
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
114
|
-
<NepaliDatePicker
|
|
115
|
-
value={selectedDate}
|
|
116
|
-
onChange={setSelectedDate}
|
|
117
|
-
placeholder="Choose a BS date"
|
|
118
|
-
displayFormat="yyyy-MM-dd"
|
|
119
|
-
locale="en"
|
|
120
|
-
numerals="latin"
|
|
121
|
-
/>
|
|
122
|
-
</SafeAreaView>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## More Usage Examples
|
|
128
|
-
|
|
129
|
-
### Inline Bikram Sambat calendar
|
|
39
|
+
## Calendar Usage
|
|
130
40
|
|
|
131
41
|
```tsx
|
|
132
|
-
import React
|
|
42
|
+
import React from 'react';
|
|
133
43
|
import { SafeAreaView } from 'react-native';
|
|
134
|
-
import {
|
|
135
|
-
NepaliCalendar,
|
|
136
|
-
type BSDateValue,
|
|
137
|
-
} from 'react-native-bikram-sambat';
|
|
44
|
+
import { NepaliCalendar } from 'react-native-bikram-sambat';
|
|
138
45
|
|
|
139
46
|
export default function App() {
|
|
140
|
-
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
141
|
-
|
|
142
47
|
return (
|
|
143
48
|
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
144
49
|
<NepaliCalendar
|
|
145
|
-
value={date}
|
|
146
|
-
onChange={setDate}
|
|
147
50
|
locale="ne"
|
|
148
51
|
numerals="devanagari"
|
|
52
|
+
onDayPress={(date) => {
|
|
53
|
+
// Open your own modal, update form state, or navigate.
|
|
54
|
+
console.log(date);
|
|
55
|
+
}}
|
|
149
56
|
/>
|
|
150
57
|
</SafeAreaView>
|
|
151
58
|
);
|
|
152
59
|
}
|
|
153
60
|
```
|
|
154
61
|
|
|
155
|
-
|
|
62
|
+
## Controlled Month
|
|
156
63
|
|
|
157
64
|
```tsx
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
end: null,
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
173
|
-
<NepaliRangePicker
|
|
174
|
-
value={range}
|
|
175
|
-
onChange={setRange}
|
|
176
|
-
placeholder="Select date range"
|
|
177
|
-
/>
|
|
178
|
-
</SafeAreaView>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
65
|
+
<NepaliCalendar
|
|
66
|
+
year={2081}
|
|
67
|
+
month={1}
|
|
68
|
+
onMonthChange={({ year, month }) => {
|
|
69
|
+
console.log(year, month);
|
|
70
|
+
}}
|
|
71
|
+
onYearChange={({ year }) => {
|
|
72
|
+
console.log('selected year', year);
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
181
75
|
```
|
|
182
76
|
|
|
183
|
-
|
|
77
|
+
## Core Utilities
|
|
184
78
|
|
|
185
79
|
```ts
|
|
186
80
|
import {
|
|
81
|
+
toBS,
|
|
82
|
+
toAD,
|
|
187
83
|
formatBS,
|
|
188
84
|
parseBS,
|
|
189
|
-
|
|
190
|
-
|
|
85
|
+
todayBS,
|
|
86
|
+
createBSDateKey,
|
|
191
87
|
} from 'react-native-bikram-sambat';
|
|
192
88
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
const
|
|
89
|
+
const today = todayBS();
|
|
90
|
+
const bs = toBS({ calendar: 'AD', year: 2024, month: 4, day: 13 });
|
|
91
|
+
const ad = toAD({ calendar: 'BS', year: 2081, month: 1, day: 1 });
|
|
92
|
+
const label = formatBS(bs, 'dd MMMM yyyy', {
|
|
197
93
|
locale: 'ne',
|
|
198
94
|
numerals: 'devanagari',
|
|
199
95
|
});
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
const devanagari = toNepaliNumerals('2081');
|
|
203
|
-
const latin = toLatinNumerals('२०८१');
|
|
96
|
+
const parsed = parseBS('2081-01-01', 'yyyy-MM-dd');
|
|
97
|
+
const key = createBSDateKey(today);
|
|
204
98
|
```
|
|
205
99
|
|
|
206
|
-
##
|
|
207
|
-
|
|
208
|
-
### Components
|
|
209
|
-
|
|
210
|
-
- `NepaliCalendar`: Inline Bikram Sambat calendar component for React Native
|
|
211
|
-
- `NepaliDatePicker`: Pressable Nepali date picker input with modal calendar
|
|
212
|
-
- `DatePickerModal`: Controlled date picker modal component
|
|
213
|
-
- `NepaliRangePicker`: Range picker input for selecting start and end BS dates
|
|
214
|
-
- `RangePickerModal`: Controlled range picker modal component
|
|
215
|
-
|
|
216
|
-
### Conversion and formatting
|
|
217
|
-
|
|
218
|
-
- `toBS`: Convert an AD date to a BS date
|
|
219
|
-
- `toAD`: Convert a BS date to an AD date
|
|
220
|
-
- `formatBS`: Format a BS date using supported tokens
|
|
221
|
-
- `parseBS`: Parse a BS date string using the supported `yyyy-MM-dd` pattern
|
|
222
|
-
- `toNepaliNumerals`: Convert Latin digits to Devanagari digits
|
|
223
|
-
- `toLatinNumerals`: Convert Devanagari digits to Latin digits
|
|
224
|
-
|
|
225
|
-
### Validation and helpers
|
|
226
|
-
|
|
227
|
-
- `isValidBSDate`
|
|
228
|
-
- `isValidADDate`
|
|
229
|
-
- `isBSDateInSupportedRange`
|
|
230
|
-
- `getSupportedBSRange`
|
|
231
|
-
- `createBSDateKey`
|
|
232
|
-
- `parseBSDateKey`
|
|
233
|
-
- `compareBS`
|
|
234
|
-
- `addBSDays`
|
|
235
|
-
- `subBSDays`
|
|
236
|
-
- `todayBS`
|
|
237
|
-
- `getCalendarMonthGrid`
|
|
238
|
-
|
|
239
|
-
## Use Cases
|
|
240
|
-
|
|
241
|
-
- Building a Nepali date picker in a React Native checkout, booking, or profile flow
|
|
242
|
-
- Showing a Bikram Sambat calendar in education, finance, HR, government, or scheduling apps
|
|
243
|
-
- Converting user-entered Gregorian dates with an AD to BS converter
|
|
244
|
-
- Converting stored BS values to Gregorian dates with a BS to AD converter
|
|
245
|
-
- Supporting Nepali date conversion and display in apps for users in Nepal
|
|
246
|
-
- Adding a TypeScript React Native calendar package to an Expo or React Native CLI codebase
|
|
247
|
-
|
|
248
|
-
## Why Use This Package?
|
|
249
|
-
|
|
250
|
-
- It gives you a single package for both Nepali date conversion and React Native UI components.
|
|
251
|
-
- It reduces maintenance compared with rolling your own Bikram Sambat calendar logic.
|
|
252
|
-
- It keeps TypeScript types close to the public API for better editor support and safer integration.
|
|
253
|
-
- It supports theming, locales, numerals, and accessibility so teams can ship a more polished Nepali calendar for React Native.
|
|
254
|
-
|
|
255
|
-
## TypeScript Support
|
|
256
|
-
|
|
257
|
-
This package is built with TypeScript and publishes declaration files via the `types` field. Public types include `BSDateValue`, `ADDateValue`, `DateRangeValue`, `NepaliCalendarProps`, `NepaliDatePickerProps`, `RangePickerModalProps`, and theme-related types.
|
|
258
|
-
|
|
259
|
-
## Expo and React Native CLI Compatibility
|
|
260
|
-
|
|
261
|
-
This package currently appears suitable for both Expo-managed and React Native CLI projects because the published source is JavaScript and TypeScript only and does not define custom native modules. You should still test your target screens in your own app, especially if you rely on specific React Native versions, theming constraints, or accessibility requirements.
|
|
262
|
-
|
|
263
|
-
## Preview
|
|
100
|
+
## Screenshot
|
|
264
101
|
|
|
265
102
|

|
|
266
103
|
|
|
267
|
-
## Contributing
|
|
268
|
-
|
|
269
|
-
Contributions are welcome. Please open an issue for bugs, feature requests, or API discussions before large changes, and see [CONTRIBUTING.md](./CONTRIBUTING.md) for local setup and contribution guidance.
|
|
270
|
-
|
|
271
104
|
## License
|
|
272
105
|
|
|
273
|
-
MIT
|
|
106
|
+
MIT
|
|
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.HEADER_PREV_MONTH_LABEL = exports.HEADER_NEXT_MONTH_LABEL = void 0;
|
|
7
7
|
exports.getDayAccessibilityLabel = getDayAccessibilityLabel;
|
|
8
|
-
var
|
|
9
|
-
function getDayAccessibilityLabel(date, locale,
|
|
10
|
-
const dateStr = (0,
|
|
8
|
+
var _format = require("../core/format");
|
|
9
|
+
function getDayAccessibilityLabel(date, locale, today, disabled) {
|
|
10
|
+
const dateStr = (0, _format.formatBS)(date, 'yyyy MMMM d', {
|
|
11
11
|
locale
|
|
12
12
|
});
|
|
13
13
|
if (disabled) return `${dateStr}, disabled`;
|
|
14
|
-
if (selected) return `${dateStr}, selected`;
|
|
15
14
|
if (today) return `${dateStr}, today`;
|
|
16
15
|
return dateStr;
|
|
17
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_format","require","getDayAccessibilityLabel","date","locale","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,KAAc,EACdC,QAAiB,EACT;EACR,MAAMC,OAAO,GAAG,IAAAC,gBAAQ,EAACL,IAAI,EAAE,aAAa,EAAE;IAAEC;EAAO,CAAC,CAAC;EAEzD,IAAIE,QAAQ,EAAE,OAAO,GAAGC,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":[]}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
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
|
|
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
12
|
function getWeekday(bsDate) {
|
|
13
13
|
const ad = (0, _conversion.toAD)(bsDate);
|
|
14
14
|
const utcDate = new Date(Date.UTC(ad.year, ad.month - 1, ad.day));
|
|
@@ -9,5 +9,5 @@ Object.defineProperty(exports, "getCalendarMonthGrid", {
|
|
|
9
9
|
return _getCalendarMonthGrid.getCalendarMonthGrid;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var _getCalendarMonthGrid = require("./get-calendar-month-grid
|
|
12
|
+
var _getCalendarMonthGrid = require("./get-calendar-month-grid");
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CalendarDay = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
9
|
+
var _numerals = require("../../core/numerals");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
const CalendarDay = exports.CalendarDay = /*#__PURE__*/(0, _react.memo)(function CalendarDay({
|
|
13
13
|
date,
|
|
14
14
|
day,
|
|
15
|
-
selected,
|
|
16
15
|
today,
|
|
17
16
|
disabled,
|
|
18
17
|
inCurrentMonth,
|
|
@@ -20,30 +19,16 @@ const CalendarDay = exports.CalendarDay = /*#__PURE__*/(0, _react.memo)(function
|
|
|
20
19
|
numerals,
|
|
21
20
|
theme,
|
|
22
21
|
onPress,
|
|
23
|
-
rangeStart,
|
|
24
|
-
rangeEnd,
|
|
25
|
-
inRange,
|
|
26
22
|
locale
|
|
27
23
|
}) {
|
|
28
|
-
const displayDay = (0, _react.useMemo)(() => numerals === 'devanagari' ? (0,
|
|
29
|
-
const
|
|
24
|
+
const displayDay = (0, _react.useMemo)(() => numerals === 'devanagari' ? (0, _numerals.toNepaliNumerals)(day) : String(day), [day, numerals]);
|
|
25
|
+
const isPressable = Boolean(onPress) && !disabled;
|
|
30
26
|
const textColor = (0, _react.useMemo)(() => {
|
|
31
27
|
if (disabled) return theme.colors.disabledText;
|
|
32
|
-
if (isRangeEndpoint) return theme.colors.primaryText;
|
|
33
|
-
if (inRange) return theme.colors.rangeText;
|
|
34
|
-
if (selected) return theme.colors.primaryText;
|
|
35
28
|
if (!inCurrentMonth) return theme.colors.outsideMonthText;
|
|
36
29
|
if (marked?.textColor) return marked.textColor;
|
|
37
30
|
return theme.colors.text;
|
|
38
|
-
}, [disabled,
|
|
39
|
-
const backgroundColor = (0, _react.useMemo)(() => {
|
|
40
|
-
if (isRangeEndpoint) {
|
|
41
|
-
return rangeStart ? theme.colors.rangeStartBackground : theme.colors.rangeEndBackground;
|
|
42
|
-
}
|
|
43
|
-
if (inRange) return theme.colors.rangeBackground;
|
|
44
|
-
if (selected) return theme.colors.primary;
|
|
45
|
-
return undefined;
|
|
46
|
-
}, [isRangeEndpoint, rangeStart, inRange, selected, theme.colors.rangeStartBackground, theme.colors.rangeEndBackground, theme.colors.rangeBackground, theme.colors.primary]);
|
|
31
|
+
}, [disabled, inCurrentMonth, marked?.textColor, theme.colors.disabledText, theme.colors.outsideMonthText, theme.colors.text]);
|
|
47
32
|
const accessibilityLabel = (0, _react.useMemo)(() => {
|
|
48
33
|
const parts = [];
|
|
49
34
|
if (locale) {
|
|
@@ -60,31 +45,24 @@ const CalendarDay = exports.CalendarDay = /*#__PURE__*/(0, _react.memo)(function
|
|
|
60
45
|
} else {
|
|
61
46
|
parts.push(`${date.year}/${date.month}/${day}`);
|
|
62
47
|
}
|
|
63
|
-
if (rangeStart) parts.push('range start');
|
|
64
|
-
if (rangeEnd) parts.push('range end');
|
|
65
|
-
if (inRange && !rangeStart && !rangeEnd) parts.push('in selected range');
|
|
66
|
-
if (selected && !inRange) parts.push('selected');
|
|
67
48
|
if (today) parts.push('today');
|
|
68
49
|
if (disabled) parts.push('disabled');
|
|
69
50
|
if (!inCurrentMonth) parts.push('outside month');
|
|
70
51
|
if (marked?.label) parts.push(marked.label);
|
|
71
52
|
return parts.join(', ');
|
|
72
|
-
}, [date, day, locale,
|
|
73
|
-
const containerStyle = [styles.dayContainer,
|
|
74
|
-
backgroundColor
|
|
75
|
-
}, today && !isRangeEndpoint && !selected && !inRange && {
|
|
53
|
+
}, [date, day, locale, today, disabled, inCurrentMonth, marked?.label]);
|
|
54
|
+
const containerStyle = [styles.dayContainer, today && {
|
|
76
55
|
borderWidth: 1,
|
|
77
56
|
borderColor: theme.colors.todayBorder
|
|
78
|
-
}, disabled && styles.dayDisabled
|
|
57
|
+
}, disabled && styles.dayDisabled];
|
|
79
58
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
80
59
|
style: containerStyle,
|
|
81
60
|
onPress: onPress,
|
|
82
|
-
disabled:
|
|
83
|
-
accessibilityRole:
|
|
61
|
+
disabled: !isPressable,
|
|
62
|
+
accessibilityRole: isPressable ? 'button' : undefined,
|
|
84
63
|
accessibilityLabel: accessibilityLabel,
|
|
85
64
|
accessibilityState: {
|
|
86
|
-
disabled
|
|
87
|
-
selected: selected || isRangeEndpoint
|
|
65
|
+
disabled: disabled || !isPressable
|
|
88
66
|
},
|
|
89
67
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
90
68
|
style: [styles.dayText, {
|
|
@@ -107,17 +85,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
107
85
|
borderRadius: 20,
|
|
108
86
|
position: 'relative'
|
|
109
87
|
},
|
|
110
|
-
dayInRange: {
|
|
111
|
-
borderRadius: 0
|
|
112
|
-
},
|
|
113
|
-
dayRangeStart: {
|
|
114
|
-
borderTopLeftRadius: 20,
|
|
115
|
-
borderBottomLeftRadius: 20
|
|
116
|
-
},
|
|
117
|
-
dayRangeEnd: {
|
|
118
|
-
borderTopRightRadius: 20,
|
|
119
|
-
borderBottomRightRadius: 20
|
|
120
|
-
},
|
|
121
88
|
dayText: {
|
|
122
89
|
fontSize: 15,
|
|
123
90
|
textAlign: 'center',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_numerals","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CalendarDay","exports","memo","date","day","today","disabled","inCurrentMonth","marked","numerals","theme","onPress","locale","displayDay","useMemo","toNepaliNumerals","String","isPressable","Boolean","textColor","colors","disabledText","outsideMonthText","text","accessibilityLabel","parts","formatBS","push","year","month","label","join","containerStyle","styles","dayContainer","borderWidth","borderColor","todayBorder","dayDisabled","jsxs","Pressable","style","accessibilityRole","undefined","accessibilityState","children","jsx","Text","dayText","color","View","marker","backgroundColor","StyleSheet","create","alignItems","justifyContent","height","width","borderRadius","position","fontSize","textAlign","lineHeight","opacity","bottom"],"sourceRoot":"../../../../src","sources":["components/NepaliCalendar/CalendarDay.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAAuD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAA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,MAAMlB,MAAM,GAAGoB,uBAAU,CAACC,MAAM,CAAC;EAC/BpB,YAAY,EAAE;IACZqB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,EAAE;IACTC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ,CAAC;EACDZ,OAAO,EAAE;IACPa,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE;EACd,CAAC;EACDzB,WAAW,EAAE;IACX0B,OAAO,EAAE;EACX,CAAC;EACDb,MAAM,EAAE;IACNS,QAAQ,EAAE,UAAU;IACpBK,MAAM,EAAE,CAAC;IACTP,KAAK,EAAE,CAAC;IACRD,MAAM,EAAE,CAAC;IACTE,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,22 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CalendarGrid = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
10
|
-
var _rangeUtils = require("../NepaliRangePicker/range-utils.js");
|
|
11
|
-
var _CalendarDay = require("./CalendarDay.js");
|
|
9
|
+
var _CalendarDay = require("./CalendarDay");
|
|
12
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
12
|
const CalendarGrid = exports.CalendarGrid = /*#__PURE__*/(0, _react.memo)(function CalendarGrid({
|
|
15
13
|
grid,
|
|
16
|
-
value,
|
|
17
14
|
today,
|
|
18
15
|
numerals,
|
|
19
16
|
theme,
|
|
20
17
|
markedDates,
|
|
21
18
|
disabledDates,
|
|
22
|
-
|
|
19
|
+
onDayPress,
|
|
23
20
|
renderDay,
|
|
24
|
-
rangeValue,
|
|
25
21
|
locale
|
|
26
22
|
}) {
|
|
27
23
|
const isDateDisabledByList = (0, _react.useCallback)((date, dateKey) => {
|
|
@@ -34,37 +30,28 @@ const CalendarGrid = exports.CalendarGrid = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
34
30
|
return false;
|
|
35
31
|
}, [disabledDates]);
|
|
36
32
|
const rows = (0, _react.useMemo)(() => {
|
|
37
|
-
const hasRange = rangeValue?.start != null;
|
|
38
33
|
return grid.weeks.map((week, weekIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
39
34
|
style: styles.weekRow,
|
|
40
35
|
children: week.map(cell => {
|
|
41
36
|
const dateKey = cell.key;
|
|
42
|
-
const
|
|
43
|
-
const isTodayCell = today !== null && (0, _index.compareBS)(cell.date, today) === 0;
|
|
37
|
+
const isTodayCell = today !== null && cell.date.year === today.year && cell.date.month === today.month && cell.date.day === today.day;
|
|
44
38
|
const marked = markedDates?.[dateKey];
|
|
45
39
|
const explicitlyDisabled = marked?.disabled ?? false;
|
|
46
40
|
const disabled = explicitlyDisabled || cell.isDisabled || isDateDisabledByList(cell.date, dateKey);
|
|
47
|
-
const rangeStart = hasRange && (0, _rangeUtils.isRangeStart)(cell.date, rangeValue);
|
|
48
|
-
const rangeEnd = hasRange && (0, _rangeUtils.isRangeEnd)(cell.date, rangeValue);
|
|
49
|
-
const inRange = hasRange && (0, _rangeUtils.isDateInRange)(cell.date, rangeValue);
|
|
50
41
|
const handlePress = () => {
|
|
51
|
-
if (!disabled) {
|
|
52
|
-
|
|
42
|
+
if (!disabled && onDayPress) {
|
|
43
|
+
onDayPress(cell.date);
|
|
53
44
|
}
|
|
54
45
|
};
|
|
55
46
|
const dayProps = {
|
|
56
47
|
date: cell.date,
|
|
57
48
|
dateKey,
|
|
58
49
|
day: cell.day,
|
|
59
|
-
selected: isSelected,
|
|
60
50
|
today: isTodayCell,
|
|
61
51
|
disabled,
|
|
62
52
|
inCurrentMonth: cell.inCurrentMonth,
|
|
63
53
|
marked,
|
|
64
|
-
onPress: handlePress
|
|
65
|
-
rangeStart,
|
|
66
|
-
rangeEnd,
|
|
67
|
-
inRange
|
|
54
|
+
onPress: onDayPress ? handlePress : undefined
|
|
68
55
|
};
|
|
69
56
|
if (renderDay) {
|
|
70
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -77,23 +64,19 @@ const CalendarGrid = exports.CalendarGrid = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
77
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarDay.CalendarDay, {
|
|
78
65
|
date: cell.date,
|
|
79
66
|
day: cell.day,
|
|
80
|
-
selected: isSelected,
|
|
81
67
|
today: isTodayCell,
|
|
82
68
|
disabled: disabled,
|
|
83
69
|
inCurrentMonth: cell.inCurrentMonth,
|
|
84
70
|
marked: marked,
|
|
85
71
|
numerals: numerals,
|
|
86
72
|
theme: theme,
|
|
87
|
-
onPress: handlePress,
|
|
88
|
-
rangeStart: rangeStart,
|
|
89
|
-
rangeEnd: rangeEnd,
|
|
90
|
-
inRange: inRange,
|
|
73
|
+
onPress: onDayPress ? handlePress : undefined,
|
|
91
74
|
locale: locale
|
|
92
75
|
})
|
|
93
76
|
}, dateKey);
|
|
94
77
|
})
|
|
95
78
|
}, weekIndex));
|
|
96
|
-
}, [grid.weeks,
|
|
79
|
+
}, [grid.weeks, today, numerals, theme, markedDates, isDateDisabledByList, onDayPress, renderDay, locale]);
|
|
97
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
98
81
|
style: styles.grid,
|
|
99
82
|
children: rows
|