react-native-hilal 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +300 -2
- package/lib/module/calendar/Appear.js +75 -0
- package/lib/module/calendar/Appear.js.map +1 -0
- package/lib/module/calendar/Chevron.js +60 -0
- package/lib/module/calendar/Chevron.js.map +1 -0
- package/lib/module/calendar/DayCell.js +51 -0
- package/lib/module/calendar/DayCell.js.map +1 -0
- package/lib/module/calendar/HilalCalendar.js +565 -0
- package/lib/module/calendar/HilalCalendar.js.map +1 -0
- package/lib/module/calendar/PickerGrid.js +66 -0
- package/lib/module/calendar/PickerGrid.js.map +1 -0
- package/lib/module/calendar/index.js +5 -0
- package/lib/module/calendar/index.js.map +1 -0
- package/lib/module/calendar/month.js +291 -0
- package/lib/module/calendar/month.js.map +1 -0
- package/lib/module/calendar/styles.js +338 -0
- package/lib/module/calendar/styles.js.map +1 -0
- package/lib/module/calendar/theme.js +49 -0
- package/lib/module/calendar/theme.js.map +1 -0
- package/lib/module/calendar/types.js +4 -0
- package/lib/module/calendar/types.js.map +1 -0
- package/lib/module/core/convert.js +191 -0
- package/lib/module/core/convert.js.map +1 -0
- package/lib/module/core/days.js +61 -0
- package/lib/module/core/days.js.map +1 -0
- package/lib/module/core/format.js +37 -0
- package/lib/module/core/format.js.map +1 -0
- package/lib/module/core/index.js +6 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/locale.js +62 -0
- package/lib/module/core/locale.js.map +1 -0
- package/lib/module/core/types.js +2 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/umalqura-data.js +24 -0
- package/lib/module/core/umalqura-data.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/calendar/Appear.d.ts +22 -0
- package/lib/typescript/src/calendar/Appear.d.ts.map +1 -0
- package/lib/typescript/src/calendar/Chevron.d.ts +13 -0
- package/lib/typescript/src/calendar/Chevron.d.ts.map +1 -0
- package/lib/typescript/src/calendar/DayCell.d.ts +24 -0
- package/lib/typescript/src/calendar/DayCell.d.ts.map +1 -0
- package/lib/typescript/src/calendar/HilalCalendar.d.ts +7 -0
- package/lib/typescript/src/calendar/HilalCalendar.d.ts.map +1 -0
- package/lib/typescript/src/calendar/PickerGrid.d.ts +28 -0
- package/lib/typescript/src/calendar/PickerGrid.d.ts.map +1 -0
- package/lib/typescript/src/calendar/index.d.ts +4 -0
- package/lib/typescript/src/calendar/index.d.ts.map +1 -0
- package/lib/typescript/src/calendar/month.d.ts +86 -0
- package/lib/typescript/src/calendar/month.d.ts.map +1 -0
- package/lib/typescript/src/calendar/styles.d.ts +206 -0
- package/lib/typescript/src/calendar/styles.d.ts.map +1 -0
- package/lib/typescript/src/calendar/theme.d.ts +51 -0
- package/lib/typescript/src/calendar/theme.d.ts.map +1 -0
- package/lib/typescript/src/calendar/types.d.ts +162 -0
- package/lib/typescript/src/calendar/types.d.ts.map +1 -0
- package/lib/typescript/src/core/convert.d.ts +77 -0
- package/lib/typescript/src/core/convert.d.ts.map +1 -0
- package/lib/typescript/src/core/days.d.ts +24 -0
- package/lib/typescript/src/core/days.d.ts.map +1 -0
- package/lib/typescript/src/core/format.d.ts +23 -0
- package/lib/typescript/src/core/format.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +5 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/core/locale.d.ts +21 -0
- package/lib/typescript/src/core/locale.d.ts.map +1 -0
- package/lib/typescript/src/core/types.d.ts +7 -0
- package/lib/typescript/src/core/types.d.ts.map +1 -0
- package/lib/typescript/src/core/umalqura-data.d.ts +15 -0
- package/lib/typescript/src/core/umalqura-data.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +180 -4
- package/src/calendar/Appear.tsx +94 -0
- package/src/calendar/Chevron.tsx +55 -0
- package/src/calendar/DayCell.tsx +89 -0
- package/src/calendar/HilalCalendar.tsx +728 -0
- package/src/calendar/PickerGrid.tsx +99 -0
- package/src/calendar/index.ts +13 -0
- package/src/calendar/month.ts +364 -0
- package/src/calendar/styles.ts +357 -0
- package/src/calendar/theme.ts +89 -0
- package/src/calendar/types.ts +168 -0
- package/src/core/convert.ts +256 -0
- package/src/core/days.ts +64 -0
- package/src/core/format.ts +65 -0
- package/src/core/index.ts +19 -0
- package/src/core/locale.ts +141 -0
- package/src/core/types.ts +6 -0
- package/src/core/umalqura-data.ts +34 -0
- package/src/index.tsx +2 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Colors, fonts and shape of the calendar. */
|
|
4
|
+
|
|
5
|
+
export const lightTheme = {
|
|
6
|
+
background: '#FFFFFF',
|
|
7
|
+
text: '#1B1F24',
|
|
8
|
+
textSecondary: '#6B7280',
|
|
9
|
+
primary: '#0F766E',
|
|
10
|
+
onPrimary: '#FFFFFF',
|
|
11
|
+
today: '#0F766E',
|
|
12
|
+
disabled: '#9EA5AF',
|
|
13
|
+
border: '#E3E6EA',
|
|
14
|
+
radius: 12
|
|
15
|
+
};
|
|
16
|
+
export const darkTheme = {
|
|
17
|
+
background: '#14171B',
|
|
18
|
+
text: '#F2F4F7',
|
|
19
|
+
textSecondary: '#9AA3AF',
|
|
20
|
+
primary: '#2DD4BF',
|
|
21
|
+
onPrimary: '#042F2C',
|
|
22
|
+
today: '#2DD4BF',
|
|
23
|
+
disabled: '#56606B',
|
|
24
|
+
border: '#2A3038',
|
|
25
|
+
radius: 12
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The theme to render with. 'auto' follows the system color scheme. A
|
|
30
|
+
* partial theme is merged over the 'auto' theme, so a custom `primary`
|
|
31
|
+
* color works in both light and dark mode.
|
|
32
|
+
*/
|
|
33
|
+
export function resolveTheme(theme, colorScheme) {
|
|
34
|
+
const system = colorScheme === 'dark' ? darkTheme : lightTheme;
|
|
35
|
+
if (theme === 'light') {
|
|
36
|
+
return lightTheme;
|
|
37
|
+
}
|
|
38
|
+
if (theme === 'dark') {
|
|
39
|
+
return darkTheme;
|
|
40
|
+
}
|
|
41
|
+
if (theme === 'auto') {
|
|
42
|
+
return system;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...system,
|
|
46
|
+
...theme
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["lightTheme","background","text","textSecondary","primary","onPrimary","today","disabled","border","radius","darkTheme","resolveTheme","theme","colorScheme","system"],"sourceRoot":"../../../src","sources":["calendar/theme.ts"],"mappings":";;AAAA;;AA4CA,OAAO,MAAMA,UAAsB,GAAG;EACpCC,UAAU,EAAE,SAAS;EACrBC,IAAI,EAAE,SAAS;EACfC,aAAa,EAAE,SAAS;EACxBC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE,SAAS;EACpBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,SAAS;EACnBC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE;AACV,CAAC;AAED,OAAO,MAAMC,SAAqB,GAAG;EACnCT,UAAU,EAAE,SAAS;EACrBC,IAAI,EAAE,SAAS;EACfC,aAAa,EAAE,SAAS;EACxBC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE,SAAS;EACpBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,SAAS;EACnBC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,YAAYA,CAC1BC,KAAgB,EAChBC,WAAsC,EAC1B;EACZ,MAAMC,MAAM,GAAGD,WAAW,KAAK,MAAM,GAAGH,SAAS,GAAGV,UAAU;EAC9D,IAAIY,KAAK,KAAK,OAAO,EAAE;IACrB,OAAOZ,UAAU;EACnB;EACA,IAAIY,KAAK,KAAK,MAAM,EAAE;IACpB,OAAOF,SAAS;EAClB;EACA,IAAIE,KAAK,KAAK,MAAM,EAAE;IACpB,OAAOE,MAAM;EACf;EACA,OAAO;IAAE,GAAGA,MAAM;IAAE,GAAGF;EAAM,CAAC;AAChC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["calendar/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { civilFromDays, epochDayOfLocalDate, localDateOfEpochDay } from "./days.js";
|
|
4
|
+
import { UMALQURA_MAX_YEAR, UMALQURA_MIN_YEAR, UMALQURA_MONTH_LENGTH_MASKS, UMALQURA_START_EPOCH_DAY } from "./umalqura-data.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Epoch day of the first day of every month in the table, plus one extra
|
|
8
|
+
* entry for the day after the last month. Index `(year - MIN) * 12 +
|
|
9
|
+
* (month - 1)`.
|
|
10
|
+
*/
|
|
11
|
+
const MONTH_STARTS = (() => {
|
|
12
|
+
const starts = [UMALQURA_START_EPOCH_DAY];
|
|
13
|
+
let epochDay = UMALQURA_START_EPOCH_DAY;
|
|
14
|
+
for (const mask of UMALQURA_MONTH_LENGTH_MASKS) {
|
|
15
|
+
for (let month = 0; month < 12; month++) {
|
|
16
|
+
// eslint-disable-next-line no-bitwise -- the table is a bit mask
|
|
17
|
+
epochDay += mask >> month & 1 ? 30 : 29;
|
|
18
|
+
starts.push(epochDay);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return starts;
|
|
22
|
+
})();
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* First and last epoch day of the Umm al-Qura table (both inclusive). With
|
|
26
|
+
* a Hijri adjustment of `n` days, the supported Gregorian days move by
|
|
27
|
+
* `-n`: see `supportedEpochDays`.
|
|
28
|
+
*/
|
|
29
|
+
export const FIRST_DAY = MONTH_STARTS[0];
|
|
30
|
+
export const LAST_DAY = MONTH_STARTS[MONTH_STARTS.length - 1] - 1;
|
|
31
|
+
|
|
32
|
+
/** The largest Hijri adjustment accepted, in days, in either direction. */
|
|
33
|
+
export const MAX_HIJRI_ADJUSTMENT = 2;
|
|
34
|
+
/**
|
|
35
|
+
* Checks a Hijri adjustment and returns it.
|
|
36
|
+
*
|
|
37
|
+
* @throws {RangeError} unless it is an integer from -2 to 2.
|
|
38
|
+
*/
|
|
39
|
+
export function checkAdjustment(adjustment, caller) {
|
|
40
|
+
if (!Number.isInteger(adjustment) || Math.abs(adjustment) > MAX_HIJRI_ADJUSTMENT) {
|
|
41
|
+
throw new RangeError(`${caller}: the Hijri adjustment must be an integer from ` + `-${MAX_HIJRI_ADJUSTMENT} to ${MAX_HIJRI_ADJUSTMENT}, got ${adjustment}`);
|
|
42
|
+
}
|
|
43
|
+
return adjustment;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** First and last epoch day that have a Hijri date, for an adjustment. */
|
|
47
|
+
export function supportedEpochDays(adjustment = 0) {
|
|
48
|
+
return {
|
|
49
|
+
min: FIRST_DAY - adjustment,
|
|
50
|
+
max: LAST_DAY - adjustment
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function monthIndex(year, month) {
|
|
54
|
+
return (year - UMALQURA_MIN_YEAR) * 12 + (month - 1);
|
|
55
|
+
}
|
|
56
|
+
function formatIso({
|
|
57
|
+
year,
|
|
58
|
+
month,
|
|
59
|
+
day
|
|
60
|
+
}) {
|
|
61
|
+
const pad = n => String(n).padStart(2, '0');
|
|
62
|
+
return `${year}-${pad(month)}-${pad(day)}`;
|
|
63
|
+
}
|
|
64
|
+
function supportedRangeText(adjustment) {
|
|
65
|
+
const {
|
|
66
|
+
min,
|
|
67
|
+
max
|
|
68
|
+
} = getSupportedRange();
|
|
69
|
+
const days = supportedEpochDays(adjustment);
|
|
70
|
+
return `${formatIso(min)} to ${formatIso(max)} AH ` + `(${formatIso(civilFromDays(days.min))} to ` + `${formatIso(civilFromDays(days.max))})`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** First and last Hijri dates the table covers. */
|
|
74
|
+
export function getSupportedRange() {
|
|
75
|
+
return {
|
|
76
|
+
min: {
|
|
77
|
+
year: UMALQURA_MIN_YEAR,
|
|
78
|
+
month: 1,
|
|
79
|
+
day: 1
|
|
80
|
+
},
|
|
81
|
+
max: {
|
|
82
|
+
year: UMALQURA_MAX_YEAR,
|
|
83
|
+
month: 12,
|
|
84
|
+
day: getHijriMonthLength(UMALQURA_MAX_YEAR, 12)
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Number of days in a Hijri month.
|
|
91
|
+
*
|
|
92
|
+
* @throws {RangeError} if the year is outside the supported range or the
|
|
93
|
+
* month is not an integer from 1 to 12.
|
|
94
|
+
*/
|
|
95
|
+
export function getHijriMonthLength(year, month) {
|
|
96
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || year < UMALQURA_MIN_YEAR || year > UMALQURA_MAX_YEAR || month < 1 || month > 12) {
|
|
97
|
+
throw new RangeError(`getHijriMonthLength: ${year}-${month} is not a month in the ` + `supported range (${UMALQURA_MIN_YEAR}-${UMALQURA_MAX_YEAR} AH)`);
|
|
98
|
+
}
|
|
99
|
+
const index = monthIndex(year, month);
|
|
100
|
+
return MONTH_STARTS[index + 1] - MONTH_STARTS[index] === 30 ? 30 : 29;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Whether `hijri` is a real day within the supported range. */
|
|
104
|
+
export function isValidHijri(hijri) {
|
|
105
|
+
if (typeof hijri !== 'object' || hijri === null) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const {
|
|
109
|
+
year,
|
|
110
|
+
month,
|
|
111
|
+
day
|
|
112
|
+
} = hijri;
|
|
113
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day) || year < UMALQURA_MIN_YEAR || year > UMALQURA_MAX_YEAR || month < 1 || month > 12 || day < 1) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return day <= getHijriMonthLength(year, month);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Hijri date of an epoch day, shifted by `adjustment` days. Internal: the
|
|
121
|
+
* public entry point is `toHijri`.
|
|
122
|
+
*
|
|
123
|
+
* @throws {RangeError} if the day is outside the supported range.
|
|
124
|
+
*/
|
|
125
|
+
export function hijriOfEpochDay(epochDay, caller = 'toHijri', adjustment = 0) {
|
|
126
|
+
const tableDay = epochDay + adjustment;
|
|
127
|
+
if (!Number.isInteger(epochDay) || tableDay < FIRST_DAY || tableDay > LAST_DAY) {
|
|
128
|
+
throw new RangeError(`${caller}: ${formatIso(civilFromDays(epochDay))} is outside the ` + `supported range ${supportedRangeText(adjustment)}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Last month that starts on or before `epochDay`.
|
|
132
|
+
let low = 0;
|
|
133
|
+
let high = MONTH_STARTS.length - 2;
|
|
134
|
+
while (low < high) {
|
|
135
|
+
const mid = low + high + 1 >> 1; // eslint-disable-line no-bitwise
|
|
136
|
+
if (MONTH_STARTS[mid] <= tableDay) {
|
|
137
|
+
low = mid;
|
|
138
|
+
} else {
|
|
139
|
+
high = mid - 1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
year: UMALQURA_MIN_YEAR + Math.floor(low / 12),
|
|
144
|
+
month: low % 12 + 1,
|
|
145
|
+
day: tableDay - MONTH_STARTS[low] + 1
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Epoch day of a Hijri date, shifted by `adjustment` days. Internal: the
|
|
151
|
+
* public entry point is `toGregorian`.
|
|
152
|
+
*
|
|
153
|
+
* @throws {RangeError} if `hijri` is not a valid date in the supported
|
|
154
|
+
* range.
|
|
155
|
+
*/
|
|
156
|
+
export function epochDayOfHijri(hijri, caller = 'toGregorian', adjustment = 0) {
|
|
157
|
+
if (!isValidHijri(hijri)) {
|
|
158
|
+
const text = typeof hijri === 'object' && hijri !== null ? `${hijri.year}-${hijri.month}-${hijri.day}` : String(hijri);
|
|
159
|
+
throw new RangeError(`${caller}: ${text} is not a valid Hijri date in the supported ` + `range ${supportedRangeText(adjustment)}`);
|
|
160
|
+
}
|
|
161
|
+
return MONTH_STARTS[monthIndex(hijri.year, hijri.month)] + hijri.day - 1 - adjustment;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Converts the local calendar day of `date` to a Hijri date. The time of
|
|
166
|
+
* day and the time zone offset are ignored: 23:59 and 00:00 on the same
|
|
167
|
+
* local day give the same result.
|
|
168
|
+
*
|
|
169
|
+
* @throws {RangeError} if `date` is invalid or outside the supported
|
|
170
|
+
* range, or the adjustment is not an integer from -2 to 2.
|
|
171
|
+
*/
|
|
172
|
+
export function toHijri(date, options = {}) {
|
|
173
|
+
const adjustment = checkAdjustment(options.adjustment ?? 0, 'toHijri');
|
|
174
|
+
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
175
|
+
throw new RangeError('toHijri: expected a valid Date');
|
|
176
|
+
}
|
|
177
|
+
return hijriOfEpochDay(epochDayOfLocalDate(date), 'toHijri', adjustment);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Converts a Hijri date to a `Date` at local midnight of the matching
|
|
182
|
+
* Gregorian day.
|
|
183
|
+
*
|
|
184
|
+
* @throws {RangeError} if `hijri` is not a valid date in the supported
|
|
185
|
+
* range, or the adjustment is not an integer from -2 to 2.
|
|
186
|
+
*/
|
|
187
|
+
export function toGregorian(hijri, options = {}) {
|
|
188
|
+
const adjustment = checkAdjustment(options.adjustment ?? 0, 'toGregorian');
|
|
189
|
+
return localDateOfEpochDay(epochDayOfHijri(hijri, 'toGregorian', adjustment));
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["civilFromDays","epochDayOfLocalDate","localDateOfEpochDay","UMALQURA_MAX_YEAR","UMALQURA_MIN_YEAR","UMALQURA_MONTH_LENGTH_MASKS","UMALQURA_START_EPOCH_DAY","MONTH_STARTS","starts","epochDay","mask","month","push","FIRST_DAY","LAST_DAY","length","MAX_HIJRI_ADJUSTMENT","checkAdjustment","adjustment","caller","Number","isInteger","Math","abs","RangeError","supportedEpochDays","min","max","monthIndex","year","formatIso","day","pad","n","String","padStart","supportedRangeText","getSupportedRange","days","getHijriMonthLength","index","isValidHijri","hijri","hijriOfEpochDay","tableDay","low","high","mid","floor","epochDayOfHijri","text","toHijri","date","options","Date","isNaN","getTime","toGregorian"],"sourceRoot":"../../../src","sources":["core/convert.ts"],"mappings":";;AAAA,SACEA,aAAa,EACbC,mBAAmB,EACnBC,mBAAmB,QACd,WAAQ;AAEf,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,wBAAwB,QACnB,oBAAiB;;AAExB;AACA;AACA;AACA;AACA;AACA,MAAMC,YAA+B,GAAG,CAAC,MAAM;EAC7C,MAAMC,MAAM,GAAG,CAACF,wBAAwB,CAAC;EACzC,IAAIG,QAAQ,GAAGH,wBAAwB;EACvC,KAAK,MAAMI,IAAI,IAAIL,2BAA2B,EAAE;IAC9C,KAAK,IAAIM,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAG,EAAE,EAAEA,KAAK,EAAE,EAAE;MACvC;MACAF,QAAQ,IAAKC,IAAI,IAAIC,KAAK,GAAI,CAAC,GAAG,EAAE,GAAG,EAAE;MACzCH,MAAM,CAACI,IAAI,CAACH,QAAQ,CAAC;IACvB;EACF;EACA,OAAOD,MAAM;AACf,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A;AACA,OAAO,SAASiC,OAAOA,CACrBC,IAAU,EACVC,OAA+B,GAAG,CAAC,CAAC,EACzB;EACX,MAAMnC,UAAU,GAAGD,eAAe,CAACoC,OAAO,CAACnC,UAAU,IAAI,CAAC,EAAE,SAAS,CAAC;EACtE,IAAI,EAAEkC,IAAI,YAAYE,IAAI,CAAC,IAAIlC,MAAM,CAACmC,KAAK,CAACH,IAAI,CAACI,OAAO,CAAC,CAAC,CAAC,EAAE;IAC3D,MAAM,IAAIhC,UAAU,CAAC,gCAAgC,CAAC;EACxD;EACA,OAAOmB,eAAe,CAAC1C,mBAAmB,CAACmD,IAAI,CAAC,EAAE,SAAS,EAAElC,UAAU,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASuC,WAAWA,CACzBf,KAAgB,EAChBW,OAA+B,GAAG,CAAC,CAAC,EAC9B;EACN,MAAMnC,UAAU,GAAGD,eAAe,CAACoC,OAAO,CAACnC,UAAU,IAAI,CAAC,EAAE,aAAa,CAAC;EAC1E,OAAOhB,mBAAmB,CAAC+C,eAAe,CAACP,KAAK,EAAE,aAAa,EAAExB,UAAU,CAAC,CAAC;AAC/E","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calendar-day arithmetic on plain year/month/day numbers.
|
|
5
|
+
*
|
|
6
|
+
* Days are counted from 1970-01-01 in the proleptic Gregorian calendar
|
|
7
|
+
* ("epoch days"). The algorithms are Howard Hinnant's `days_from_civil`
|
|
8
|
+
* and `civil_from_days`, which use integer math only and never touch a
|
|
9
|
+
* time zone.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Epoch day of a Gregorian year/month/day (month is 1-12). */
|
|
13
|
+
export function daysFromCivil(year, month, day) {
|
|
14
|
+
const y = month <= 2 ? year - 1 : year;
|
|
15
|
+
const era = Math.floor(y / 400);
|
|
16
|
+
const yearOfEra = y - era * 400;
|
|
17
|
+
const shiftedMonth = (month + 9) % 12; // March = 0
|
|
18
|
+
const dayOfYear = Math.floor((153 * shiftedMonth + 2) / 5) + day - 1;
|
|
19
|
+
const dayOfEra = yearOfEra * 365 + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100) + dayOfYear;
|
|
20
|
+
return era * 146097 + dayOfEra - 719468;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Gregorian year/month/day (month is 1-12) of an epoch day. */
|
|
24
|
+
export function civilFromDays(epochDay) {
|
|
25
|
+
const z = epochDay + 719468;
|
|
26
|
+
const era = Math.floor(z / 146097);
|
|
27
|
+
const dayOfEra = z - era * 146097;
|
|
28
|
+
const yearOfEra = Math.floor((dayOfEra - Math.floor(dayOfEra / 1460) + Math.floor(dayOfEra / 36524) - Math.floor(dayOfEra / 146096)) / 365);
|
|
29
|
+
const dayOfYear = dayOfEra - (365 * yearOfEra + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100));
|
|
30
|
+
const shiftedMonth = Math.floor((5 * dayOfYear + 2) / 153);
|
|
31
|
+
const day = dayOfYear - Math.floor((153 * shiftedMonth + 2) / 5) + 1;
|
|
32
|
+
const month = shiftedMonth < 10 ? shiftedMonth + 3 : shiftedMonth - 9;
|
|
33
|
+
const year = yearOfEra + era * 400 + (month <= 2 ? 1 : 0);
|
|
34
|
+
return {
|
|
35
|
+
year,
|
|
36
|
+
month,
|
|
37
|
+
day
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Epoch day of the local calendar day `date` falls on. */
|
|
42
|
+
export function epochDayOfLocalDate(date) {
|
|
43
|
+
return daysFromCivil(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A `Date` at local midnight (start of day) of an epoch day. */
|
|
47
|
+
export function localDateOfEpochDay(epochDay) {
|
|
48
|
+
const {
|
|
49
|
+
year,
|
|
50
|
+
month,
|
|
51
|
+
day
|
|
52
|
+
} = civilFromDays(epochDay);
|
|
53
|
+
return new Date(year, month - 1, day);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Day of the week of an epoch day, 0 = Sunday (like `Date#getDay()`). */
|
|
57
|
+
export function weekdayOfEpochDay(epochDay) {
|
|
58
|
+
// 1970-01-01 was a Thursday.
|
|
59
|
+
return ((epochDay + 4) % 7 + 7) % 7;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=days.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["daysFromCivil","year","month","day","y","era","Math","floor","yearOfEra","shiftedMonth","dayOfYear","dayOfEra","civilFromDays","epochDay","z","epochDayOfLocalDate","date","getFullYear","getMonth","getDate","localDateOfEpochDay","Date","weekdayOfEpochDay"],"sourceRoot":"../../../src","sources":["core/days.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,SAASA,aAAaA,CAACC,IAAY,EAAEC,KAAa,EAAEC,GAAW,EAAE;EACtE,MAAMC,CAAC,GAAGF,KAAK,IAAI,CAAC,GAAGD,IAAI,GAAG,CAAC,GAAGA,IAAI;EACtC,MAAMI,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACH,CAAC,GAAG,GAAG,CAAC;EAC/B,MAAMI,SAAS,GAAGJ,CAAC,GAAGC,GAAG,GAAG,GAAG;EAC/B,MAAMI,YAAY,GAAG,CAACP,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;EACvC,MAAMQ,SAAS,GAAGJ,IAAI,CAACC,KAAK,CAAC,CAAC,GAAG,GAAGE,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC,GAAGN,GAAG,GAAG,CAAC;EACpE,MAAMQ,QAAQ,GACZH,SAAS,GAAG,GAAG,GACfF,IAAI,CAACC,KAAK,CAACC,SAAS,GAAG,CAAC,CAAC,GACzBF,IAAI,CAACC,KAAK,CAACC,SAAS,GAAG,G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IAAEC;EAAI,CAAC;AAC7B;;AAEA;AACA,OAAO,SAASY,mBAAmBA,CAACC,IAAU,EAAE;EAC9C,OAAOhB,aAAa,CAACgB,IAAI,CAACC,WAAW,CAAC,CAAC,EAAED,IAAI,CAACE,QAAQ,CAAC,CAAC,GAAG,CAAC,EAAEF,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC;AAC/E;;AAEA;AACA,OAAO,SAASC,mBAAmBA,CAACP,QAAgB,EAAE;EACpD,MAAM;IAAEZ,IAAI;IAAEC,KAAK;IAAEC;EAAI,CAAC,GAAGS,aAAa,CAACC,QAAQ,CAAC;EACpD,OAAO,IAAIQ,IAAI,CAACpB,IAAI,EAAEC,KAAK,GAAG,CAAC,EAAEC,GAAG,CAAC;AACvC;;AAEA;AACA,OAAO,SAASmB,iBAAiBA,CAACT,QAAgB,EAAE;EAClD;EACA,OAAO,CAAE,CAACA,QAAQ,GAAG,CAAC,IAAI,CAAC,GAAI,CAAC,IAAI,CAAC;AACvC","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { isValidHijri } from "./convert.js";
|
|
4
|
+
import { defaultDigits, formatNumber, getMonthNames } from "./locale.js";
|
|
5
|
+
const ERA = {
|
|
6
|
+
ar: 'هـ',
|
|
7
|
+
en: 'AH'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Formats a Hijri date as "day month year era", for example
|
|
12
|
+
* "١ رمضان ١٤٤٦ هـ" or "1 Ramadan 1446 AH".
|
|
13
|
+
*
|
|
14
|
+
* @throws {RangeError} if `hijri` is not a valid date in the supported
|
|
15
|
+
* range.
|
|
16
|
+
*/
|
|
17
|
+
export function formatHijri(hijri, options = {}) {
|
|
18
|
+
if (!isValidHijri(hijri)) {
|
|
19
|
+
throw new RangeError(`formatHijri: ${hijri.year}-${hijri.month}-${hijri.day} is not a ` + 'valid Hijri date in the supported range');
|
|
20
|
+
}
|
|
21
|
+
const locale = options.locale ?? 'ar';
|
|
22
|
+
const digits = options.digits ?? defaultDigits(locale);
|
|
23
|
+
const month = getMonthNames('hijri', locale)[hijri.month - 1];
|
|
24
|
+
return [formatNumber(hijri.day, digits), month, formatNumber(hijri.year, digits), ERA[locale]].join(' ');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Formats a Gregorian date as "day month year", for example
|
|
29
|
+
* "١١ مارس ٢٠٢٤" or "11 March 2024". Internal: used by the calendar.
|
|
30
|
+
*/
|
|
31
|
+
export function formatGregorian(date, options = {}) {
|
|
32
|
+
const locale = options.locale ?? 'ar';
|
|
33
|
+
const digits = options.digits ?? defaultDigits(locale);
|
|
34
|
+
const month = getMonthNames('gregorian', locale)[date.month - 1];
|
|
35
|
+
return [formatNumber(date.day, digits), month, formatNumber(date.year, digits)].join(' ');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isValidHijri","defaultDigits","formatNumber","getMonthNames","ERA","ar","en","formatHijri","hijri","options","RangeError","year","month","day","locale","digits","join","formatGregorian","date"],"sourceRoot":"../../../src","sources":["core/format.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,cAAW;AACxC,SACEC,aAAa,EACbC,YAAY,EACZC,aAAa,QAGR,aAAU;AAWjB,MAAMC,GAA2B,GAAG;EAAEC,EAAE,EAAE,IAAI;EAAEC,EAAE,EAAE;AAAK,CAAC;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,KAAgB,EAChBC,OAA2B,GAAG,CAAC,CAAC,EACxB;EACR,IAAI,CAACT,YAAY,CAACQ,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIE,UAAU,CAClB,gBAAgBF,KAAK,CAACG,IAAI,IAAIH,KAAK,CAACI,KAAK,IAAIJ,KAAK,CAACK,GAAG,YAAY,GAChE,yCACJ,CAAC;EACH;EACA,MAAMC,MAAM,GAAGL,OAAO,CAACK,MAAM,IAAI,IAAI;EACrC,MAAMC,MAAM,GAAGN,OAAO,CAACM,MAAM,IAAId,aAAa,CAACa,MAAM,CAAC;EACtD,MAAMF,KAAK,GAAGT,aAAa,CAAC,OAAO,EAAEW,MAAM,CAAC,CAACN,KAAK,CAACI,KAAK,GAAG,CAAC,CAAC;EAC7D,OAAO,CACLV,YAAY,CAACM,KAAK,CAACK,GAAG,EAAEE,MAAM,CAAC,EAC/BH,KAAK,EACLV,YAAY,CAACM,KAAK,CAACG,IAAI,EAAEI,MAAM,CAAC,EAChCX,GAAG,CAACU,MAAM,CAAC,CACZ,CAACE,IAAI,CAAC,GAAG,CAAC;AACb;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,IAAe,EACfT,OAA2B,GAAG,CAAC,CAAC,EACxB;EACR,MAAMK,MAAM,GAAGL,OAAO,CAACK,MAAM,IAAI,IAAI;EACrC,MAAMC,MAAM,GAAGN,OAAO,CAACM,MAAM,IAAId,aAAa,CAACa,MAAM,CAAC;EACtD,MAAMF,KAAK,GAAGT,aAAa,CAAC,WAAW,EAAEW,MAAM,CAAC,CAACI,IAAI,CAACN,KAAK,GAAG,CAAC,CAAC;EAChE,OAAO,CACLV,YAAY,CAACgB,IAAI,CAACL,GAAG,EAAEE,MAAM,CAAC,EAC9BH,KAAK,EACLV,YAAY,CAACgB,IAAI,CAACP,IAAI,EAAEI,MAAM,CAAC,CAChC,CAACC,IAAI,CAAC,GAAG,CAAC;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { getHijriMonthLength, getSupportedRange, isValidHijri, toGregorian, toHijri } from "./convert.js";
|
|
4
|
+
export { formatHijri } from "./format.js";
|
|
5
|
+
export { getMonthNames, getWeekdayNames, toArabicDigits } from "./locale.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getHijriMonthLength","getSupportedRange","isValidHijri","toGregorian","toHijri","formatHijri","getMonthNames","getWeekdayNames","toArabicDigits"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,SACEA,mBAAmB,EACnBC,iBAAiB,EACjBC,YAAY,EACZC,WAAW,EACXC,OAAO,QAEF,cAAW;AAClB,SAASC,WAAW,QAAiC,aAAU;AAC/D,SACEC,aAAa,EACbC,eAAe,EACfC,cAAc,QAKT,aAAU","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const HIJRI_MONTHS = {
|
|
4
|
+
ar: ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'شعبان', 'رمضان', 'شوال', 'ذو القعدة', 'ذو الحجة'],
|
|
5
|
+
en: ['Muharram', 'Safar', "Rabi' al-Awwal", "Rabi' al-Thani", 'Jumada al-Ula', 'Jumada al-Akhirah', 'Rajab', "Sha'ban", 'Ramadan', 'Shawwal', "Dhu al-Qi'dah", 'Dhu al-Hijjah']
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// Saudi/Gulf style month names (يناير، فبراير ...), not the Levantine
|
|
9
|
+
// names (كانون الثاني، شباط ...).
|
|
10
|
+
const GREGORIAN_MONTHS = {
|
|
11
|
+
ar: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
|
|
12
|
+
en: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Sunday first, matching Date#getDay().
|
|
16
|
+
const WEEKDAYS = {
|
|
17
|
+
ar: {
|
|
18
|
+
long: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
|
|
19
|
+
short: ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
|
|
20
|
+
// The same letters as ICU's narrow format.
|
|
21
|
+
narrow: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س']
|
|
22
|
+
},
|
|
23
|
+
en: {
|
|
24
|
+
long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
25
|
+
short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
26
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The 12 month names of a calendar, January / Muharram first. Returns a
|
|
32
|
+
* new array on every call.
|
|
33
|
+
*/
|
|
34
|
+
export function getMonthNames(calendar, locale) {
|
|
35
|
+
const names = calendar === 'hijri' ? HIJRI_MONTHS : GREGORIAN_MONTHS;
|
|
36
|
+
return [...names[locale]];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The 7 weekday names, Sunday first (index matches `Date#getDay()`).
|
|
41
|
+
* Returns a new array on every call.
|
|
42
|
+
*/
|
|
43
|
+
export function getWeekdayNames(locale, format = 'long') {
|
|
44
|
+
return [...WEEKDAYS[locale][format]];
|
|
45
|
+
}
|
|
46
|
+
const ARABIC_INDIC_ZERO = 0x0660; // ٠
|
|
47
|
+
|
|
48
|
+
/** Replaces the Latin digits 0-9 with Arabic-Indic digits (٠-٩). */
|
|
49
|
+
export function toArabicDigits(input) {
|
|
50
|
+
return String(input).replace(/[0-9]/g, digit => String.fromCharCode(ARABIC_INDIC_ZERO + Number(digit)));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The default digits for a locale: Arabic-Indic for 'ar', Latin otherwise. */
|
|
54
|
+
export function defaultDigits(locale) {
|
|
55
|
+
return locale === 'ar' ? 'arabic' : 'latin';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Formats a number with the requested digits. */
|
|
59
|
+
export function formatNumber(value, digits) {
|
|
60
|
+
return digits === 'arabic' ? toArabicDigits(value) : String(value);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HIJRI_MONTHS","ar","en","GREGORIAN_MONTHS","WEEKDAYS","long","short","narrow","getMonthNames","calendar","locale","names","getWeekdayNames","format","ARABIC_INDIC_ZERO","toArabicDigits","input","String","replace","digit","fromCharCode","Number","defaultDigits","formatNumber","value","digits"],"sourceRoot":"../../../src","sources":["core/locale.ts"],"mappings":";;AAKA,MAAMA,YAA+C,GAAG;EACtDC,EAAE,EAAE,CACF,MAAM,EACN,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,CACX;EACDC,EAAE,EAAE,CACF,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,EACf,eAAe;AAEnB,CAAC;;AAED;AACA;AACA,MAAMC,gBAAmD,GAAG;EAC1DF,EAAE,EAAE,CACF,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,CACT;EACDC,EAAE,EAAE,CACF,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU;AAEd,CAAC;;AAED;AACA,MAAME,QAAkE,GAAG;EACzE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O,CAAC,QAAQ,EAAGC,KAAK,IAC3CF,MAAM,CAACG,YAAY,CAACN,iBAAiB,GAAGO,MAAM,CAACF,KAAK,CAAC,CACvD,CAAC;AACH;;AAEA;AACA,OAAO,SAASG,aAAaA,CAACZ,MAAc,EAAU;EACpD,OAAOA,MAAM,KAAK,IAAI,GAAG,QAAQ,GAAG,OAAO;AAC7C;;AAEA;AACA,OAAO,SAASa,YAAYA,CAACC,KAAa,EAAEC,MAAc,EAAU;EAClE,OAAOA,MAAM,KAAK,QAAQ,GAAGV,cAAc,CAACS,KAAK,CAAC,GAAGP,MAAM,CAACO,KAAK,CAAC;AACpE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["core/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// GENERATED FILE - DO NOT EDIT BY HAND.
|
|
4
|
+
// Generated by scripts/generate-umalqura-table.ts from Node's built-in ICU
|
|
5
|
+
// (v22.22.0, ICU 77.1). Run `yarn generate:umalqura` to rebuild.
|
|
6
|
+
|
|
7
|
+
/** First Hijri year in the table. */
|
|
8
|
+
export const UMALQURA_MIN_YEAR = 1356;
|
|
9
|
+
|
|
10
|
+
/** Last Hijri year in the table. */
|
|
11
|
+
export const UMALQURA_MAX_YEAR = 1500;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Days since 1970-01-01 (in the proleptic Gregorian calendar) of
|
|
15
|
+
* 1 Muharram 1356.
|
|
16
|
+
*/
|
|
17
|
+
export const UMALQURA_START_EPOCH_DAY = -11981;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* One entry per Hijri year from 1356 to 1500. Bit (month - 1) is
|
|
21
|
+
* set when that month has 30 days and clear when it has 29.
|
|
22
|
+
*/
|
|
23
|
+
export const UMALQURA_MONTH_LENGTH_MASKS = [3754, 3732, 3370, 3158, 1198, 2669, 1386, 3413, 3402, 2707, 1323, 2651, 1338, 1717, 3753, 3410, 3369, 2645, 1197, 1389, 2794, 1764, 3793, 3490, 2730, 2394, 730, 1465, 2994, 1892, 1737, 1365, 683, 1243, 2746, 1460, 3497, 3410, 2725, 2349, 621, 2285, 730, 2773, 2725, 2635, 1175, 2359, 694, 2421, 3433, 3410, 3221, 2347, 603, 1243, 2517, 1490, 3493, 3402, 2709, 1357, 2733, 938, 3026, 3012, 2953, 2709, 1325, 1453, 2922, 1748, 3529, 3474, 2726, 2390, 686, 1389, 874, 2901, 2730, 2381, 1181, 2397, 698, 1461, 1450, 3413, 2714, 2350, 622, 1373, 2778, 1748, 1701, 2855, 2637, 1197, 1389, 2906, 1876, 3913, 3730, 3366, 2646, 854, 1717, 2986, 2962, 2853, 1675, 2715, 1370, 2778, 1460, 3497, 2898, 2714, 1334, 630, 1397, 2802, 1748, 1705, 1365, 685, 1213, 2490, 1396, 2921, 2898, 2709, 1325, 2653, 1242, 2777, 1714, 3733, 3626, 3222, 2350, 2733, 1386, 3429, 3402];
|
|
24
|
+
//# sourceMappingURL=umalqura-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["UMALQURA_MIN_YEAR","UMALQURA_MAX_YEAR","UMALQURA_START_EPOCH_DAY","UMALQURA_MONTH_LENGTH_MASKS"],"sourceRoot":"../../../src","sources":["core/umalqura-data.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,iBAAiB,GAAG,IAAI;;AAErC;AACA,OAAO,MAAMC,iBAAiB,GAAG,IAAI;;AAErC;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAG,CAAC,KAAK;;AAE9C;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA8C,GAAG,CAC5D,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,I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,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAC3E,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAC1E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAC5E,IAAI,EAAE,IAAI,CACX","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,iBAAQ;AACtB,cAAc,qBAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type LayoutChangeEvent, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
type AppearProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Fade and zoom in on mount. False renders a plain View. Read once, on
|
|
6
|
+
* mount, so the content never remounts when it changes.
|
|
7
|
+
*/
|
|
8
|
+
animate: boolean;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Fades its content in with a slight zoom when it mounts, so switching
|
|
15
|
+
* between the days and the month or year picker is not an abrupt jump.
|
|
16
|
+
* Give it a new `key` to play it again.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Appear({ animate, style, onLayout, children }: AppearProps): import("react").JSX.Element;
|
|
19
|
+
/** Whether the user asked the system to reduce motion. */
|
|
20
|
+
export declare function useReduceMotion(): boolean;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=Appear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Appear.d.ts","sourceRoot":"","sources":["../../../../src/calendar/Appear.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAMtB,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,WAAW,+BAwCzE;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,YAkB9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ChevronProps = {
|
|
2
|
+
direction: 'left' | 'right';
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* A chevron drawn with two rotated strokes. Not a text glyph: '‹' and '›'
|
|
7
|
+
* are mirrored by the Unicode bidi algorithm in right-to-left text, so they
|
|
8
|
+
* would point the wrong way in RTL apps. No left/right styles either, since
|
|
9
|
+
* React Native swaps those in RTL layouts.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Chevron({ direction, color }: ChevronProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=Chevron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chevron.d.ts","sourceRoot":"","sources":["../../../../src/calendar/Chevron.tsx"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAQF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,YAAY,+BAqBzD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { CalendarStyles } from './styles.js';
|
|
3
|
+
export type DayCellProps = {
|
|
4
|
+
epochDay: number;
|
|
5
|
+
label: string;
|
|
6
|
+
secondaryLabel: string | null;
|
|
7
|
+
accessibilityLabel: string;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
today: boolean;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
styles: CalendarStyles;
|
|
12
|
+
dayStyle: StyleProp<ViewStyle>;
|
|
13
|
+
/** maxFontSizeMultiplier of the texts. */
|
|
14
|
+
maxFontScale: number;
|
|
15
|
+
onSelect: (epochDay: number) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One day of the grid. Memoized: every prop is either a primitive or kept
|
|
19
|
+
* stable by the calendar, so pressing a day only re-renders the old and
|
|
20
|
+
* the new selected day.
|
|
21
|
+
*/
|
|
22
|
+
export declare function DayCellView({ epochDay, label, secondaryLabel, accessibilityLabel, selected, today, disabled, styles, dayStyle, maxFontScale, onSelect, }: DayCellProps): import("react").JSX.Element;
|
|
23
|
+
export declare const DayCell: import("react").MemoExoticComponent<typeof DayCellView>;
|
|
24
|
+
//# sourceMappingURL=DayCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayCell.d.ts","sourceRoot":"","sources":["../../../../src/calendar/DayCell.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAU,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,EAAE,YAAY,+BA2Cd;AAED,eAAO,MAAM,OAAO,yDAAoB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HilalCalendarProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A month-grid date picker for the Umm al-Qura Hijri and the Gregorian
|
|
4
|
+
* calendar.
|
|
5
|
+
*/
|
|
6
|
+
export declare function HilalCalendar({ value, defaultValue, onChange, calendar: calendarProp, onCalendarChange, showCalendarToggle, showSecondaryDate, locale, digits: digitsProp, direction, firstDayOfWeek, minDate, maxDate, isDateDisabled, hijriAdjustment, showMonthYearPicker, weekdayFormat, theme: themeProp, styles: stylesProp, labels: labelsProp, style, dayStyle, maxFontSizeMultiplier, }: HilalCalendarProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=HilalCalendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HilalCalendar.d.ts","sourceRoot":"","sources":["../../../../src/calendar/HilalCalendar.tsx"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EAAE,kBAAkB,EAA6B,MAAM,YAAS,CAAC;AA4F7E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,QAAQ,EAAE,YAAsB,EAChC,gBAAgB,EAChB,kBAAyB,EACzB,iBAAwB,EACxB,MAAa,EACb,MAAM,EAAE,UAAU,EAClB,SAAkB,EAClB,cAAkB,EAClB,OAAO,EACP,OAAO,EACP,cAAc,EACd,eAAmB,EACnB,mBAA0B,EAC1B,aAAuB,EACvB,KAAK,EAAE,SAAkB,EACzB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,KAAK,EACL,QAAQ,EACR,qBAAqB,GACtB,EAAE,kBAAkB,+BAwhBpB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CalendarStyles } from './styles.js';
|
|
2
|
+
export type PickerGridItem = {
|
|
3
|
+
key: number;
|
|
4
|
+
label: string;
|
|
5
|
+
accessibilityLabel: string;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
/** The current month or year (today's), drawn with a ring. */
|
|
8
|
+
current: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
};
|
|
11
|
+
type PickerGridProps = {
|
|
12
|
+
items: PickerGridItem[];
|
|
13
|
+
styles: CalendarStyles;
|
|
14
|
+
/** 'row' or 'row-reverse', the same as the day grid. */
|
|
15
|
+
row: 'row' | 'row-reverse';
|
|
16
|
+
/** Grow the rows to fill the parent's height. */
|
|
17
|
+
fill: boolean;
|
|
18
|
+
/** maxFontSizeMultiplier of the texts. */
|
|
19
|
+
maxFontScale: number;
|
|
20
|
+
onSelect: (key: number) => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The month or year picker: items in rows of three, each a button. Only
|
|
24
|
+
* rendered while the picker is open.
|
|
25
|
+
*/
|
|
26
|
+
export declare function PickerGrid({ items, styles, row, fill, maxFontScale, onSelect, }: PickerGridProps): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=PickerGrid.d.ts.map
|