react-native-bikram-sambat 0.1.0 → 0.1.1
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/README.md +18 -0
- package/docs/screenshots/iphone-15-pro-max-calendar.png +0 -0
- package/lib/commonjs/accessibility/index.js +1 -1
- package/lib/commonjs/accessibility/labels.js +2 -2
- 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 +2 -2
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +5 -5
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +8 -8
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +37 -37
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/index.js +1 -1
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +7 -7
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +1 -1
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +9 -9
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -1
- package/lib/commonjs/components/NepaliDatePicker/index.js +2 -2
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +12 -12
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -1
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +12 -12
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +1 -1
- package/lib/commonjs/components/NepaliRangePicker/index.js +3 -3
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js +7 -7
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +1 -1
- package/lib/commonjs/core/arithmetic.js +3 -3
- package/lib/commonjs/core/bsData.js +1 -1
- package/lib/commonjs/core/conversion.js +3 -3
- 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 +2 -2
- package/lib/commonjs/index.js +32 -32
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theme/create-theme.js +1 -1
- package/lib/commonjs/theme/index.js +2 -2
- package/lib/commonjs/utils/date-helpers.js +4 -4
- 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 +1 -1
- 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 +1 -1
- package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarGrid.js +3 -3
- package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarHeader.js +4 -4
- package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js +8 -8
- 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/components/NepaliDatePicker/DatePickerModal.js +3 -3
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +1 -1
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +4 -4
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -1
- package/lib/module/components/NepaliDatePicker/index.js +2 -2
- package/lib/module/components/NepaliDatePicker/index.js.map +1 -1
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +4 -4
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -1
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js +4 -4
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +1 -1
- package/lib/module/components/NepaliRangePicker/index.js +3 -3
- package/lib/module/components/NepaliRangePicker/index.js.map +1 -1
- package/lib/module/components/NepaliRangePicker/range-utils.js +1 -1
- package/lib/module/components/NepaliRangePicker/range-utils.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 +1 -1
- package/lib/module/core/bsData.js.map +1 -1
- package/lib/module/core/conversion.js +3 -3
- 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 +2 -2
- package/lib/module/core/validation.js.map +1 -1
- package/lib/module/index.js +8 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/create-theme.js +1 -1
- package/lib/module/theme/create-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 -2
- 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/package.json +41 -9
- package/lib/commonjs/core/validation.test.js +0 -248
- package/lib/commonjs/core/validation.test.js.map +0 -1
- package/lib/commonjs/exports.test.js +0 -133
- package/lib/commonjs/exports.test.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/phase2.test.js +0 -446
- package/lib/commonjs/phase2.test.js.map +0 -1
- package/lib/commonjs/phase3.test.js +0 -91
- package/lib/commonjs/phase3.test.js.map +0 -1
- package/lib/commonjs/phase4.test.js +0 -89
- package/lib/commonjs/phase4.test.js.map +0 -1
- package/lib/commonjs/phase5.test.js +0 -246
- package/lib/commonjs/phase5.test.js.map +0 -1
- package/lib/commonjs/phase7.test.js +0 -284
- package/lib/commonjs/phase7.test.js.map +0 -1
- package/lib/commonjs/range-helpers.test.js +0 -182
- package/lib/commonjs/range-helpers.test.js.map +0 -1
- package/lib/module/core/validation.test.js +0 -248
- package/lib/module/core/validation.test.js.map +0 -1
- package/lib/module/exports.test.js +0 -133
- package/lib/module/exports.test.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/module/phase2.test.js +0 -446
- package/lib/module/phase2.test.js.map +0 -1
- package/lib/module/phase3.test.js +0 -91
- package/lib/module/phase3.test.js.map +0 -1
- package/lib/module/phase4.test.js +0 -89
- package/lib/module/phase4.test.js.map +0 -1
- package/lib/module/phase5.test.js +0 -246
- package/lib/module/phase5.test.js.map +0 -1
- package/lib/module/phase7.test.js +0 -284
- package/lib/module/phase7.test.js.map +0 -1
- package/lib/module/range-helpers.test.js +0 -182
- package/lib/module/range-helpers.test.js.map +0 -1
- package/src/core/validation.test.ts +0 -207
- package/src/exports.test.ts +0 -135
- package/src/phase2.test.ts +0 -424
- package/src/phase3.test.ts +0 -83
- package/src/phase4.test.ts +0 -86
- package/src/phase5.test.ts +0 -257
- package/src/phase7.test.ts +0 -307
- package/src/range-helpers.test.ts +0 -153
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isBSDateInSupportedRange,
|
|
3
|
-
clampBSDateToSupportedRange,
|
|
4
|
-
getDefaultSupportedBSDate,
|
|
5
|
-
getSafeCalendarMonth,
|
|
6
|
-
SUPPORTED_BS_START_YEAR,
|
|
7
|
-
SUPPORTED_BS_END_YEAR,
|
|
8
|
-
getSupportedBSRange,
|
|
9
|
-
} from './core';
|
|
10
|
-
|
|
11
|
-
describe('supported range helpers', () => {
|
|
12
|
-
it('exports start and end year constants', () => {
|
|
13
|
-
expect(SUPPORTED_BS_START_YEAR).toBe(2081);
|
|
14
|
-
expect(SUPPORTED_BS_END_YEAR).toBe(2081);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('getSupportedBSRange returns correct range', () => {
|
|
18
|
-
const range = getSupportedBSRange();
|
|
19
|
-
expect(range).toEqual({ start: 2081, end: 2081 });
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('isBSDateInSupportedRange', () => {
|
|
24
|
-
it('returns true for dates inside supported range', () => {
|
|
25
|
-
expect(
|
|
26
|
-
isBSDateInSupportedRange({ calendar: 'BS', year: 2081, month: 1, day: 1 })
|
|
27
|
-
).toBe(true);
|
|
28
|
-
expect(
|
|
29
|
-
isBSDateInSupportedRange({ calendar: 'BS', year: 2081, month: 12, day: 30 })
|
|
30
|
-
).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('returns false for dates outside supported range', () => {
|
|
34
|
-
expect(
|
|
35
|
-
isBSDateInSupportedRange({ calendar: 'BS', year: 2080, month: 1, day: 1 })
|
|
36
|
-
).toBe(false);
|
|
37
|
-
expect(
|
|
38
|
-
isBSDateInSupportedRange({ calendar: 'BS', year: 2082, month: 1, day: 1 })
|
|
39
|
-
).toBe(false);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('returns false for invalid calendar', () => {
|
|
43
|
-
expect(
|
|
44
|
-
isBSDateInSupportedRange({ calendar: 'AD' as any, year: 2081, month: 1, day: 1 })
|
|
45
|
-
).toBe(false);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('clampBSDateToSupportedRange', () => {
|
|
50
|
-
it('returns same date when already in range', () => {
|
|
51
|
-
const date = { calendar: 'BS' as const, year: 2081, month: 6, day: 15 };
|
|
52
|
-
expect(clampBSDateToSupportedRange(date)).toEqual(date);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('clamps year below range to start year month 1 day 1', () => {
|
|
56
|
-
const result = clampBSDateToSupportedRange({
|
|
57
|
-
calendar: 'BS',
|
|
58
|
-
year: 2080,
|
|
59
|
-
month: 6,
|
|
60
|
-
day: 15,
|
|
61
|
-
});
|
|
62
|
-
expect(result.year).toBe(2081);
|
|
63
|
-
expect(result.month).toBe(1);
|
|
64
|
-
expect(result.day).toBe(1);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('clamps year above range to end year month 12 day 30', () => {
|
|
68
|
-
const result = clampBSDateToSupportedRange({
|
|
69
|
-
calendar: 'BS',
|
|
70
|
-
year: 2082,
|
|
71
|
-
month: 6,
|
|
72
|
-
day: 15,
|
|
73
|
-
});
|
|
74
|
-
expect(result.year).toBe(2081);
|
|
75
|
-
expect(result.month).toBe(12);
|
|
76
|
-
expect(result.day).toBe(30);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('clamps month to valid range', () => {
|
|
80
|
-
const result = clampBSDateToSupportedRange({
|
|
81
|
-
calendar: 'BS',
|
|
82
|
-
year: 2081,
|
|
83
|
-
month: 13,
|
|
84
|
-
day: 1,
|
|
85
|
-
});
|
|
86
|
-
expect(result.month).toBe(12);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('clamps day to valid month length', () => {
|
|
90
|
-
const result = clampBSDateToSupportedRange({
|
|
91
|
-
calendar: 'BS',
|
|
92
|
-
year: 2081,
|
|
93
|
-
month: 8,
|
|
94
|
-
day: 30,
|
|
95
|
-
});
|
|
96
|
-
expect(result.day).toBe(29);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe('getDefaultSupportedBSDate', () => {
|
|
101
|
-
it('returns first day of first supported year', () => {
|
|
102
|
-
const date = getDefaultSupportedBSDate();
|
|
103
|
-
expect(date).toEqual({
|
|
104
|
-
calendar: 'BS',
|
|
105
|
-
year: 2081,
|
|
106
|
-
month: 1,
|
|
107
|
-
day: 1,
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe('getSafeCalendarMonth', () => {
|
|
113
|
-
it('uses value when in supported range', () => {
|
|
114
|
-
const result = getSafeCalendarMonth({
|
|
115
|
-
value: { calendar: 'BS', year: 2081, month: 5, day: 10 },
|
|
116
|
-
});
|
|
117
|
-
expect(result).toEqual({ year: 2081, month: 5 });
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('uses defaultValue when value is null', () => {
|
|
121
|
-
const result = getSafeCalendarMonth({
|
|
122
|
-
value: null,
|
|
123
|
-
defaultValue: { calendar: 'BS', year: 2081, month: 3, day: 1 },
|
|
124
|
-
});
|
|
125
|
-
expect(result).toEqual({ year: 2081, month: 3 });
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('uses year/month when in supported range', () => {
|
|
129
|
-
const result = getSafeCalendarMonth({
|
|
130
|
-
year: 2081,
|
|
131
|
-
month: 7,
|
|
132
|
-
});
|
|
133
|
-
expect(result).toEqual({ year: 2081, month: 7 });
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('falls back to supported range when year is out of range', () => {
|
|
137
|
-
const result = getSafeCalendarMonth({
|
|
138
|
-
year: 2082,
|
|
139
|
-
month: 1,
|
|
140
|
-
});
|
|
141
|
-
expect(result).toEqual({ year: 2081, month: 1 });
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('falls back to supported range when no valid input', () => {
|
|
145
|
-
const result = getSafeCalendarMonth({});
|
|
146
|
-
expect(result).toEqual({ year: 2081, month: 1 });
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('falls back to supported range when input is undefined', () => {
|
|
150
|
-
const result = getSafeCalendarMonth();
|
|
151
|
-
expect(result).toEqual({ year: 2081, month: 1 });
|
|
152
|
-
});
|
|
153
|
-
});
|