react-native-hilal 0.0.0-stage → 0.1.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.
Files changed (85) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +221 -2
  3. package/lib/module/calendar/Chevron.js +60 -0
  4. package/lib/module/calendar/Chevron.js.map +1 -0
  5. package/lib/module/calendar/DayCell.js +48 -0
  6. package/lib/module/calendar/DayCell.js.map +1 -0
  7. package/lib/module/calendar/HilalCalendar.js +288 -0
  8. package/lib/module/calendar/HilalCalendar.js.map +1 -0
  9. package/lib/module/calendar/index.js +5 -0
  10. package/lib/module/calendar/index.js.map +1 -0
  11. package/lib/module/calendar/month.js +178 -0
  12. package/lib/module/calendar/month.js.map +1 -0
  13. package/lib/module/calendar/styles.js +125 -0
  14. package/lib/module/calendar/styles.js.map +1 -0
  15. package/lib/module/calendar/theme.js +49 -0
  16. package/lib/module/calendar/theme.js.map +1 -0
  17. package/lib/module/calendar/types.js +4 -0
  18. package/lib/module/calendar/types.js.map +1 -0
  19. package/lib/module/core/convert.js +160 -0
  20. package/lib/module/core/convert.js.map +1 -0
  21. package/lib/module/core/days.js +61 -0
  22. package/lib/module/core/days.js.map +1 -0
  23. package/lib/module/core/format.js +37 -0
  24. package/lib/module/core/format.js.map +1 -0
  25. package/lib/module/core/index.js +6 -0
  26. package/lib/module/core/index.js.map +1 -0
  27. package/lib/module/core/locale.js +59 -0
  28. package/lib/module/core/locale.js.map +1 -0
  29. package/lib/module/core/types.js +2 -0
  30. package/lib/module/core/types.js.map +1 -0
  31. package/lib/module/core/umalqura-data.js +24 -0
  32. package/lib/module/core/umalqura-data.js.map +1 -0
  33. package/lib/module/index.js +5 -0
  34. package/lib/module/index.js.map +1 -0
  35. package/lib/module/package.json +1 -0
  36. package/lib/typescript/package.json +1 -0
  37. package/lib/typescript/src/calendar/Chevron.d.ts +13 -0
  38. package/lib/typescript/src/calendar/Chevron.d.ts.map +1 -0
  39. package/lib/typescript/src/calendar/DayCell.d.ts +22 -0
  40. package/lib/typescript/src/calendar/DayCell.d.ts.map +1 -0
  41. package/lib/typescript/src/calendar/HilalCalendar.d.ts +7 -0
  42. package/lib/typescript/src/calendar/HilalCalendar.d.ts.map +1 -0
  43. package/lib/typescript/src/calendar/index.d.ts +4 -0
  44. package/lib/typescript/src/calendar/index.d.ts.map +1 -0
  45. package/lib/typescript/src/calendar/month.d.ts +63 -0
  46. package/lib/typescript/src/calendar/month.d.ts.map +1 -0
  47. package/lib/typescript/src/calendar/styles.d.ts +119 -0
  48. package/lib/typescript/src/calendar/styles.d.ts.map +1 -0
  49. package/lib/typescript/src/calendar/theme.d.ts +31 -0
  50. package/lib/typescript/src/calendar/theme.d.ts.map +1 -0
  51. package/lib/typescript/src/calendar/types.d.ts +58 -0
  52. package/lib/typescript/src/calendar/types.d.ts.map +1 -0
  53. package/lib/typescript/src/core/convert.d.ts +54 -0
  54. package/lib/typescript/src/core/convert.d.ts.map +1 -0
  55. package/lib/typescript/src/core/days.d.ts +24 -0
  56. package/lib/typescript/src/core/days.d.ts.map +1 -0
  57. package/lib/typescript/src/core/format.d.ts +23 -0
  58. package/lib/typescript/src/core/format.d.ts.map +1 -0
  59. package/lib/typescript/src/core/index.d.ts +5 -0
  60. package/lib/typescript/src/core/index.d.ts.map +1 -0
  61. package/lib/typescript/src/core/locale.d.ts +21 -0
  62. package/lib/typescript/src/core/locale.d.ts.map +1 -0
  63. package/lib/typescript/src/core/types.d.ts +7 -0
  64. package/lib/typescript/src/core/types.d.ts.map +1 -0
  65. package/lib/typescript/src/core/umalqura-data.d.ts +15 -0
  66. package/lib/typescript/src/core/umalqura-data.d.ts.map +1 -0
  67. package/lib/typescript/src/index.d.ts +3 -0
  68. package/lib/typescript/src/index.d.ts.map +1 -0
  69. package/package.json +180 -4
  70. package/src/calendar/Chevron.tsx +55 -0
  71. package/src/calendar/DayCell.tsx +83 -0
  72. package/src/calendar/HilalCalendar.tsx +399 -0
  73. package/src/calendar/index.ts +8 -0
  74. package/src/calendar/month.ts +213 -0
  75. package/src/calendar/styles.ts +127 -0
  76. package/src/calendar/theme.ts +69 -0
  77. package/src/calendar/types.ts +61 -0
  78. package/src/core/convert.ts +192 -0
  79. package/src/core/days.ts +64 -0
  80. package/src/core/format.ts +65 -0
  81. package/src/core/index.ts +18 -0
  82. package/src/core/locale.ts +138 -0
  83. package/src/core/types.ts +6 -0
  84. package/src/core/umalqura-data.ts +34 -0
  85. package/src/index.tsx +2 -0
@@ -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,GAAG,CAAC,GAC3BE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;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,QACF,cAAW;AAClB,SAASC,WAAW,QAAiC,aAAU;AAC/D,SACEC,aAAa,EACbC,eAAe,EACfC,cAAc,QAKT,aAAU","ignoreList":[]}
@@ -0,0 +1,59 @@
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
+ },
21
+ en: {
22
+ long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
23
+ short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
24
+ }
25
+ };
26
+
27
+ /**
28
+ * The 12 month names of a calendar, January / Muharram first. Returns a
29
+ * new array on every call.
30
+ */
31
+ export function getMonthNames(calendar, locale) {
32
+ const names = calendar === 'hijri' ? HIJRI_MONTHS : GREGORIAN_MONTHS;
33
+ return [...names[locale]];
34
+ }
35
+
36
+ /**
37
+ * The 7 weekday names, Sunday first (index matches `Date#getDay()`).
38
+ * Returns a new array on every call.
39
+ */
40
+ export function getWeekdayNames(locale, format = 'long') {
41
+ return [...WEEKDAYS[locale][format]];
42
+ }
43
+ const ARABIC_INDIC_ZERO = 0x0660; // ٠
44
+
45
+ /** Replaces the Latin digits 0-9 with Arabic-Indic digits (٠-٩). */
46
+ export function toArabicDigits(input) {
47
+ return String(input).replace(/[0-9]/g, digit => String.fromCharCode(ARABIC_INDIC_ZERO + Number(digit)));
48
+ }
49
+
50
+ /** The default digits for a locale: Arabic-Indic for 'ar', Latin otherwise. */
51
+ export function defaultDigits(locale) {
52
+ return locale === 'ar' ? 'arabic' : 'latin';
53
+ }
54
+
55
+ /** Formats a number with the requested digits. */
56
+ export function formatNumber(value, digits) {
57
+ return digits === 'arabic' ? toArabicDigits(value) : String(value);
58
+ }
59
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HIJRI_MONTHS","ar","en","GREGORIAN_MONTHS","WEEKDAYS","long","short","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,EAC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AM,CAACD,KAAK,CAAC,CAACE,OAAO,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,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -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,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAC5E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAA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AAI,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,5 @@
1
+ "use strict";
2
+
3
+ export * from "./core/index.js";
4
+ export * from "./calendar/index.js";
5
+ //# sourceMappingURL=index.js.map
@@ -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,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,22 @@
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
+ onSelect: (epochDay: number) => void;
14
+ };
15
+ /**
16
+ * One day of the grid. Memoized: every prop is either a primitive or kept
17
+ * stable by the calendar, so pressing a day only re-renders the old and
18
+ * the new selected day.
19
+ */
20
+ export declare function DayCellView({ epochDay, label, secondaryLabel, accessibilityLabel, selected, today, disabled, styles, dayStyle, onSelect, }: DayCellProps): import("react").JSX.Element;
21
+ export declare const DayCell: import("react").MemoExoticComponent<typeof DayCellView>;
22
+ //# 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,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,QAAQ,GACT,EAAE,YAAY,+BAwCd;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, theme: themeProp, style, dayStyle, }: 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":"AA0CA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,YAAS,CAAC;AAyEhE;;;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,KAAK,EAAE,SAAkB,EACzB,KAAK,EACL,QAAQ,GACT,EAAE,kBAAkB,+BAqQpB"}
@@ -0,0 +1,4 @@
1
+ export { HilalCalendar } from './HilalCalendar.js';
2
+ export { darkTheme, lightTheme, type HilalTheme, type ThemeProp, } from './theme.js';
3
+ export type { HilalCalendarProps, SelectedDate } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AAChD,OAAO,EACL,SAAS,EACT,UAAU,EACV,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,YAAS,CAAC;AACjB,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAS,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { type CalendarType, type Digits, type Locale } from '../core/locale.js';
2
+ /** A month of either calendar. `month` is 1-12. */
3
+ export type CalendarMonth = {
4
+ calendar: CalendarType;
5
+ year: number;
6
+ month: number;
7
+ };
8
+ export type DayCell = {
9
+ epochDay: number;
10
+ /** Day of the month in the primary calendar. */
11
+ day: number;
12
+ /**
13
+ * Day of the month in the other calendar, or null when the day is
14
+ * outside the supported Hijri range (possible in the first and last
15
+ * Gregorian months).
16
+ */
17
+ secondaryDay: number | null;
18
+ };
19
+ /** A month as weeks of 7 slots; null slots pad the first and last week. */
20
+ export type MonthGrid = Array<Array<DayCell | null>>;
21
+ /** Inclusive range of epoch days. */
22
+ export type DayRange = {
23
+ min: number;
24
+ max: number;
25
+ };
26
+ /** The days the calendar can ever show: the supported Hijri range. */
27
+ export declare const SUPPORTED_DAYS: DayRange;
28
+ export declare function otherCalendar(calendar: CalendarType): CalendarType;
29
+ /** Epoch day of the first day of a month. */
30
+ export declare function monthStart({ calendar, year, month }: CalendarMonth): number;
31
+ /** Number of days in a month. */
32
+ export declare function monthLength(m: CalendarMonth): number;
33
+ /** Year, month and day of an epoch day in either calendar. */
34
+ export declare function dateInCalendar(epochDay: number, calendar: CalendarType): import("../core/days.js").CivilDate;
35
+ /**
36
+ * The month of `calendar` that contains `epochDay`. Days outside the
37
+ * supported range are clamped to it first.
38
+ */
39
+ export declare function monthContaining(epochDay: number, calendar: CalendarType): CalendarMonth;
40
+ export declare function addMonths(m: CalendarMonth, delta: number): CalendarMonth;
41
+ export declare function clampDay(epochDay: number, range: DayRange): number;
42
+ /**
43
+ * The days that may be selected: `minDay`/`maxDay` (when given)
44
+ * intersected with the supported range.
45
+ */
46
+ export declare function selectableRange(minDay: number | undefined, maxDay: number | undefined): DayRange;
47
+ /** Whether any day of month `m` falls inside `range`. */
48
+ export declare function monthOverlaps(m: CalendarMonth, range: DayRange): boolean;
49
+ /**
50
+ * Lays out month `m` in weeks starting on `firstDayOfWeek` (0 = Sunday,
51
+ * 1 = Monday, 6 = Saturday).
52
+ */
53
+ export declare function buildMonthGrid(m: CalendarMonth, firstDayOfWeek: number): MonthGrid;
54
+ /** "رمضان ١٤٤٦" / "Ramadan 1446" / "March 2025". */
55
+ export declare function monthTitle(m: CalendarMonth, locale: Locale, digits: Digits): string;
56
+ /**
57
+ * The months of the other calendar that month `m` overlaps, for example
58
+ * "مارس – أبريل ٢٠٢٤" for Ramadan 1445, "ديسمبر ٢٠٢٤ – يناير ٢٠٢٥" across
59
+ * a year boundary, or a single month. Only days in the supported range
60
+ * count.
61
+ */
62
+ export declare function secondaryTitle(m: CalendarMonth, locale: Locale, digits: Digits): string;
63
+ //# sourceMappingURL=month.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month.d.ts","sourceRoot":"","sources":["../../../../src/calendar/month.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,MAAM,EACZ,MAAM,mBAAgB,CAAC;AAExB,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,SAA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,MAAM,EAAE,MAAM,EAAE,MAAM,UAG1E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,CAAC,EAAE,aAAa,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,UAoBf"}
@@ -0,0 +1,119 @@
1
+ import type { HilalTheme } from './theme.js';
2
+ export type CalendarStyles = ReturnType<typeof createStyles>;
3
+ export declare function createStyles(theme: HilalTheme): Readonly<{
4
+ container: {
5
+ backgroundColor: string;
6
+ borderRadius: number;
7
+ padding: number;
8
+ };
9
+ toggle: {
10
+ alignSelf: "center";
11
+ borderColor: string;
12
+ borderRadius: number;
13
+ borderWidth: number;
14
+ marginBottom: number;
15
+ padding: number;
16
+ };
17
+ toggleOption: {
18
+ borderRadius: number;
19
+ paddingHorizontal: number;
20
+ paddingVertical: number;
21
+ };
22
+ toggleOptionActive: {
23
+ backgroundColor: string;
24
+ };
25
+ toggleText: {
26
+ color: string;
27
+ fontSize: number;
28
+ fontWeight: "600";
29
+ };
30
+ toggleTextActive: {
31
+ color: string;
32
+ };
33
+ header: {
34
+ alignItems: "center";
35
+ marginBottom: number;
36
+ };
37
+ titles: {
38
+ alignItems: "center";
39
+ flex: number;
40
+ };
41
+ title: {
42
+ color: string;
43
+ fontSize: number;
44
+ fontWeight: "700";
45
+ };
46
+ subtitle: {
47
+ color: string;
48
+ fontSize: number;
49
+ marginTop: number;
50
+ };
51
+ arrow: {
52
+ alignItems: "center";
53
+ borderRadius: number;
54
+ height: number;
55
+ justifyContent: "center";
56
+ width: number;
57
+ };
58
+ arrowPressed: {
59
+ backgroundColor: string;
60
+ };
61
+ weekdays: {
62
+ marginBottom: number;
63
+ };
64
+ weekday: {
65
+ color: string;
66
+ flex: number;
67
+ fontSize: number;
68
+ fontWeight: "600";
69
+ textAlign: "center";
70
+ };
71
+ week: {};
72
+ slot: {
73
+ alignItems: "center";
74
+ flex: number;
75
+ paddingHorizontal: number;
76
+ paddingVertical: number;
77
+ };
78
+ day: {
79
+ alignItems: "center";
80
+ borderColor: string;
81
+ borderRadius: number;
82
+ borderWidth: number;
83
+ height: number;
84
+ justifyContent: "center";
85
+ maxWidth: number;
86
+ width: string;
87
+ };
88
+ today: {
89
+ borderColor: string;
90
+ };
91
+ selected: {
92
+ backgroundColor: string;
93
+ borderColor: string;
94
+ };
95
+ pressed: {
96
+ backgroundColor: string;
97
+ };
98
+ dayText: {
99
+ color: string;
100
+ fontSize: number;
101
+ fontWeight: "600";
102
+ };
103
+ secondaryText: {
104
+ color: string;
105
+ fontSize: number;
106
+ marginTop: number;
107
+ };
108
+ selectedText: {
109
+ color: string;
110
+ };
111
+ selectedSecondaryText: {
112
+ color: string;
113
+ opacity: number;
114
+ };
115
+ disabledText: {
116
+ color: string;
117
+ };
118
+ }>;
119
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/calendar/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAE7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwH7C"}
@@ -0,0 +1,31 @@
1
+ /** Colors and shape of the calendar. */
2
+ export type HilalTheme = {
3
+ /** Calendar background. */
4
+ background: string;
5
+ /** Day numbers, month title, arrows. */
6
+ text: string;
7
+ /** Secondary-calendar dates and weekday names. */
8
+ textSecondary: string;
9
+ /** Selected day and active calendar toggle. */
10
+ primary: string;
11
+ /** Text on `primary`. */
12
+ onPrimary: string;
13
+ /** Ring around today's date. */
14
+ today: string;
15
+ /** Days that can't be selected, and disabled arrows. */
16
+ disabled: string;
17
+ /** Toggle outline. */
18
+ border: string;
19
+ /** Corner radius of a day cell. */
20
+ radius: number;
21
+ };
22
+ export type ThemeProp = 'light' | 'dark' | 'auto' | Partial<HilalTheme>;
23
+ export declare const lightTheme: HilalTheme;
24
+ export declare const darkTheme: HilalTheme;
25
+ /**
26
+ * The theme to render with. 'auto' follows the system color scheme. A
27
+ * partial theme is merged over the 'auto' theme, so a custom `primary`
28
+ * color works in both light and dark mode.
29
+ */
30
+ export declare function resolveTheme(theme: ThemeProp, colorScheme: string | null | undefined): HilalTheme;
31
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/calendar/theme.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG;IACvB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAExE,eAAO,MAAM,UAAU,EAAE,UAUxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,UAUvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACrC,UAAU,CAYZ"}
@@ -0,0 +1,58 @@
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
+ import type { CalendarType, Digits, Locale } from '../core/locale.js';
3
+ import type { HijriDate } from '../core/types.js';
4
+ import type { ThemeProp } from './theme.js';
5
+ /** A day picked in the calendar, in both calendars. */
6
+ export type SelectedDate = {
7
+ /** Local midnight of the day. */
8
+ gregorian: Date;
9
+ hijri: HijriDate;
10
+ /** Both dates as text in the calendar's locale and digits. */
11
+ formatted: {
12
+ gregorian: string;
13
+ hijri: string;
14
+ };
15
+ };
16
+ export type HilalCalendarProps = {
17
+ /** Selected day (controlled). Only the local calendar day is used. */
18
+ value?: Date;
19
+ /** Initially selected day (uncontrolled). */
20
+ defaultValue?: Date;
21
+ /** Called when the user picks a day. */
22
+ onChange?: (date: SelectedDate) => void;
23
+ /** Calendar of the month grid. Default 'hijri'. */
24
+ calendar?: CalendarType;
25
+ /** Called when the user switches calendars with the toggle. */
26
+ onCalendarChange?: (calendar: CalendarType) => void;
27
+ /** Show the Hijri / Gregorian toggle. Default true. */
28
+ showCalendarToggle?: boolean;
29
+ /** Show the other calendar's day under each day. Default true. */
30
+ showSecondaryDate?: boolean;
31
+ /** Language of names and labels. Default 'ar'. */
32
+ locale?: Locale;
33
+ /** Default 'arabic' when locale is 'ar', otherwise 'latin'. */
34
+ digits?: Digits;
35
+ /**
36
+ * Layout direction. 'auto' (default) is right-to-left when the app runs
37
+ * right-to-left (`I18nManager.isRTL`) or the locale is 'ar'.
38
+ */
39
+ direction?: 'rtl' | 'ltr' | 'auto';
40
+ /** 0 = Sunday (default), 1 = Monday, 6 = Saturday. */
41
+ firstDayOfWeek?: 0 | 1 | 6;
42
+ /** Earliest selectable day. */
43
+ minDate?: Date;
44
+ /** Latest selectable day. */
45
+ maxDate?: Date;
46
+ /** Return true to disable a day. */
47
+ isDateDisabled?: (date: SelectedDate) => boolean;
48
+ /**
49
+ * 'light', 'dark', 'auto' (default, follows the system color scheme),
50
+ * or a partial theme merged over the 'auto' theme.
51
+ */
52
+ theme?: ThemeProp;
53
+ /** Style of the outer container. */
54
+ style?: StyleProp<ViewStyle>;
55
+ /** Style of every day cell (the pressable circle). */
56
+ dayStyle?: StyleProp<ViewStyle>;
57
+ };
58
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/calendar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAEzC,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG;IACzB,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,8DAA8D;IAC9D,SAAS,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sEAAsE;IACtE,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,6CAA6C;IAC7C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAExC,mDAAmD;IACnD,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,uDAAuD;IACvD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACnC,sDAAsD;IACtD,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE3B,+BAA+B;IAC/B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,6BAA6B;IAC7B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,oCAAoC;IACpC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;IAEjD;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACjC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { HijriDate } from './types.js';
2
+ /** First and last epoch day of the supported range (both inclusive). */
3
+ export declare const FIRST_DAY: number;
4
+ export declare const LAST_DAY: number;
5
+ /** First and last Hijri dates the table covers. */
6
+ export declare function getSupportedRange(): {
7
+ min: HijriDate;
8
+ max: HijriDate;
9
+ };
10
+ /**
11
+ * Number of days in a Hijri month.
12
+ *
13
+ * @throws {RangeError} if the year is outside the supported range or the
14
+ * month is not an integer from 1 to 12.
15
+ */
16
+ export declare function getHijriMonthLength(year: number, month: number): 29 | 30;
17
+ /** Whether `hijri` is a real day within the supported range. */
18
+ export declare function isValidHijri(hijri: HijriDate): boolean;
19
+ /**
20
+ * Hijri date of an epoch day. Internal: the public entry point is
21
+ * `toHijri`.
22
+ *
23
+ * @throws {RangeError} if the day is outside the supported range.
24
+ */
25
+ export declare function hijriOfEpochDay(epochDay: number, caller?: string): {
26
+ year: number;
27
+ month: number;
28
+ day: number;
29
+ };
30
+ /**
31
+ * Epoch day of a Hijri date. Internal: the public entry point is
32
+ * `toGregorian`.
33
+ *
34
+ * @throws {RangeError} if `hijri` is not a valid date in the supported
35
+ * range.
36
+ */
37
+ export declare function epochDayOfHijri(hijri: HijriDate, caller?: string): number;
38
+ /**
39
+ * Converts the local calendar day of `date` to a Hijri date. The time of
40
+ * day and the time zone offset are ignored: 23:59 and 00:00 on the same
41
+ * local day give the same result.
42
+ *
43
+ * @throws {RangeError} if `date` is invalid or outside the supported range.
44
+ */
45
+ export declare function toHijri(date: Date): HijriDate;
46
+ /**
47
+ * Converts a Hijri date to a `Date` at local midnight of the matching
48
+ * Gregorian day.
49
+ *
50
+ * @throws {RangeError} if `hijri` is not a valid date in the supported
51
+ * range.
52
+ */
53
+ export declare function toGregorian(hijri: HijriDate): Date;
54
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../../src/core/convert.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AA0BzC,wEAAwE;AACxE,eAAO,MAAM,SAAS,QAAmB,CAAC;AAC1C,eAAO,MAAM,QAAQ,QAA6C,CAAC;AAoBnE,mDAAmD;AACnD,wBAAgB,iBAAiB,IAAI;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,CAgBxE;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAkBtD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY;;;;EA6BnE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,SAAgB,UAYvE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAK7C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAElD"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Calendar-day arithmetic on plain year/month/day numbers.
3
+ *
4
+ * Days are counted from 1970-01-01 in the proleptic Gregorian calendar
5
+ * ("epoch days"). The algorithms are Howard Hinnant's `days_from_civil`
6
+ * and `civil_from_days`, which use integer math only and never touch a
7
+ * time zone.
8
+ */
9
+ export type CivilDate = {
10
+ year: number;
11
+ month: number;
12
+ day: number;
13
+ };
14
+ /** Epoch day of a Gregorian year/month/day (month is 1-12). */
15
+ export declare function daysFromCivil(year: number, month: number, day: number): number;
16
+ /** Gregorian year/month/day (month is 1-12) of an epoch day. */
17
+ export declare function civilFromDays(epochDay: number): CivilDate;
18
+ /** Epoch day of the local calendar day `date` falls on. */
19
+ export declare function epochDayOfLocalDate(date: Date): number;
20
+ /** A `Date` at local midnight (start of day) of an epoch day. */
21
+ export declare function localDateOfEpochDay(epochDay: number): Date;
22
+ /** Day of the week of an epoch day, 0 = Sunday (like `Date#getDay()`). */
23
+ export declare function weekdayOfEpochDay(epochDay: number): number;
24
+ //# sourceMappingURL=days.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"days.d.ts","sourceRoot":"","sources":["../../../../src/core/days.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAYrE;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAmBzD;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,UAE7C;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,QAGnD;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,UAGjD"}