react-day-picker 9.9.0 → 9.10.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/README.md +25 -6
- package/dist/cjs/ethiopic/index.d.ts +42 -0
- package/dist/cjs/ethiopic/index.js +75 -0
- package/dist/cjs/ethiopic/lib/addMonths.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/addMonths.js +27 -0
- package/dist/cjs/ethiopic/lib/addYears.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/addYears.js +26 -0
- package/dist/cjs/ethiopic/lib/differenceInCalendarMonths.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/differenceInCalendarMonths.js +17 -0
- package/dist/cjs/ethiopic/lib/eachMonthOfInterval.d.ts +11 -0
- package/dist/cjs/ethiopic/lib/eachMonthOfInterval.js +30 -0
- package/dist/cjs/ethiopic/lib/endOfMonth.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/endOfMonth.js +17 -0
- package/dist/cjs/ethiopic/lib/endOfWeek.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/endOfWeek.js +16 -0
- package/dist/cjs/ethiopic/lib/endOfYear.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/endOfYear.js +15 -0
- package/dist/cjs/ethiopic/lib/format.d.ts +21 -0
- package/dist/cjs/ethiopic/lib/format.js +118 -0
- package/dist/cjs/ethiopic/lib/formatNumber.d.ts +19 -0
- package/dist/cjs/ethiopic/lib/formatNumber.js +32 -0
- package/dist/cjs/ethiopic/lib/getMonth.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/getMonth.js +14 -0
- package/dist/cjs/ethiopic/lib/getWeek.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/getWeek.js +44 -0
- package/dist/cjs/ethiopic/lib/getYear.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/getYear.js +14 -0
- package/dist/cjs/ethiopic/lib/index.d.ts +21 -0
- package/dist/cjs/ethiopic/lib/index.js +37 -0
- package/dist/cjs/ethiopic/lib/isSameMonth.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/isSameMonth.js +16 -0
- package/dist/cjs/ethiopic/lib/isSameYear.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/isSameYear.js +16 -0
- package/dist/cjs/ethiopic/lib/newDate.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/newDate.js +25 -0
- package/dist/cjs/ethiopic/lib/setMonth.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/setMonth.js +15 -0
- package/dist/cjs/ethiopic/lib/setYear.d.ts +8 -0
- package/dist/cjs/ethiopic/lib/setYear.js +19 -0
- package/dist/cjs/ethiopic/lib/startOfDay.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/startOfDay.js +14 -0
- package/dist/cjs/ethiopic/lib/startOfMonth.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/startOfMonth.js +14 -0
- package/dist/cjs/ethiopic/lib/startOfWeek.d.ts +9 -0
- package/dist/cjs/ethiopic/lib/startOfWeek.js +15 -0
- package/dist/cjs/ethiopic/lib/startOfYear.d.ts +7 -0
- package/dist/cjs/ethiopic/lib/startOfYear.js +14 -0
- package/dist/cjs/ethiopic/locale/am-ET.d.ts +4 -0
- package/dist/cjs/ethiopic/locale/am-ET.js +99 -0
- package/dist/cjs/ethiopic/utils/EthiopicDate.d.ts +17 -0
- package/dist/cjs/ethiopic/utils/EthiopicDate.js +2 -0
- package/dist/cjs/ethiopic/utils/daysInMonth.d.ts +13 -0
- package/dist/cjs/ethiopic/utils/daysInMonth.js +22 -0
- package/dist/cjs/ethiopic/utils/index.d.ts +6 -0
- package/dist/cjs/ethiopic/utils/index.js +22 -0
- package/dist/cjs/ethiopic/utils/isEthiopicDateValid.d.ts +2 -0
- package/dist/cjs/ethiopic/utils/isEthiopicDateValid.js +15 -0
- package/dist/cjs/ethiopic/utils/isEthiopicLeapYear.d.ts +7 -0
- package/dist/cjs/ethiopic/utils/isEthiopicLeapYear.js +12 -0
- package/dist/cjs/ethiopic/utils/toEthiopicDate.d.ts +17 -0
- package/dist/cjs/ethiopic/utils/toEthiopicDate.js +54 -0
- package/dist/cjs/ethiopic/utils/toGeezNumerals.d.ts +8 -0
- package/dist/cjs/ethiopic/utils/toGeezNumerals.js +51 -0
- package/dist/cjs/ethiopic/utils/toGregorianDate.d.ts +9 -0
- package/dist/cjs/ethiopic/utils/toGregorianDate.js +59 -0
- package/dist/cjs/types/shared.d.ts +1 -1
- package/dist/esm/ethiopic/index.d.ts +42 -0
- package/dist/esm/ethiopic/index.js +32 -0
- package/dist/esm/ethiopic/lib/addMonths.d.ts +9 -0
- package/dist/esm/ethiopic/lib/addMonths.js +24 -0
- package/dist/esm/ethiopic/lib/addYears.d.ts +9 -0
- package/dist/esm/ethiopic/lib/addYears.js +23 -0
- package/dist/esm/ethiopic/lib/differenceInCalendarMonths.d.ts +8 -0
- package/dist/esm/ethiopic/lib/differenceInCalendarMonths.js +14 -0
- package/dist/esm/ethiopic/lib/eachMonthOfInterval.d.ts +11 -0
- package/dist/esm/ethiopic/lib/eachMonthOfInterval.js +27 -0
- package/dist/esm/ethiopic/lib/endOfMonth.d.ts +8 -0
- package/dist/esm/ethiopic/lib/endOfMonth.js +14 -0
- package/dist/esm/ethiopic/lib/endOfWeek.d.ts +9 -0
- package/dist/esm/ethiopic/lib/endOfWeek.js +13 -0
- package/dist/esm/ethiopic/lib/endOfYear.d.ts +7 -0
- package/dist/esm/ethiopic/lib/endOfYear.js +12 -0
- package/dist/esm/ethiopic/lib/format.d.ts +21 -0
- package/dist/esm/ethiopic/lib/format.js +114 -0
- package/dist/esm/ethiopic/lib/formatNumber.d.ts +19 -0
- package/dist/esm/ethiopic/lib/formatNumber.js +29 -0
- package/dist/esm/ethiopic/lib/getMonth.d.ts +7 -0
- package/dist/esm/ethiopic/lib/getMonth.js +11 -0
- package/dist/esm/ethiopic/lib/getWeek.d.ts +9 -0
- package/dist/esm/ethiopic/lib/getWeek.js +41 -0
- package/dist/esm/ethiopic/lib/getYear.d.ts +7 -0
- package/dist/esm/ethiopic/lib/getYear.js +11 -0
- package/dist/esm/ethiopic/lib/index.d.ts +21 -0
- package/dist/esm/ethiopic/lib/index.js +21 -0
- package/dist/esm/ethiopic/lib/isSameMonth.d.ts +8 -0
- package/dist/esm/ethiopic/lib/isSameMonth.js +13 -0
- package/dist/esm/ethiopic/lib/isSameYear.d.ts +8 -0
- package/dist/esm/ethiopic/lib/isSameYear.js +13 -0
- package/dist/esm/ethiopic/lib/newDate.d.ts +9 -0
- package/dist/esm/ethiopic/lib/newDate.js +22 -0
- package/dist/esm/ethiopic/lib/setMonth.d.ts +8 -0
- package/dist/esm/ethiopic/lib/setMonth.js +12 -0
- package/dist/esm/ethiopic/lib/setYear.d.ts +8 -0
- package/dist/esm/ethiopic/lib/setYear.js +16 -0
- package/dist/esm/ethiopic/lib/startOfDay.d.ts +7 -0
- package/dist/esm/ethiopic/lib/startOfDay.js +11 -0
- package/dist/esm/ethiopic/lib/startOfMonth.d.ts +7 -0
- package/dist/esm/ethiopic/lib/startOfMonth.js +11 -0
- package/dist/esm/ethiopic/lib/startOfWeek.d.ts +9 -0
- package/dist/esm/ethiopic/lib/startOfWeek.js +12 -0
- package/dist/esm/ethiopic/lib/startOfYear.d.ts +7 -0
- package/dist/esm/ethiopic/lib/startOfYear.js +11 -0
- package/dist/esm/ethiopic/locale/am-ET.d.ts +4 -0
- package/dist/esm/ethiopic/locale/am-ET.js +96 -0
- package/dist/esm/ethiopic/utils/EthiopicDate.d.ts +17 -0
- package/dist/esm/ethiopic/utils/EthiopicDate.js +1 -0
- package/dist/esm/ethiopic/utils/daysInMonth.d.ts +13 -0
- package/dist/esm/ethiopic/utils/daysInMonth.js +19 -0
- package/dist/esm/ethiopic/utils/index.d.ts +6 -0
- package/dist/esm/ethiopic/utils/index.js +6 -0
- package/dist/esm/ethiopic/utils/isEthiopicDateValid.d.ts +2 -0
- package/dist/esm/ethiopic/utils/isEthiopicDateValid.js +12 -0
- package/dist/esm/ethiopic/utils/isEthiopicLeapYear.d.ts +7 -0
- package/dist/esm/ethiopic/utils/isEthiopicLeapYear.js +9 -0
- package/dist/esm/ethiopic/utils/toEthiopicDate.d.ts +17 -0
- package/dist/esm/ethiopic/utils/toEthiopicDate.js +50 -0
- package/dist/esm/ethiopic/utils/toGeezNumerals.d.ts +8 -0
- package/dist/esm/ethiopic/utils/toGeezNumerals.js +48 -0
- package/dist/esm/ethiopic/utils/toGregorianDate.d.ts +9 -0
- package/dist/esm/ethiopic/utils/toGregorianDate.js +55 -0
- package/dist/esm/types/shared.d.ts +1 -1
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ See **[daypicker.dev](https://daypicker.dev)** for guides, examples and API refe
|
|
|
18
18
|
- 🎨 Minimal design that can be [easily styled](https://daypicker.dev/docs/styling) with CSS or any CSS framework.
|
|
19
19
|
- 📅 Supports [selections](https://daypicker.dev/docs/selection-modes) of single days, multiple days, ranges of days, or [custom selections](https://daypicker.dev/guides/custom-selections).
|
|
20
20
|
- 🌍 Can be [localized](https://daypicker.dev/docs/localization) into any language and [time zones](https://daypicker.dev/docs/time-zone).
|
|
21
|
-
- 🌐 Support for [ISO 8601](https://daypicker.dev/docs/localization#iso-week-dates), [Persian](https://daypicker.dev/docs/localization#persian-calendar), and [broadcast](https://daypicker.dev/docs/localization#broadcast-calendar) calendar.
|
|
21
|
+
- 🌐 Support for [ISO 8601](https://daypicker.dev/docs/localization#iso-week-dates), [Persian](https://daypicker.dev/docs/localization#persian-calendar), [Ethiopic](https://daypicker.dev/docs/localization#ethiopic-calendar) and [broadcast](https://daypicker.dev/docs/localization#broadcast-calendar) calendar.
|
|
22
22
|
- 🦮 Complies with WCAG 2.1 AA requirements for [accessibility](https://daypicker.dev/guides/accessibility).
|
|
23
23
|
- ⚙️ [Customizable components](https://daypicker.dev/guides/custom-components) to extend the rendered elements.
|
|
24
24
|
- 🔤 Easy integration [with input fields](https://daypicker.dev/guides/input-fields).
|
|
@@ -70,8 +70,27 @@ Ask for help and share your experience with DayPicker:
|
|
|
70
70
|
- 💬 [Discussion forums](https://github.com/gpbl/react-day-picker/discussions) - Get support and provide feedback.
|
|
71
71
|
- 🪳 [Report an issue](https://github.com/gpbl/react-day-picker/issues/new/choose) - Report bugs or request features.
|
|
72
72
|
|
|
73
|
-
##
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
## Sponsors
|
|
74
|
+
|
|
75
|
+
Thank you to everyone supporting DayPicker - your sponsorship keeps this project maintained and evolving.
|
|
76
|
+
|
|
77
|
+
<p>
|
|
78
|
+
<a href="https://github.com/CHECK24" title="CHECK24"><img src="https://github.com/CHECK24.png?size=64" alt="CHECK24" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
79
|
+
<a href="https://github.com/oluwatunmiisheii" title="oluwatunmiisheii"><img src="https://github.com/oluwatunmiisheii.png?size=64" alt="oluwatunmiisheii" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
80
|
+
<a href="https://github.com/severinlandolt" title="severinlandolt"><img src="https://github.com/severinlandolt.png?size=64" alt="severinlandolt" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
81
|
+
<a href="https://github.com/syntaxfm" title="syntaxfm"><img src="https://github.com/syntaxfm.png?size=64" alt="syntaxfm" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
82
|
+
<a href="https://github.com/thnxdev" title="thnxdev"><img src="https://github.com/thnxdev.png?size=64" alt="thnxdev" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
83
|
+
<a href="https://github.com/katyabilokur" title="katyabilokur"><img src="https://github.com/katyabilokur.png?size=64" alt="katyabilokur" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
84
|
+
<a href="https://github.com/bedandbreakfasteu" title="bedandbreakfasteu"><img src="https://github.com/bedandbreakfasteu.png?size=64" alt="bedandbreakfasteu" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
85
|
+
<a href="https://github.com/codecov" title="codecov"><img src="https://github.com/codecov.png?size=64" alt="codecov" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
86
|
+
<a href="https://github.com/manavm1990" title="manavm1990"><img src="https://github.com/manavm1990.png?size=64" alt="manavm1990" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
87
|
+
<a href="https://github.com/Thinkmill" title="Thinkmill"><img src="https://github.com/Thinkmill.png?size=64" alt="Thinkmill" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
88
|
+
<a href="https://github.com/AlexKDawson" title="AlexKDawson"><img src="https://github.com/AlexKDawson.png?size=64" alt="AlexKDawson" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
89
|
+
<a href="https://github.com/dimitur2204" title="dimitur2204"><img src="https://github.com/dimitur2204.png?size=64" alt="dimitur2204" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
90
|
+
<a href="https://github.com/indeedeng" title="indeedeng"><img src="https://github.com/indeedeng.png?size=64" alt="indeedeng" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
91
|
+
<a href="https://github.com/flexbox" title="flexbox"><img src="https://github.com/flexbox.png?size=64" alt="flexbox" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
92
|
+
<a href="https://github.com/github" title="github"><img src="https://github.com/github.png?size=64" alt="github" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
93
|
+
<a href="https://github.com/tjfred35" title="tjfred35"><img src="https://github.com/tjfred35.png?size=64" alt="tjfred35" width="48" height="48" style="border-radius:50%; margin: 4px;" /></a>
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
- 🎗️ Become a sponsor: https://github.com/sponsors/gpbl
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Locale } from "date-fns";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DateLib, type DateLibOptions } from "../index.js";
|
|
4
|
+
import type { DayPickerProps } from "../types/props.js";
|
|
5
|
+
export { enUS } from "date-fns/locale/en-US";
|
|
6
|
+
/**
|
|
7
|
+
* Render the Ethiopic calendar.
|
|
8
|
+
*
|
|
9
|
+
* Defaults:
|
|
10
|
+
* - `locale`: `am-ET` (Amharic) via an Intl-backed date-fns locale
|
|
11
|
+
* - `numerals`: `geez` (Ethiopic digits)
|
|
12
|
+
*
|
|
13
|
+
* Notes:
|
|
14
|
+
* - Weekday names are taken from `Intl.DateTimeFormat(locale.code)`.
|
|
15
|
+
* - Month names are Amharic by default; they switch to Latin transliteration
|
|
16
|
+
* when `locale.code` starts with `en` or when `numerals` is `latn`.
|
|
17
|
+
* - Time tokens like `hh:mm a` are formatted via `Intl.DateTimeFormat` using
|
|
18
|
+
* the provided `locale`.
|
|
19
|
+
*
|
|
20
|
+
* @see https://daypicker.dev/docs/localization#ethiopic-calendar
|
|
21
|
+
*/
|
|
22
|
+
export declare function DayPicker(props: DayPickerProps & {
|
|
23
|
+
/**
|
|
24
|
+
* The locale to use in the calendar.
|
|
25
|
+
*
|
|
26
|
+
* @default `am-ET`
|
|
27
|
+
*/
|
|
28
|
+
locale?: Locale;
|
|
29
|
+
/**
|
|
30
|
+
* The numeral system to use when formatting dates.
|
|
31
|
+
*
|
|
32
|
+
* - `latn`: Latin (Western Arabic)
|
|
33
|
+
* - `geez`: Ge'ez (Ethiopic numerals)
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue `geez` (Ethiopic numerals)
|
|
36
|
+
* @see https://daypicker.dev/docs/translation#numeral-systems
|
|
37
|
+
*/
|
|
38
|
+
numerals?: DayPickerProps["numerals"];
|
|
39
|
+
}): React.JSX.Element;
|
|
40
|
+
/** Returns the date library used in the calendar. */
|
|
41
|
+
export declare const getDateLib: (options?: DateLibOptions) => DateLib;
|
|
42
|
+
export { amET } from "./locale/am-ET.js";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.amET = exports.getDateLib = exports.enUS = void 0;
|
|
40
|
+
exports.DayPicker = DayPicker;
|
|
41
|
+
const react_1 = __importDefault(require("react"));
|
|
42
|
+
const index_js_1 = require("../index.js");
|
|
43
|
+
const ethiopicDateLib = __importStar(require("./lib/index.js"));
|
|
44
|
+
const am_ET_js_1 = __importDefault(require("./locale/am-ET.js"));
|
|
45
|
+
var en_US_1 = require("date-fns/locale/en-US");
|
|
46
|
+
Object.defineProperty(exports, "enUS", { enumerable: true, get: function () { return en_US_1.enUS; } });
|
|
47
|
+
/**
|
|
48
|
+
* Render the Ethiopic calendar.
|
|
49
|
+
*
|
|
50
|
+
* Defaults:
|
|
51
|
+
* - `locale`: `am-ET` (Amharic) via an Intl-backed date-fns locale
|
|
52
|
+
* - `numerals`: `geez` (Ethiopic digits)
|
|
53
|
+
*
|
|
54
|
+
* Notes:
|
|
55
|
+
* - Weekday names are taken from `Intl.DateTimeFormat(locale.code)`.
|
|
56
|
+
* - Month names are Amharic by default; they switch to Latin transliteration
|
|
57
|
+
* when `locale.code` starts with `en` or when `numerals` is `latn`.
|
|
58
|
+
* - Time tokens like `hh:mm a` are formatted via `Intl.DateTimeFormat` using
|
|
59
|
+
* the provided `locale`.
|
|
60
|
+
*
|
|
61
|
+
* @see https://daypicker.dev/docs/localization#ethiopic-calendar
|
|
62
|
+
*/
|
|
63
|
+
function DayPicker(props) {
|
|
64
|
+
return (react_1.default.createElement(index_js_1.DayPicker, { ...props, locale: props.locale ?? am_ET_js_1.default, numerals: props.numerals ?? "geez",
|
|
65
|
+
// Pass overrides, not a DateLib instance
|
|
66
|
+
dateLib: ethiopicDateLib }));
|
|
67
|
+
}
|
|
68
|
+
/** Returns the date library used in the calendar. */
|
|
69
|
+
const getDateLib = (options) => {
|
|
70
|
+
return new index_js_1.DateLib(options, ethiopicDateLib);
|
|
71
|
+
};
|
|
72
|
+
exports.getDateLib = getDateLib;
|
|
73
|
+
// Export a minimal Amharic (Ethiopia) date-fns locale that uses Intl
|
|
74
|
+
var am_ET_js_2 = require("./locale/am-ET.js");
|
|
75
|
+
Object.defineProperty(exports, "amET", { enumerable: true, get: function () { return am_ET_js_2.amET; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the specified number of months to the given Ethiopian date. Handles
|
|
3
|
+
* month overflow and year boundaries correctly.
|
|
4
|
+
*
|
|
5
|
+
* @param date - The starting gregorian date
|
|
6
|
+
* @param amount - The number of months to add (can be negative)
|
|
7
|
+
* @returns A new gregorian date with the months added
|
|
8
|
+
*/
|
|
9
|
+
export declare function addMonths(date: Date, amount: number): Date;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addMonths = addMonths;
|
|
4
|
+
const daysInMonth_js_1 = require("../utils/daysInMonth.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* Adds the specified number of months to the given Ethiopian date. Handles
|
|
8
|
+
* month overflow and year boundaries correctly.
|
|
9
|
+
*
|
|
10
|
+
* @param date - The starting gregorian date
|
|
11
|
+
* @param amount - The number of months to add (can be negative)
|
|
12
|
+
* @returns A new gregorian date with the months added
|
|
13
|
+
*/
|
|
14
|
+
function addMonths(date, amount) {
|
|
15
|
+
const { year, month, day } = (0, index_js_1.toEthiopicDate)(date);
|
|
16
|
+
let newMonth = month + amount;
|
|
17
|
+
const yearAdjustment = Math.floor((newMonth - 1) / 13);
|
|
18
|
+
newMonth = ((newMonth - 1) % 13) + 1;
|
|
19
|
+
if (newMonth < 1) {
|
|
20
|
+
newMonth += 13;
|
|
21
|
+
}
|
|
22
|
+
const newYear = year + yearAdjustment;
|
|
23
|
+
// Adjust day if it exceeds the month length
|
|
24
|
+
const monthLength = (0, daysInMonth_js_1.daysInMonth)(newMonth, newYear);
|
|
25
|
+
const newDay = Math.min(day, monthLength);
|
|
26
|
+
return (0, index_js_1.toGregorianDate)({ year: newYear, month: newMonth, day: newDay });
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the specified number of years to the given Ethiopian date. Handles leap
|
|
3
|
+
* year transitions for Pagume month.
|
|
4
|
+
*
|
|
5
|
+
* @param date - The starting gregorian date
|
|
6
|
+
* @param amount - The number of years to add (can be negative)
|
|
7
|
+
* @returns A new gregorian date with the years added
|
|
8
|
+
*/
|
|
9
|
+
export declare function addYears(date: Date, amount: number): Date;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addYears = addYears;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Adds the specified number of years to the given Ethiopian date. Handles leap
|
|
7
|
+
* year transitions for Pagume month.
|
|
8
|
+
*
|
|
9
|
+
* @param date - The starting gregorian date
|
|
10
|
+
* @param amount - The number of years to add (can be negative)
|
|
11
|
+
* @returns A new gregorian date with the years added
|
|
12
|
+
*/
|
|
13
|
+
function addYears(date, amount) {
|
|
14
|
+
const etDate = (0, index_js_1.toEthiopicDate)(date);
|
|
15
|
+
const day = (0, index_js_1.isEthiopicLeapYear)(etDate.year) &&
|
|
16
|
+
etDate.month === 13 &&
|
|
17
|
+
etDate.day === 6 &&
|
|
18
|
+
amount % 4 !== 0
|
|
19
|
+
? 5
|
|
20
|
+
: etDate.day;
|
|
21
|
+
return (0, index_js_1.toGregorianDate)({
|
|
22
|
+
month: etDate.month,
|
|
23
|
+
day: day,
|
|
24
|
+
year: etDate.year + amount,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Difference in calendar months
|
|
3
|
+
*
|
|
4
|
+
* @param {Date} dateLeft - The later date
|
|
5
|
+
* @param {Date} dateRight - The earlier date
|
|
6
|
+
* @returns {number} The number of calendar months between the two dates
|
|
7
|
+
*/
|
|
8
|
+
export declare function differenceInCalendarMonths(dateLeft: Date, dateRight: Date): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.differenceInCalendarMonths = differenceInCalendarMonths;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Difference in calendar months
|
|
7
|
+
*
|
|
8
|
+
* @param {Date} dateLeft - The later date
|
|
9
|
+
* @param {Date} dateRight - The earlier date
|
|
10
|
+
* @returns {number} The number of calendar months between the two dates
|
|
11
|
+
*/
|
|
12
|
+
function differenceInCalendarMonths(dateLeft, dateRight) {
|
|
13
|
+
const ethiopicLeft = (0, index_js_1.toEthiopicDate)(dateLeft);
|
|
14
|
+
const ethiopicRight = (0, index_js_1.toEthiopicDate)(dateRight);
|
|
15
|
+
return ((ethiopicLeft.year - ethiopicRight.year) * 13 +
|
|
16
|
+
(ethiopicLeft.month - ethiopicRight.month));
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Interval } from "date-fns";
|
|
2
|
+
/**
|
|
3
|
+
* Each month of an interval
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} interval - The interval object
|
|
6
|
+
* @param {Date} interval.start - The start date of the interval
|
|
7
|
+
* @param {Date} interval.end - The end date of the interval
|
|
8
|
+
* @returns {Date[]} An array of dates representing the start of each month in
|
|
9
|
+
* the interval
|
|
10
|
+
*/
|
|
11
|
+
export declare function eachMonthOfInterval(interval: Interval): Date[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eachMonthOfInterval = eachMonthOfInterval;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Each month of an interval
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} interval - The interval object
|
|
9
|
+
* @param {Date} interval.start - The start date of the interval
|
|
10
|
+
* @param {Date} interval.end - The end date of the interval
|
|
11
|
+
* @returns {Date[]} An array of dates representing the start of each month in
|
|
12
|
+
* the interval
|
|
13
|
+
*/
|
|
14
|
+
function eachMonthOfInterval(interval) {
|
|
15
|
+
const start = (0, index_js_1.toEthiopicDate)(new Date(interval.start));
|
|
16
|
+
const end = (0, index_js_1.toEthiopicDate)(new Date(interval.end));
|
|
17
|
+
const dates = [];
|
|
18
|
+
let currentYear = start.year;
|
|
19
|
+
let currentMonth = start.month;
|
|
20
|
+
while (currentYear < end.year ||
|
|
21
|
+
(currentYear === end.year && currentMonth <= end.month)) {
|
|
22
|
+
dates.push((0, index_js_1.toGregorianDate)({ year: currentYear, month: currentMonth, day: 1 }));
|
|
23
|
+
currentMonth++;
|
|
24
|
+
if (currentMonth > 13) {
|
|
25
|
+
currentMonth = 1;
|
|
26
|
+
currentYear++;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return dates;
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the last day of the Ethiopian month for the given date.
|
|
3
|
+
*
|
|
4
|
+
* @param date - The gregorian date to get the end of month for
|
|
5
|
+
* @returns A new gregorian date representing the last day of the Ethiopian
|
|
6
|
+
* month
|
|
7
|
+
*/
|
|
8
|
+
export declare function endOfMonth(date: Date): Date;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.endOfMonth = endOfMonth;
|
|
4
|
+
const daysInMonth_js_1 = require("../utils/daysInMonth.js");
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the last day of the Ethiopian month for the given date.
|
|
8
|
+
*
|
|
9
|
+
* @param date - The gregorian date to get the end of month for
|
|
10
|
+
* @returns A new gregorian date representing the last day of the Ethiopian
|
|
11
|
+
* month
|
|
12
|
+
*/
|
|
13
|
+
function endOfMonth(date) {
|
|
14
|
+
const { year, month } = (0, index_js_1.toEthiopicDate)(date);
|
|
15
|
+
const day = (0, daysInMonth_js_1.daysInMonth)(month, year);
|
|
16
|
+
return (0, index_js_1.toGregorianDate)({ year, month, day: day });
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EndOfWeekOptions } from "date-fns";
|
|
2
|
+
/**
|
|
3
|
+
* End of week
|
|
4
|
+
*
|
|
5
|
+
* @param {Date} date - The original date
|
|
6
|
+
* @param {EndOfWeekOptions} [options] - The options object
|
|
7
|
+
* @returns {Date} The end of the week
|
|
8
|
+
*/
|
|
9
|
+
export declare function endOfWeek(date: Date, options?: EndOfWeekOptions): Date;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.endOfWeek = endOfWeek;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
/**
|
|
6
|
+
* End of week
|
|
7
|
+
*
|
|
8
|
+
* @param {Date} date - The original date
|
|
9
|
+
* @param {EndOfWeekOptions} [options] - The options object
|
|
10
|
+
* @returns {Date} The end of the week
|
|
11
|
+
*/
|
|
12
|
+
function endOfWeek(date, options) {
|
|
13
|
+
const weekStartsOn = options?.weekStartsOn ?? 0; // Default to Monday (1)
|
|
14
|
+
const endOfWeek = (0, date_fns_1.endOfWeek)(date, { weekStartsOn });
|
|
15
|
+
return endOfWeek;
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.endOfYear = endOfYear;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* End of year
|
|
7
|
+
*
|
|
8
|
+
* @param {Date} date - The original date
|
|
9
|
+
* @returns {Date} The end of the year
|
|
10
|
+
*/
|
|
11
|
+
function endOfYear(date) {
|
|
12
|
+
const { year } = (0, index_js_1.toEthiopicDate)(date);
|
|
13
|
+
const day = (0, index_js_1.isEthiopicLeapYear)(year) ? 6 : 5;
|
|
14
|
+
return (0, index_js_1.toGregorianDate)({ year, month: 13, day });
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FormatOptions as DateFnsFormatOptions } from "date-fns";
|
|
2
|
+
/** Options for formatting dates in the Ethiopian calendar */
|
|
3
|
+
export type FormatOptions = DateFnsFormatOptions;
|
|
4
|
+
/**
|
|
5
|
+
* Format an Ethiopic calendar date using a subset of date-fns tokens.
|
|
6
|
+
*
|
|
7
|
+
* Behavior specifics for Ethiopic mode:
|
|
8
|
+
* - Weekday names ("cccc", "cccccc") come from `Intl.DateTimeFormat` using
|
|
9
|
+
* `options.locale?.code` (default: `am-ET`). Narrow form is a single letter.
|
|
10
|
+
* - Month names ("LLLL") are Amharic by default and switch to Latin
|
|
11
|
+
* transliteration when the locale code starts with `en` or when
|
|
12
|
+
* `options.numerals === 'latn'`.
|
|
13
|
+
* - Time parts such as `hh:mm a` are delegated to `Intl.DateTimeFormat` with
|
|
14
|
+
* the given locale.
|
|
15
|
+
* - Digits are converted to Ethiopic (Geez) when `options.numerals === 'geez'`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function format(date: Date, formatStr: string, options?: DateFnsFormatOptions): string;
|
|
18
|
+
export declare const ethMonths: string[];
|
|
19
|
+
export declare const ethMonthsLatin: string[];
|
|
20
|
+
export declare const shortDays: string[];
|
|
21
|
+
export declare const longDays: string[];
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.longDays = exports.shortDays = exports.ethMonthsLatin = exports.ethMonths = void 0;
|
|
4
|
+
exports.format = format;
|
|
5
|
+
const index_js_1 = require("../utils/index.js");
|
|
6
|
+
const formatNumber_js_1 = require("./formatNumber.js");
|
|
7
|
+
function getEtDayName(day, short = true, localeCode = "am-ET") {
|
|
8
|
+
try {
|
|
9
|
+
const dtf = new Intl.DateTimeFormat(localeCode, {
|
|
10
|
+
// Ethiopic calendar expects single-letter for "cccccc" -> use narrow
|
|
11
|
+
weekday: short ? "narrow" : "long",
|
|
12
|
+
});
|
|
13
|
+
return dtf.format(day);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
const dayOfWeek = day.getDay();
|
|
17
|
+
return short ? exports.shortDays[dayOfWeek] : exports.longDays[dayOfWeek];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getEtMonthName(m, latin = false) {
|
|
21
|
+
if (m > 0 && m <= 13) {
|
|
22
|
+
return latin ? exports.ethMonthsLatin[m - 1] : exports.ethMonths[m - 1];
|
|
23
|
+
}
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
function formatEthiopianDate(dateObj, formatStr, numerals, localeCode) {
|
|
27
|
+
const etDate = dateObj ? (0, index_js_1.toEthiopicDate)(dateObj) : undefined;
|
|
28
|
+
if (!etDate)
|
|
29
|
+
return "";
|
|
30
|
+
const useLatin = (localeCode?.startsWith("en") ?? false) || numerals === "latn";
|
|
31
|
+
switch (formatStr) {
|
|
32
|
+
case "LLLL yyyy":
|
|
33
|
+
case "LLLL y":
|
|
34
|
+
return `${getEtMonthName(etDate.month, useLatin)} ${etDate.year}`;
|
|
35
|
+
case "LLLL":
|
|
36
|
+
return getEtMonthName(etDate.month, useLatin);
|
|
37
|
+
case "yyyy-MM-dd":
|
|
38
|
+
return `${etDate.year}-${etDate.month
|
|
39
|
+
.toString()
|
|
40
|
+
.padStart(2, "0")}-${etDate.day.toString().padStart(2, "0")}`;
|
|
41
|
+
case "yyyy-MM":
|
|
42
|
+
return `${etDate.year}-${etDate.month.toString().padStart(2, "0")}`;
|
|
43
|
+
case "d":
|
|
44
|
+
return etDate.day.toString();
|
|
45
|
+
case "PPP":
|
|
46
|
+
return ` ${getEtMonthName(etDate.month, useLatin)} ${etDate.day}, ${etDate.year}`;
|
|
47
|
+
case "PPPP":
|
|
48
|
+
if (!dateObj)
|
|
49
|
+
return "";
|
|
50
|
+
return `${getEtDayName(dateObj, false, localeCode)}, ${getEtMonthName(etDate.month, useLatin)} ${etDate.day}, ${etDate.year}`;
|
|
51
|
+
case "cccc":
|
|
52
|
+
return dateObj ? getEtDayName(dateObj, false, localeCode) : "";
|
|
53
|
+
case "cccccc":
|
|
54
|
+
return dateObj ? getEtDayName(dateObj, true, localeCode) : "";
|
|
55
|
+
default:
|
|
56
|
+
return `${etDate.day}/${etDate.month}/${etDate.year}`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Format an Ethiopic calendar date using a subset of date-fns tokens.
|
|
61
|
+
*
|
|
62
|
+
* Behavior specifics for Ethiopic mode:
|
|
63
|
+
* - Weekday names ("cccc", "cccccc") come from `Intl.DateTimeFormat` using
|
|
64
|
+
* `options.locale?.code` (default: `am-ET`). Narrow form is a single letter.
|
|
65
|
+
* - Month names ("LLLL") are Amharic by default and switch to Latin
|
|
66
|
+
* transliteration when the locale code starts with `en` or when
|
|
67
|
+
* `options.numerals === 'latn'`.
|
|
68
|
+
* - Time parts such as `hh:mm a` are delegated to `Intl.DateTimeFormat` with
|
|
69
|
+
* the given locale.
|
|
70
|
+
* - Digits are converted to Ethiopic (Geez) when `options.numerals === 'geez'`.
|
|
71
|
+
*/
|
|
72
|
+
function format(date, formatStr, options) {
|
|
73
|
+
const extendedOptions = options;
|
|
74
|
+
if (formatStr.includes("hh:mm") || formatStr.includes("a")) {
|
|
75
|
+
return new Intl.DateTimeFormat(extendedOptions?.locale?.code ?? "en-US", {
|
|
76
|
+
hour: "numeric",
|
|
77
|
+
minute: "numeric",
|
|
78
|
+
hour12: formatStr.includes("a"),
|
|
79
|
+
}).format(date);
|
|
80
|
+
}
|
|
81
|
+
const formatted = formatEthiopianDate(date, formatStr, extendedOptions?.numerals, extendedOptions?.locale?.code ?? "am-ET");
|
|
82
|
+
if (extendedOptions?.numerals && extendedOptions.numerals === "geez") {
|
|
83
|
+
return formatted.replace(/\d+/g, (match) => (0, formatNumber_js_1.formatNumber)(parseInt(match), "geez"));
|
|
84
|
+
}
|
|
85
|
+
return formatted;
|
|
86
|
+
}
|
|
87
|
+
exports.ethMonths = [
|
|
88
|
+
"መስከረም",
|
|
89
|
+
"ጥቅምት",
|
|
90
|
+
"ህዳር",
|
|
91
|
+
"ታህሳስ",
|
|
92
|
+
"ጥር",
|
|
93
|
+
"የካቲት",
|
|
94
|
+
"መጋቢት",
|
|
95
|
+
"ሚያዚያ",
|
|
96
|
+
"ግንቦት",
|
|
97
|
+
"ሰኔ",
|
|
98
|
+
"ሐምሌ",
|
|
99
|
+
"ነሀሴ",
|
|
100
|
+
"ጳጉሜ",
|
|
101
|
+
];
|
|
102
|
+
exports.ethMonthsLatin = [
|
|
103
|
+
"Meskerem",
|
|
104
|
+
"Tikimt",
|
|
105
|
+
"Hidar",
|
|
106
|
+
"Tahsas",
|
|
107
|
+
"Tir",
|
|
108
|
+
"Yekatit",
|
|
109
|
+
"Megabit",
|
|
110
|
+
"Miyazya",
|
|
111
|
+
"Ginbot",
|
|
112
|
+
"Sene",
|
|
113
|
+
"Hamle",
|
|
114
|
+
"Nehase",
|
|
115
|
+
"Pagumen",
|
|
116
|
+
];
|
|
117
|
+
exports.shortDays = ["እ", "ሰ", "ማ", "ረ", "ሐ", "ዓ", "ቅ"];
|
|
118
|
+
exports.longDays = ["እሁድ", "ሰኞ", "ማክሰኞ", "ረቡዕ", "ሐሙስ", "ዓርብ", "ቅዳሜ"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a number using either Latin or Ethiopic (Geez) numerals
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* formatNumber(123) // '123'
|
|
7
|
+
* formatNumber(123, 'geez') // '፻፳፫'
|
|
8
|
+
* formatNumber(2023, 'geez') // '፳፻፳፫'
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param value - The number to format
|
|
12
|
+
* @param numerals - The numeral system to use:
|
|
13
|
+
*
|
|
14
|
+
* - 'latn': Latin numerals (1, 2, 3...)
|
|
15
|
+
* - 'geez': Ethiopic numerals (፩, ፪, ፫...)
|
|
16
|
+
*
|
|
17
|
+
* @returns The formatted number string
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatNumber(value: number, numerals?: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatNumber = formatNumber;
|
|
4
|
+
const toGeezNumerals_js_1 = require("../utils/toGeezNumerals.js");
|
|
5
|
+
/**
|
|
6
|
+
* Formats a number using either Latin or Ethiopic (Geez) numerals
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* formatNumber(123) // '123'
|
|
11
|
+
* formatNumber(123, 'geez') // '፻፳፫'
|
|
12
|
+
* formatNumber(2023, 'geez') // '፳፻፳፫'
|
|
13
|
+
* ```;
|
|
14
|
+
*
|
|
15
|
+
* @param value - The number to format
|
|
16
|
+
* @param numerals - The numeral system to use:
|
|
17
|
+
*
|
|
18
|
+
* - 'latn': Latin numerals (1, 2, 3...)
|
|
19
|
+
* - 'geez': Ethiopic numerals (፩, ፪, ፫...)
|
|
20
|
+
*
|
|
21
|
+
* @returns The formatted number string
|
|
22
|
+
*/
|
|
23
|
+
function formatNumber(value, numerals = "latn") {
|
|
24
|
+
if (numerals === "geez") {
|
|
25
|
+
return (0, toGeezNumerals_js_1.toGeezNumerals)(value);
|
|
26
|
+
}
|
|
27
|
+
// Use Intl.NumberFormat for other numeral systems
|
|
28
|
+
const formatter = new Intl.NumberFormat("en-US", {
|
|
29
|
+
numberingSystem: numerals,
|
|
30
|
+
});
|
|
31
|
+
return formatter.format(value);
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMonth = getMonth;
|
|
4
|
+
const index_js_1 = require("../utils/index.js");
|
|
5
|
+
/**
|
|
6
|
+
* Get month
|
|
7
|
+
*
|
|
8
|
+
* @param {Date} date - The original date
|
|
9
|
+
* @returns {number} The zero-based month index
|
|
10
|
+
*/
|
|
11
|
+
function getMonth(date) {
|
|
12
|
+
const { month } = (0, index_js_1.toEthiopicDate)(date);
|
|
13
|
+
return month - 1; // Return zero-based month index
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type GetWeekOptions } from "date-fns";
|
|
2
|
+
/**
|
|
3
|
+
* Get week number for Ethiopian calendar
|
|
4
|
+
*
|
|
5
|
+
* @param {Date} date - The original date
|
|
6
|
+
* @param {GetWeekOptions} [options] - The options object
|
|
7
|
+
* @returns {number} The week number
|
|
8
|
+
*/
|
|
9
|
+
export declare function getWeek(date: Date, options?: GetWeekOptions): number;
|