react-native-bikram-sambat 0.1.0 → 0.1.2

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 (156) hide show
  1. package/README.md +24 -253
  2. package/docs/screenshots/iphone-15-pro-max-calendar.png +0 -0
  3. package/lib/commonjs/accessibility/index.js +1 -1
  4. package/lib/commonjs/accessibility/labels.js +2 -2
  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 +2 -2
  9. package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -1
  10. package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +5 -5
  11. package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -1
  12. package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +8 -8
  13. package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -1
  14. package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +37 -37
  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/components/NepaliDatePicker/DatePickerModal.js +7 -7
  18. package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +1 -1
  19. package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +9 -9
  20. package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -1
  21. package/lib/commonjs/components/NepaliDatePicker/index.js +2 -2
  22. package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +12 -12
  23. package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -1
  24. package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +12 -12
  25. package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +1 -1
  26. package/lib/commonjs/components/NepaliRangePicker/index.js +3 -3
  27. package/lib/commonjs/components/NepaliRangePicker/range-utils.js +7 -7
  28. package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +1 -1
  29. package/lib/commonjs/core/arithmetic.js +3 -3
  30. package/lib/commonjs/core/bsData.js +1 -1
  31. package/lib/commonjs/core/conversion.js +3 -3
  32. package/lib/commonjs/core/dateKey.js +1 -1
  33. package/lib/commonjs/core/format/format.js +9 -9
  34. package/lib/commonjs/core/format/format.js.map +1 -1
  35. package/lib/commonjs/core/format/index.js +2 -2
  36. package/lib/commonjs/core/format/parse.js +3 -3
  37. package/lib/commonjs/core/format/parse.js.map +1 -1
  38. package/lib/commonjs/core/index.js +19 -19
  39. package/lib/commonjs/core/index.js.map +1 -1
  40. package/lib/commonjs/core/locale/index.js +2 -2
  41. package/lib/commonjs/core/numerals/index.js +1 -1
  42. package/lib/commonjs/core/validation.js +2 -2
  43. package/lib/commonjs/index.js +32 -32
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/commonjs/theme/create-theme.js +1 -1
  46. package/lib/commonjs/theme/index.js +2 -2
  47. package/lib/commonjs/utils/date-helpers.js +4 -4
  48. package/lib/commonjs/utils/date-helpers.js.map +1 -1
  49. package/lib/commonjs/utils/index.js +1 -1
  50. package/lib/module/accessibility/index.js +1 -1
  51. package/lib/module/accessibility/index.js.map +1 -1
  52. package/lib/module/accessibility/labels.js +1 -1
  53. package/lib/module/accessibility/labels.js.map +1 -1
  54. package/lib/module/calendar/get-calendar-month-grid.js +6 -6
  55. package/lib/module/calendar/get-calendar-month-grid.js.map +1 -1
  56. package/lib/module/calendar/index.js +1 -1
  57. package/lib/module/calendar/index.js.map +1 -1
  58. package/lib/module/components/NepaliCalendar/CalendarDay.js +1 -1
  59. package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -1
  60. package/lib/module/components/NepaliCalendar/CalendarGrid.js +3 -3
  61. package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -1
  62. package/lib/module/components/NepaliCalendar/CalendarHeader.js +4 -4
  63. package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -1
  64. package/lib/module/components/NepaliCalendar/NepaliCalendar.js +8 -8
  65. package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
  66. package/lib/module/components/NepaliCalendar/index.js +1 -1
  67. package/lib/module/components/NepaliCalendar/index.js.map +1 -1
  68. package/lib/module/components/NepaliDatePicker/DatePickerModal.js +3 -3
  69. package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +1 -1
  70. package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +4 -4
  71. package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -1
  72. package/lib/module/components/NepaliDatePicker/index.js +2 -2
  73. package/lib/module/components/NepaliDatePicker/index.js.map +1 -1
  74. package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +4 -4
  75. package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -1
  76. package/lib/module/components/NepaliRangePicker/RangePickerModal.js +4 -4
  77. package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +1 -1
  78. package/lib/module/components/NepaliRangePicker/index.js +3 -3
  79. package/lib/module/components/NepaliRangePicker/index.js.map +1 -1
  80. package/lib/module/components/NepaliRangePicker/range-utils.js +1 -1
  81. package/lib/module/components/NepaliRangePicker/range-utils.js.map +1 -1
  82. package/lib/module/core/arithmetic.js +3 -3
  83. package/lib/module/core/arithmetic.js.map +1 -1
  84. package/lib/module/core/bsData.js +1 -1
  85. package/lib/module/core/bsData.js.map +1 -1
  86. package/lib/module/core/conversion.js +3 -3
  87. package/lib/module/core/conversion.js.map +1 -1
  88. package/lib/module/core/dateKey.js +1 -1
  89. package/lib/module/core/dateKey.js.map +1 -1
  90. package/lib/module/core/format/format.js +6 -6
  91. package/lib/module/core/format/format.js.map +1 -1
  92. package/lib/module/core/format/index.js +2 -2
  93. package/lib/module/core/format/index.js.map +1 -1
  94. package/lib/module/core/format/parse.js +2 -2
  95. package/lib/module/core/format/parse.js.map +1 -1
  96. package/lib/module/core/index.js +10 -10
  97. package/lib/module/core/index.js.map +1 -1
  98. package/lib/module/core/locale/index.js +2 -2
  99. package/lib/module/core/locale/index.js.map +1 -1
  100. package/lib/module/core/numerals/index.js +1 -1
  101. package/lib/module/core/numerals/index.js.map +1 -1
  102. package/lib/module/core/validation.js +2 -2
  103. package/lib/module/core/validation.js.map +1 -1
  104. package/lib/module/index.js +8 -8
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/module/theme/create-theme.js +1 -1
  107. package/lib/module/theme/create-theme.js.map +1 -1
  108. package/lib/module/theme/index.js +2 -2
  109. package/lib/module/theme/index.js.map +1 -1
  110. package/lib/module/utils/date-helpers.js +2 -2
  111. package/lib/module/utils/date-helpers.js.map +1 -1
  112. package/lib/module/utils/index.js +1 -1
  113. package/lib/module/utils/index.js.map +1 -1
  114. package/package.json +41 -9
  115. package/lib/commonjs/core/validation.test.js +0 -248
  116. package/lib/commonjs/core/validation.test.js.map +0 -1
  117. package/lib/commonjs/exports.test.js +0 -133
  118. package/lib/commonjs/exports.test.js.map +0 -1
  119. package/lib/commonjs/package.json +0 -1
  120. package/lib/commonjs/phase2.test.js +0 -446
  121. package/lib/commonjs/phase2.test.js.map +0 -1
  122. package/lib/commonjs/phase3.test.js +0 -91
  123. package/lib/commonjs/phase3.test.js.map +0 -1
  124. package/lib/commonjs/phase4.test.js +0 -89
  125. package/lib/commonjs/phase4.test.js.map +0 -1
  126. package/lib/commonjs/phase5.test.js +0 -246
  127. package/lib/commonjs/phase5.test.js.map +0 -1
  128. package/lib/commonjs/phase7.test.js +0 -284
  129. package/lib/commonjs/phase7.test.js.map +0 -1
  130. package/lib/commonjs/range-helpers.test.js +0 -182
  131. package/lib/commonjs/range-helpers.test.js.map +0 -1
  132. package/lib/module/core/validation.test.js +0 -248
  133. package/lib/module/core/validation.test.js.map +0 -1
  134. package/lib/module/exports.test.js +0 -133
  135. package/lib/module/exports.test.js.map +0 -1
  136. package/lib/module/package.json +0 -1
  137. package/lib/module/phase2.test.js +0 -446
  138. package/lib/module/phase2.test.js.map +0 -1
  139. package/lib/module/phase3.test.js +0 -91
  140. package/lib/module/phase3.test.js.map +0 -1
  141. package/lib/module/phase4.test.js +0 -89
  142. package/lib/module/phase4.test.js.map +0 -1
  143. package/lib/module/phase5.test.js +0 -246
  144. package/lib/module/phase5.test.js.map +0 -1
  145. package/lib/module/phase7.test.js +0 -284
  146. package/lib/module/phase7.test.js.map +0 -1
  147. package/lib/module/range-helpers.test.js +0 -182
  148. package/lib/module/range-helpers.test.js.map +0 -1
  149. package/src/core/validation.test.ts +0 -207
  150. package/src/exports.test.ts +0 -135
  151. package/src/phase2.test.ts +0 -424
  152. package/src/phase3.test.ts +0 -83
  153. package/src/phase4.test.ts +0 -86
  154. package/src/phase5.test.ts +0 -257
  155. package/src/phase7.test.ts +0 -307
  156. package/src/range-helpers.test.ts +0 -153
@@ -1,182 +0,0 @@
1
- "use strict";
2
-
3
- import { isBSDateInSupportedRange, clampBSDateToSupportedRange, getDefaultSupportedBSDate, getSafeCalendarMonth, SUPPORTED_BS_START_YEAR, SUPPORTED_BS_END_YEAR, getSupportedBSRange } from './core';
4
- describe('supported range helpers', () => {
5
- it('exports start and end year constants', () => {
6
- expect(SUPPORTED_BS_START_YEAR).toBe(2081);
7
- expect(SUPPORTED_BS_END_YEAR).toBe(2081);
8
- });
9
- it('getSupportedBSRange returns correct range', () => {
10
- const range = getSupportedBSRange();
11
- expect(range).toEqual({
12
- start: 2081,
13
- end: 2081
14
- });
15
- });
16
- });
17
- describe('isBSDateInSupportedRange', () => {
18
- it('returns true for dates inside supported range', () => {
19
- expect(isBSDateInSupportedRange({
20
- calendar: 'BS',
21
- year: 2081,
22
- month: 1,
23
- day: 1
24
- })).toBe(true);
25
- expect(isBSDateInSupportedRange({
26
- calendar: 'BS',
27
- year: 2081,
28
- month: 12,
29
- day: 30
30
- })).toBe(true);
31
- });
32
- it('returns false for dates outside supported range', () => {
33
- expect(isBSDateInSupportedRange({
34
- calendar: 'BS',
35
- year: 2080,
36
- month: 1,
37
- day: 1
38
- })).toBe(false);
39
- expect(isBSDateInSupportedRange({
40
- calendar: 'BS',
41
- year: 2082,
42
- month: 1,
43
- day: 1
44
- })).toBe(false);
45
- });
46
- it('returns false for invalid calendar', () => {
47
- expect(isBSDateInSupportedRange({
48
- calendar: 'AD',
49
- year: 2081,
50
- month: 1,
51
- day: 1
52
- })).toBe(false);
53
- });
54
- });
55
- describe('clampBSDateToSupportedRange', () => {
56
- it('returns same date when already in range', () => {
57
- const date = {
58
- calendar: 'BS',
59
- year: 2081,
60
- month: 6,
61
- day: 15
62
- };
63
- expect(clampBSDateToSupportedRange(date)).toEqual(date);
64
- });
65
- it('clamps year below range to start year month 1 day 1', () => {
66
- const result = clampBSDateToSupportedRange({
67
- calendar: 'BS',
68
- year: 2080,
69
- month: 6,
70
- day: 15
71
- });
72
- expect(result.year).toBe(2081);
73
- expect(result.month).toBe(1);
74
- expect(result.day).toBe(1);
75
- });
76
- it('clamps year above range to end year month 12 day 30', () => {
77
- const result = clampBSDateToSupportedRange({
78
- calendar: 'BS',
79
- year: 2082,
80
- month: 6,
81
- day: 15
82
- });
83
- expect(result.year).toBe(2081);
84
- expect(result.month).toBe(12);
85
- expect(result.day).toBe(30);
86
- });
87
- it('clamps month to valid range', () => {
88
- const result = clampBSDateToSupportedRange({
89
- calendar: 'BS',
90
- year: 2081,
91
- month: 13,
92
- day: 1
93
- });
94
- expect(result.month).toBe(12);
95
- });
96
- it('clamps day to valid month length', () => {
97
- const result = clampBSDateToSupportedRange({
98
- calendar: 'BS',
99
- year: 2081,
100
- month: 8,
101
- day: 30
102
- });
103
- expect(result.day).toBe(29);
104
- });
105
- });
106
- describe('getDefaultSupportedBSDate', () => {
107
- it('returns first day of first supported year', () => {
108
- const date = getDefaultSupportedBSDate();
109
- expect(date).toEqual({
110
- calendar: 'BS',
111
- year: 2081,
112
- month: 1,
113
- day: 1
114
- });
115
- });
116
- });
117
- describe('getSafeCalendarMonth', () => {
118
- it('uses value when in supported range', () => {
119
- const result = getSafeCalendarMonth({
120
- value: {
121
- calendar: 'BS',
122
- year: 2081,
123
- month: 5,
124
- day: 10
125
- }
126
- });
127
- expect(result).toEqual({
128
- year: 2081,
129
- month: 5
130
- });
131
- });
132
- it('uses defaultValue when value is null', () => {
133
- const result = getSafeCalendarMonth({
134
- value: null,
135
- defaultValue: {
136
- calendar: 'BS',
137
- year: 2081,
138
- month: 3,
139
- day: 1
140
- }
141
- });
142
- expect(result).toEqual({
143
- year: 2081,
144
- month: 3
145
- });
146
- });
147
- it('uses year/month when in supported range', () => {
148
- const result = getSafeCalendarMonth({
149
- year: 2081,
150
- month: 7
151
- });
152
- expect(result).toEqual({
153
- year: 2081,
154
- month: 7
155
- });
156
- });
157
- it('falls back to supported range when year is out of range', () => {
158
- const result = getSafeCalendarMonth({
159
- year: 2082,
160
- month: 1
161
- });
162
- expect(result).toEqual({
163
- year: 2081,
164
- month: 1
165
- });
166
- });
167
- it('falls back to supported range when no valid input', () => {
168
- const result = getSafeCalendarMonth({});
169
- expect(result).toEqual({
170
- year: 2081,
171
- month: 1
172
- });
173
- });
174
- it('falls back to supported range when input is undefined', () => {
175
- const result = getSafeCalendarMonth();
176
- expect(result).toEqual({
177
- year: 2081,
178
- month: 1
179
- });
180
- });
181
- });
182
- //# sourceMappingURL=range-helpers.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["isBSDateInSupportedRange","clampBSDateToSupportedRange","getDefaultSupportedBSDate","getSafeCalendarMonth","SUPPORTED_BS_START_YEAR","SUPPORTED_BS_END_YEAR","getSupportedBSRange","describe","it","expect","toBe","range","toEqual","start","end","calendar","year","month","day","date","result","value","defaultValue"],"sourceRoot":"../../src","sources":["range-helpers.test.ts"],"mappings":";;AAAA,SACEA,wBAAwB,EACxBC,2BAA2B,EAC3BC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAA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IACT,CAAC,CAAC;IACFR,MAAM,CAACW,MAAM,CAAC,CAACR,OAAO,CAAC;MAAEI,IAAI,EAAE,IAAI;MAAEC,KAAK,EAAE;IAAE,CAAC,CAAC;EAClD,CAAC,CAAC;EAEFT,EAAE,CAAC,mDAAmD,EAAE,MAAM;IAC5D,MAAMY,MAAM,GAAGjB,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACvCM,MAAM,CAACW,MAAM,CAAC,CAACR,OAAO,CAAC;MAAEI,IAAI,EAAE,IAAI;MAAEC,KAAK,EAAE;IAAE,CAAC,CAAC;EAClD,CAAC,CAAC;EAEFT,EAAE,CAAC,uDAAuD,EAAE,MAAM;IAChE,MAAMY,MAAM,GAAGjB,oBAAoB,CAAC,CAAC;IACrCM,MAAM,CAACW,MAAM,CAAC,CAACR,OAAO,CAAC;MAAEI,IAAI,EAAE,IAAI;MAAEC,KAAK,EAAE;IAAE,CAAC,CAAC;EAClD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,207 +0,0 @@
1
- import {
2
- adDateToEpochDay,
3
- createBSDateKey,
4
- createBSYearOffsets,
5
- epochDayToADDate,
6
- epochDayToJSDate,
7
- getBSMonthLength,
8
- getSupportedBSRange,
9
- isValidADDate,
10
- isValidBSDate,
11
- jsDateToEpochDay,
12
- parseBSDateKey,
13
- toAD,
14
- toBS,
15
- SUPPORTED_BS_START_YEAR,
16
- SUPPORTED_BS_END_YEAR,
17
- } from './index';
18
-
19
- describe('BS date validation', () => {
20
- it('accepts dates inside the available placeholder data range', () => {
21
- expect(
22
- isValidBSDate({ calendar: 'BS', year: 2081, month: 1, day: 1 })
23
- ).toBe(true);
24
- expect(
25
- isValidBSDate({ calendar: 'BS', year: 2081, month: 4, day: 31 })
26
- ).toBe(true);
27
- });
28
-
29
- it('rejects dates outside month lengths or available data', () => {
30
- expect(
31
- isValidBSDate({ calendar: 'BS', year: 2081, month: 8, day: 30 })
32
- ).toBe(false);
33
- expect(
34
- isValidBSDate({ calendar: 'BS', year: 2082, month: 1, day: 1 })
35
- ).toBe(false);
36
- });
37
-
38
- it('rejects dates outside the supported year range', () => {
39
- expect(
40
- isValidBSDate({ calendar: 'BS', year: 2080, month: 1, day: 1 })
41
- ).toBe(false);
42
- expect(
43
- isValidBSDate({ calendar: 'BS', year: 2082, month: 1, day: 1 })
44
- ).toBe(false);
45
- expect(
46
- isValidBSDate({ calendar: 'BS', year: 2000, month: 1, day: 1 })
47
- ).toBe(false);
48
- });
49
-
50
- it('returns month lengths for supported BS years', () => {
51
- expect(getBSMonthLength(2081, 1)).toBe(31);
52
- expect(getBSMonthLength(2081, 8)).toBe(29);
53
- });
54
-
55
- it('throws for unsupported years with range in message', () => {
56
- expect(() => getBSMonthLength(2082, 1)).toThrow(/2081–2081/);
57
- expect(() => getBSMonthLength(2080, 1)).toThrow(/2081–2081/);
58
- expect(() => getBSMonthLength(2081, 0)).toThrow(RangeError);
59
- expect(() => getBSMonthLength(2081, 13)).toThrow(RangeError);
60
- });
61
- });
62
-
63
- describe('supported BS range', () => {
64
- it('exports start and end year constants', () => {
65
- expect(SUPPORTED_BS_START_YEAR).toBe(2081);
66
- expect(SUPPORTED_BS_END_YEAR).toBe(2081);
67
- });
68
-
69
- it('getSupportedBSRange returns correct range', () => {
70
- const range = getSupportedBSRange();
71
- expect(range).toEqual({ start: 2081, end: 2081 });
72
- });
73
- });
74
-
75
- describe('AD date validation', () => {
76
- it('accepts real AD dates and rejects calendar overflows', () => {
77
- expect(
78
- isValidADDate({ calendar: 'AD', year: 2024, month: 2, day: 29 })
79
- ).toBe(true);
80
- expect(
81
- isValidADDate({ calendar: 'AD', year: 2023, month: 2, day: 29 })
82
- ).toBe(false);
83
- });
84
-
85
- it('handles AD years 0 through 99 without Date.UTC remapping', () => {
86
- expect(isValidADDate({ calendar: 'AD', year: 1, month: 1, day: 1 })).toBe(
87
- true
88
- );
89
- expect(isValidADDate({ calendar: 'AD', year: 1, month: 2, day: 29 })).toBe(
90
- false
91
- );
92
- });
93
- });
94
-
95
- describe('BS date keys', () => {
96
- it('creates stable YYYY-MM-DD keys', () => {
97
- expect(
98
- createBSDateKey({ calendar: 'BS', year: 2081, month: 1, day: 3 })
99
- ).toBe('2081-01-03');
100
- });
101
-
102
- it('parses valid keys', () => {
103
- expect(parseBSDateKey('2081-01-03')).toEqual({
104
- calendar: 'BS',
105
- year: 2081,
106
- month: 1,
107
- day: 3,
108
- });
109
- });
110
-
111
- it('rejects malformed or invalid keys', () => {
112
- expect(parseBSDateKey('2081-1-03')).toBeNull();
113
- expect(parseBSDateKey('2081-08-30')).toBeNull();
114
- });
115
- });
116
-
117
- describe('Stage 1 conversion architecture', () => {
118
- it('round-trips the placeholder anchor date', () => {
119
- const bs = { calendar: 'BS' as const, year: 2081, month: 1, day: 1 };
120
- const ad = { calendar: 'AD' as const, year: 2024, month: 4, day: 13 };
121
-
122
- expect(toAD(bs)).toEqual(ad);
123
- expect(toBS(ad)).toEqual(bs);
124
- });
125
-
126
- it('converts dates at the end of the available placeholder range', () => {
127
- const bs = { calendar: 'BS' as const, year: 2081, month: 12, day: 30 };
128
- const ad = toAD(bs);
129
-
130
- expect(toBS(ad)).toEqual(bs);
131
- });
132
-
133
- it('throws instead of guessing outside the available placeholder range', () => {
134
- expect(() =>
135
- toBS({ calendar: 'AD', year: 2024, month: 4, day: 12 })
136
- ).toThrow(RangeError);
137
- expect(() =>
138
- toAD({ calendar: 'BS', year: 2082, month: 1, day: 1 })
139
- ).toThrow(RangeError);
140
- });
141
-
142
- it('requires year data to start at the BS anchor year', () => {
143
- expect(() =>
144
- createBSYearOffsets({
145
- anchorBS: { calendar: 'BS', year: 2081, month: 1, day: 1 },
146
- anchorAD: { calendar: 'AD', year: 2024, month: 4, day: 13 },
147
- monthLengthsByYear: {
148
- 2082: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
149
- },
150
- })
151
- ).toThrow(/contiguous/);
152
- });
153
-
154
- it('requires the BS anchor to be the first day of a BS year', () => {
155
- expect(() =>
156
- createBSYearOffsets({
157
- anchorBS: { calendar: 'BS', year: 2081, month: 1, day: 2 },
158
- anchorAD: { calendar: 'AD', year: 2024, month: 4, day: 14 },
159
- monthLengthsByYear: {
160
- 2081: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
161
- },
162
- })
163
- ).toThrow(/first day/);
164
- });
165
- });
166
-
167
- describe('UTC epoch-day utilities', () => {
168
- it('round-trips AD dates through integer epoch days', () => {
169
- const ad = { calendar: 'AD' as const, year: 2024, month: 4, day: 13 };
170
-
171
- expect(
172
- epochDayToADDate(jsDateToEpochDay(new Date(Date.UTC(2024, 3, 13))))
173
- ).toEqual(ad);
174
- });
175
-
176
- it('round-trips AD years 0 through 99 through epoch days', () => {
177
- const ad = { calendar: 'AD' as const, year: 1, month: 1, day: 1 };
178
-
179
- expect(epochDayToADDate(adDateToEpochDay(ad))).toEqual(ad);
180
- });
181
-
182
- it('reads JS Date UTC parts without remapping years 0 through 99', () => {
183
- const value = new Date(0);
184
- value.setUTCFullYear(1, 0, 1);
185
- value.setUTCHours(0, 0, 0, 0);
186
-
187
- expect(epochDayToADDate(jsDateToEpochDay(value))).toEqual({
188
- calendar: 'AD',
189
- year: 1,
190
- month: 1,
191
- day: 1,
192
- });
193
- });
194
-
195
- it('returns UTC-midnight Date objects from epoch days', () => {
196
- const jsDate = epochDayToJSDate(
197
- jsDateToEpochDay(new Date(Date.UTC(2024, 3, 13, 23, 59, 59)))
198
- );
199
-
200
- expect(jsDate.toISOString()).toBe('2024-04-13T00:00:00.000Z');
201
- });
202
-
203
- it('rejects fractional epoch days', () => {
204
- expect(() => epochDayToADDate(1.5)).toThrow(RangeError);
205
- expect(() => epochDayToJSDate(1.5)).toThrow(RangeError);
206
- });
207
- });
@@ -1,135 +0,0 @@
1
- import {
2
- NepaliCalendar,
3
- type NepaliCalendarProps,
4
- type CalendarTheme,
5
- type CalendarMarkedDate,
6
- type BSDateValue,
7
- NepaliDatePicker,
8
- DatePickerModal,
9
- type NepaliDatePickerProps,
10
- type DatePickerModalProps,
11
- NepaliRangePicker,
12
- RangePickerModal,
13
- type NepaliRangePickerProps,
14
- type RangePickerModalProps,
15
- type DateRangeValue,
16
- } from './index';
17
-
18
- describe('root package exports', () => {
19
- it('exports NepaliCalendar component', () => {
20
- expect(typeof NepaliCalendar).toBe('function');
21
- });
22
-
23
- it('exports NepaliCalendarProps type (compile-time check)', () => {
24
- const _props: NepaliCalendarProps = {};
25
- expect(_props).toBeDefined();
26
- });
27
-
28
- it('exports CalendarTheme type (compile-time check)', () => {
29
- const _theme: CalendarTheme = {
30
- colors: {
31
- background: '#fff',
32
- surface: '#fff',
33
- text: '#000',
34
- mutedText: '#666',
35
- primary: '#2563eb',
36
- primaryText: '#fff',
37
- todayBorder: '#2563eb',
38
- disabledText: '#ccc',
39
- outsideMonthText: '#ccc',
40
- border: '#eee',
41
- marker: '#2563eb',
42
- overlay: 'rgba(0, 0, 0, 0.5)',
43
- modalBackground: '#fff',
44
- fieldBackground: '#fff',
45
- fieldBorder: '#eee',
46
- placeholderText: '#999',
47
- rangeBackground: '#dbeafe',
48
- rangeText: '#1e40af',
49
- rangeStartBackground: '#2563eb',
50
- rangeEndBackground: '#2563eb',
51
- danger: '#ef4444',
52
- },
53
- radius: { day: 20, calendar: 12 },
54
- spacing: { xs: 4, sm: 8, md: 12, lg: 16 },
55
- typography: {
56
- header: { fontSize: 18 },
57
- weekday: { fontSize: 12 },
58
- day: { fontSize: 15 },
59
- },
60
- };
61
- expect(_theme.colors.primary).toBe('#2563eb');
62
- });
63
-
64
- it('exports CalendarMarkedDate type (compile-time check)', () => {
65
- const _marked: CalendarMarkedDate = {
66
- type: 'holiday',
67
- label: 'Test',
68
- color: '#ef4444',
69
- };
70
- expect(_marked.type).toBe('holiday');
71
- });
72
-
73
- it('exports BSDateValue type (compile-time check)', () => {
74
- const _date: BSDateValue = {
75
- calendar: 'BS',
76
- year: 2081,
77
- month: 1,
78
- day: 1,
79
- };
80
- expect(_date.calendar).toBe('BS');
81
- });
82
-
83
- it('exports NepaliDatePicker component', () => {
84
- expect(typeof NepaliDatePicker).toBe('function');
85
- });
86
-
87
- it('exports DatePickerModal component', () => {
88
- expect(typeof DatePickerModal).toBe('function');
89
- });
90
-
91
- it('exports NepaliDatePickerProps type (compile-time check)', () => {
92
- const _props: NepaliDatePickerProps = {
93
- placeholder: 'Select date',
94
- };
95
- expect(_props.placeholder).toBe('Select date');
96
- });
97
-
98
- it('exports DatePickerModalProps type (compile-time check)', () => {
99
- const _props: DatePickerModalProps = {
100
- visible: false,
101
- };
102
- expect(_props.visible).toBe(false);
103
- });
104
-
105
- it('exports NepaliRangePicker component', () => {
106
- expect(typeof NepaliRangePicker).toBe('function');
107
- });
108
-
109
- it('exports RangePickerModal component', () => {
110
- expect(typeof RangePickerModal).toBe('function');
111
- });
112
-
113
- it('exports NepaliRangePickerProps type (compile-time check)', () => {
114
- const _props: NepaliRangePickerProps = {
115
- placeholder: 'Select range',
116
- };
117
- expect(_props.placeholder).toBe('Select range');
118
- });
119
-
120
- it('exports RangePickerModalProps type (compile-time check)', () => {
121
- const _props: RangePickerModalProps = {
122
- visible: false,
123
- };
124
- expect(_props.visible).toBe(false);
125
- });
126
-
127
- it('exports DateRangeValue type (compile-time check)', () => {
128
- const _range: DateRangeValue = {
129
- start: { calendar: 'BS', year: 2081, month: 1, day: 1 },
130
- end: { calendar: 'BS', year: 2081, month: 1, day: 15 },
131
- };
132
- expect(_range.start?.year).toBe(2081);
133
- expect(_range.end?.year).toBe(2081);
134
- });
135
- });