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.
Files changed (194) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +44 -211
  3. package/lib/commonjs/accessibility/index.js +1 -1
  4. package/lib/commonjs/accessibility/labels.js +3 -4
  5. package/lib/commonjs/accessibility/labels.js.map +1 -1
  6. package/lib/commonjs/calendar/get-calendar-month-grid.js +5 -5
  7. package/lib/commonjs/calendar/index.js +1 -1
  8. package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +10 -43
  9. package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -1
  10. package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +8 -25
  11. package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -1
  12. package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +26 -14
  13. package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -1
  14. package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +119 -87
  15. package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
  16. package/lib/commonjs/components/NepaliCalendar/index.js +1 -1
  17. package/lib/commonjs/core/arithmetic.js +3 -3
  18. package/lib/commonjs/core/bsData.js +107 -8
  19. package/lib/commonjs/core/bsData.js.map +1 -1
  20. package/lib/commonjs/core/conversion.js +4 -4
  21. package/lib/commonjs/core/conversion.js.map +1 -1
  22. package/lib/commonjs/core/dateKey.js +1 -1
  23. package/lib/commonjs/core/format/format.js +9 -9
  24. package/lib/commonjs/core/format/format.js.map +1 -1
  25. package/lib/commonjs/core/format/index.js +2 -2
  26. package/lib/commonjs/core/format/parse.js +3 -3
  27. package/lib/commonjs/core/format/parse.js.map +1 -1
  28. package/lib/commonjs/core/index.js +19 -19
  29. package/lib/commonjs/core/index.js.map +1 -1
  30. package/lib/commonjs/core/locale/index.js +2 -2
  31. package/lib/commonjs/core/numerals/index.js +1 -1
  32. package/lib/commonjs/core/validation.js +4 -3
  33. package/lib/commonjs/core/validation.js.map +1 -1
  34. package/lib/commonjs/index.js +24 -46
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/package.json +1 -0
  37. package/lib/commonjs/theme/create-theme.js +1 -1
  38. package/lib/commonjs/theme/default-theme.js +2 -22
  39. package/lib/commonjs/theme/default-theme.js.map +1 -1
  40. package/lib/commonjs/theme/index.js +2 -2
  41. package/lib/commonjs/utils/date-helpers.js +4 -12
  42. package/lib/commonjs/utils/date-helpers.js.map +1 -1
  43. package/lib/commonjs/utils/index.js +1 -1
  44. package/lib/module/accessibility/index.js +1 -1
  45. package/lib/module/accessibility/index.js.map +1 -1
  46. package/lib/module/accessibility/labels.js +2 -3
  47. package/lib/module/accessibility/labels.js.map +1 -1
  48. package/lib/module/calendar/get-calendar-month-grid.js +6 -6
  49. package/lib/module/calendar/get-calendar-month-grid.js.map +1 -1
  50. package/lib/module/calendar/index.js +1 -1
  51. package/lib/module/calendar/index.js.map +1 -1
  52. package/lib/module/components/NepaliCalendar/CalendarDay.js +9 -42
  53. package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -1
  54. package/lib/module/components/NepaliCalendar/CalendarGrid.js +8 -25
  55. package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -1
  56. package/lib/module/components/NepaliCalendar/CalendarHeader.js +22 -10
  57. package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -1
  58. package/lib/module/components/NepaliCalendar/NepaliCalendar.js +102 -70
  59. package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
  60. package/lib/module/components/NepaliCalendar/index.js +1 -1
  61. package/lib/module/components/NepaliCalendar/index.js.map +1 -1
  62. package/lib/module/core/arithmetic.js +3 -3
  63. package/lib/module/core/arithmetic.js.map +1 -1
  64. package/lib/module/core/bsData.js +107 -8
  65. package/lib/module/core/bsData.js.map +1 -1
  66. package/lib/module/core/conversion.js +4 -4
  67. package/lib/module/core/conversion.js.map +1 -1
  68. package/lib/module/core/dateKey.js +1 -1
  69. package/lib/module/core/dateKey.js.map +1 -1
  70. package/lib/module/core/format/format.js +6 -6
  71. package/lib/module/core/format/format.js.map +1 -1
  72. package/lib/module/core/format/index.js +2 -2
  73. package/lib/module/core/format/index.js.map +1 -1
  74. package/lib/module/core/format/parse.js +2 -2
  75. package/lib/module/core/format/parse.js.map +1 -1
  76. package/lib/module/core/index.js +10 -10
  77. package/lib/module/core/index.js.map +1 -1
  78. package/lib/module/core/locale/index.js +2 -2
  79. package/lib/module/core/locale/index.js.map +1 -1
  80. package/lib/module/core/numerals/index.js +1 -1
  81. package/lib/module/core/numerals/index.js.map +1 -1
  82. package/lib/module/core/validation.js +4 -3
  83. package/lib/module/core/validation.js.map +1 -1
  84. package/lib/module/index.js +6 -8
  85. package/lib/module/index.js.map +1 -1
  86. package/lib/module/package.json +1 -0
  87. package/lib/module/theme/create-theme.js +1 -1
  88. package/lib/module/theme/create-theme.js.map +1 -1
  89. package/lib/module/theme/default-theme.js +2 -22
  90. package/lib/module/theme/default-theme.js.map +1 -1
  91. package/lib/module/theme/index.js +2 -2
  92. package/lib/module/theme/index.js.map +1 -1
  93. package/lib/module/utils/date-helpers.js +2 -10
  94. package/lib/module/utils/date-helpers.js.map +1 -1
  95. package/lib/module/utils/index.js +1 -1
  96. package/lib/module/utils/index.js.map +1 -1
  97. package/lib/typescript/src/accessibility/labels.d.ts +1 -1
  98. package/lib/typescript/src/accessibility/labels.d.ts.map +1 -1
  99. package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +1 -5
  100. package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -1
  101. package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +1 -4
  102. package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -1
  103. package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +1 -0
  104. package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -1
  105. package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +1 -1
  106. package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -1
  107. package/lib/typescript/src/components/NepaliCalendar/types.d.ts +6 -10
  108. package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -1
  109. package/lib/typescript/src/core/bsData.d.ts.map +1 -1
  110. package/lib/typescript/src/core/validation.d.ts.map +1 -1
  111. package/lib/typescript/src/index.d.ts +0 -2
  112. package/lib/typescript/src/index.d.ts.map +1 -1
  113. package/lib/typescript/src/theme/default-theme.d.ts.map +1 -1
  114. package/lib/typescript/src/theme/types.d.ts +0 -10
  115. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  116. package/lib/typescript/src/utils/date-helpers.d.ts +0 -4
  117. package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -1
  118. package/package.json +4 -8
  119. package/src/accessibility/labels.ts +0 -2
  120. package/src/components/NepaliCalendar/CalendarDay.tsx +6 -65
  121. package/src/components/NepaliCalendar/CalendarGrid.tsx +12 -32
  122. package/src/components/NepaliCalendar/CalendarHeader.tsx +18 -2
  123. package/src/components/NepaliCalendar/NepaliCalendar.tsx +128 -56
  124. package/src/components/NepaliCalendar/types.ts +3 -12
  125. package/src/core/bsData.ts +105 -6
  126. package/src/core/conversion.ts +1 -1
  127. package/src/core/validation.ts +7 -1
  128. package/src/index.ts +0 -2
  129. package/src/theme/default-theme.ts +0 -20
  130. package/src/theme/types.ts +0 -10
  131. package/src/utils/date-helpers.ts +0 -12
  132. package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +0 -185
  133. package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
  134. package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +0 -148
  135. package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
  136. package/lib/commonjs/components/NepaliDatePicker/index.js +0 -20
  137. package/lib/commonjs/components/NepaliDatePicker/index.js.map +0 -1
  138. package/lib/commonjs/components/NepaliDatePicker/types.js +0 -6
  139. package/lib/commonjs/components/NepaliDatePicker/types.js.map +0 -1
  140. package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +0 -187
  141. package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
  142. package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +0 -275
  143. package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
  144. package/lib/commonjs/components/NepaliRangePicker/index.js +0 -57
  145. package/lib/commonjs/components/NepaliRangePicker/index.js.map +0 -1
  146. package/lib/commonjs/components/NepaliRangePicker/range-utils.js +0 -70
  147. package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +0 -1
  148. package/lib/commonjs/components/NepaliRangePicker/types.js +0 -6
  149. package/lib/commonjs/components/NepaliRangePicker/types.js.map +0 -1
  150. package/lib/module/components/NepaliDatePicker/DatePickerModal.js +0 -180
  151. package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
  152. package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +0 -143
  153. package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
  154. package/lib/module/components/NepaliDatePicker/index.js +0 -5
  155. package/lib/module/components/NepaliDatePicker/index.js.map +0 -1
  156. package/lib/module/components/NepaliDatePicker/types.js +0 -4
  157. package/lib/module/components/NepaliDatePicker/types.js.map +0 -1
  158. package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +0 -182
  159. package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
  160. package/lib/module/components/NepaliRangePicker/RangePickerModal.js +0 -270
  161. package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
  162. package/lib/module/components/NepaliRangePicker/index.js +0 -6
  163. package/lib/module/components/NepaliRangePicker/index.js.map +0 -1
  164. package/lib/module/components/NepaliRangePicker/range-utils.js +0 -61
  165. package/lib/module/components/NepaliRangePicker/range-utils.js.map +0 -1
  166. package/lib/module/components/NepaliRangePicker/types.js +0 -4
  167. package/lib/module/components/NepaliRangePicker/types.js.map +0 -1
  168. package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +0 -4
  169. package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +0 -1
  170. package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +0 -4
  171. package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +0 -1
  172. package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +0 -4
  173. package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +0 -1
  174. package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +0 -50
  175. package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +0 -1
  176. package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +0 -4
  177. package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +0 -1
  178. package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +0 -4
  179. package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +0 -1
  180. package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +0 -5
  181. package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +0 -1
  182. package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +0 -13
  183. package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +0 -1
  184. package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +0 -61
  185. package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +0 -1
  186. package/src/components/NepaliDatePicker/DatePickerModal.tsx +0 -220
  187. package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +0 -171
  188. package/src/components/NepaliDatePicker/index.ts +0 -3
  189. package/src/components/NepaliDatePicker/types.ts +0 -70
  190. package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +0 -206
  191. package/src/components/NepaliRangePicker/RangePickerModal.tsx +0 -336
  192. package/src/components/NepaliRangePicker/index.ts +0 -11
  193. package/src/components/NepaliRangePicker/range-utils.ts +0 -75
  194. 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, Nepali Date Picker, and AD to BS Converter
1
+ # React Native Bikram Sambat Calendar
2
2
 
3
3
  ![npm](https://img.shields.io/npm/v/react-native-bikram-sambat)
4
4
  ![downloads](https://img.shields.io/npm/dm/react-native-bikram-sambat)
5
5
  ![license](https://img.shields.io/npm/l/react-native-bikram-sambat)
6
6
  ![types](https://img.shields.io/npm/types/react-native-bikram-sambat)
7
7
 
8
- `react-native-bikram-sambat` is a TypeScript React Native calendar package for building Nepali calendar experiences in mobile apps. It combines a React Native Bikram Sambat calendar UI, a Nepali date picker, and reliable Nepali date conversion helpers for AD to BS conversion and BS to AD conversion.
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
- If you need a Nepali calendar for React Native, a Bikram Sambat calendar component, or an AD to BS converter for app logic, this package gives you both the UI layer and the core date engine in one place. It is designed for teams that want production-ready Bikram Sambat and Nepali date conversion support without maintaining custom date tables and picker components themselves.
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
- - React Native Bikram Sambat calendar component
15
- - Nepali date picker and range picker components
16
- - AD to BS converter and BS to AD converter helpers
17
- - Bikram Sambat calendar month grid generation
18
- - Nepali date conversion utilities for formatting, parsing, validation, and arithmetic
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
- - TypeScript-first exports and generated declaration files
22
- - Theme overrides, dark mode support, and accessibility-friendly interactions
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
- ## Quick Start
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, { useState } from '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
- ### Nepali date range picker
62
+ ## Controlled Month
156
63
 
157
64
  ```tsx
158
- import React, { useState } from 'react';
159
- import { SafeAreaView } from 'react-native';
160
- import {
161
- NepaliRangePicker,
162
- type DateRangeValue,
163
- } from 'react-native-bikram-sambat';
164
-
165
- export default function App() {
166
- const [range, setRange] = useState<DateRangeValue>({
167
- start: null,
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
- ### Formatting and parsing Nepali dates
77
+ ## Core Utilities
184
78
 
185
79
  ```ts
186
80
  import {
81
+ toBS,
82
+ toAD,
187
83
  formatBS,
188
84
  parseBS,
189
- toNepaliNumerals,
190
- toLatinNumerals,
85
+ todayBS,
86
+ createBSDateKey,
191
87
  } from 'react-native-bikram-sambat';
192
88
 
193
- const date = { calendar: 'BS', year: 2081, month: 1, day: 5 } as const;
194
-
195
- const isoLike = formatBS(date, 'yyyy-MM-dd');
196
- const nepaliFormatted = formatBS(date, 'dd MMMM yyyy', {
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 parsed = parseBS('2081-01-05', 'yyyy-MM-dd');
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
- ## API Reference
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
  ![Calendar view](./docs/screenshots/iphone-15-pro-max-calendar.png)
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. See [LICENSE](./LICENSE).
106
+ MIT
@@ -21,5 +21,5 @@ Object.defineProperty(exports, "getDayAccessibilityLabel", {
21
21
  return _labels.getDayAccessibilityLabel;
22
22
  }
23
23
  });
24
- var _labels = require("./labels.js");
24
+ var _labels = require("./labels");
25
25
  //# sourceMappingURL=index.js.map
@@ -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 _index = require("../core/format/index.js");
9
- function getDayAccessibilityLabel(date, locale, selected, today, disabled) {
10
- const dateStr = (0, _index.formatBS)(date, 'yyyy MMMM d', {
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":["_index","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,MAAA,GAAAC,OAAA;AAEO,SAASC,wBAAwBA,CACtCC,IAAiB,EACjBC,MAAsB,EACtBC,QAAiB,EACjBC,KAAc,EACdC,QAAiB,EACT;EACR,MAAMC,OAAO,GAAG,IAAAC,eAAQ,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":[]}
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.js");
8
- var _validation = require("../core/validation.js");
9
- var _bsData = require("../core/bsData.js");
10
- var _arithmetic = require("../core/arithmetic.js");
11
- var _conversion = require("../core/conversion.js");
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.js");
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 _index = require("../../core/numerals/index.js");
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, _index.toNepaliNumerals)(day) : String(day), [day, numerals]);
29
- const isRangeEndpoint = rangeStart || rangeEnd;
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, isRangeEndpoint, inRange, selected, inCurrentMonth, marked?.textColor, theme.colors.disabledText, theme.colors.primaryText, theme.colors.rangeText, theme.colors.outsideMonthText, theme.colors.text]);
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, rangeStart, rangeEnd, inRange, selected, today, disabled, inCurrentMonth, marked?.label]);
73
- const containerStyle = [styles.dayContainer, backgroundColor && {
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, inRange && !isRangeEndpoint && styles.dayInRange, rangeStart && styles.dayRangeStart, rangeEnd && styles.dayRangeEnd];
57
+ }, disabled && styles.dayDisabled];
79
58
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
80
59
  style: containerStyle,
81
60
  onPress: onPress,
82
- disabled: disabled,
83
- accessibilityRole: "button",
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","_index","_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","selected","today","disabled","inCurrentMonth","marked","numerals","theme","onPress","rangeStart","rangeEnd","inRange","locale","displayDay","useMemo","toNepaliNumerals","String","isRangeEndpoint","textColor","colors","disabledText","primaryText","rangeText","outsideMonthText","text","backgroundColor","rangeStartBackground","rangeEndBackground","rangeBackground","primary","undefined","accessibilityLabel","parts","formatBS","push","year","month","label","join","containerStyle","styles","dayContainer","borderWidth","borderColor","todayBorder","dayDisabled","dayInRange","dayRangeStart","dayRangeEnd","jsxs","Pressable","style","accessibilityRole","accessibilityState","children","jsx","Text","dayText","color","View","marker","StyleSheet","create","alignItems","justifyContent","height","width","borderRadius","position","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","fontSize","textAlign","lineHeight","opacity","bottom"],"sour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O,EAAE;IACPgB,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE;EACd,CAAC;EACD9B,WAAW,EAAE;IACX+B,OAAO,EAAE;EACX,CAAC;EACDhB,MAAM,EAAE;IACNQ,QAAQ,EAAE,UAAU;IACpBS,MAAM,EAAE,CAAC;IACTX,KAAK,EAAE,CAAC;IACRD,MAAM,EAAE,CAAC;IACTE,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
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,M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AC+B;MAAO,CAAC;IACxD,CACH,CACF;EAAA,CACQ,CAAC;AAEhB,CAAC,CAAC;AAEF,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 _index = require("../../core/index.js");
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
- onChange,
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 isSelected = value !== null && (0, _index.compareBS)(cell.date, value) === 0;
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
- onChange(cell.date);
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, value, today, numerals, theme, markedDates, isDateDisabledByList, onChange, renderDay, rangeValue, locale]);
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