@internationalized/date 3.12.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +113 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +45 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{CalendarDate.main.js → private/CalendarDate.cjs} +102 -120
- package/dist/private/CalendarDate.cjs.map +1 -0
- package/dist/{CalendarDate.mjs → private/CalendarDate.js} +65 -65
- package/dist/private/CalendarDate.js.map +1 -0
- package/dist/{CalendarDate.module.js → private/CalendarDate.mjs} +99 -117
- package/dist/private/CalendarDate.mjs.map +1 -0
- package/dist/{DateFormatter.main.js → private/DateFormatter.cjs} +27 -27
- package/dist/private/DateFormatter.cjs.map +1 -0
- package/dist/{DateFormatter.module.js → private/DateFormatter.js} +23 -23
- package/dist/{DateFormatter.module.js.map → private/DateFormatter.js.map} +1 -1
- package/dist/{DateFormatter.mjs → private/DateFormatter.mjs} +27 -27
- package/dist/private/DateFormatter.mjs.map +1 -0
- package/dist/{BuddhistCalendar.main.js → private/calendars/BuddhistCalendar.cjs} +13 -13
- package/dist/{BuddhistCalendar.main.js.map → private/calendars/BuddhistCalendar.cjs.map} +1 -1
- package/dist/{BuddhistCalendar.module.js → private/calendars/BuddhistCalendar.js} +13 -13
- package/dist/{BuddhistCalendar.module.js.map → private/calendars/BuddhistCalendar.js.map} +1 -1
- package/dist/{BuddhistCalendar.mjs → private/calendars/BuddhistCalendar.mjs} +13 -13
- package/dist/private/calendars/BuddhistCalendar.mjs.map +1 -0
- package/dist/{EthiopicCalendar.main.js → private/calendars/EthiopicCalendar.cjs} +32 -32
- package/dist/{EthiopicCalendar.main.js.map → private/calendars/EthiopicCalendar.cjs.map} +1 -1
- package/dist/{EthiopicCalendar.module.js → private/calendars/EthiopicCalendar.js} +30 -30
- package/dist/{EthiopicCalendar.module.js.map → private/calendars/EthiopicCalendar.js.map} +1 -1
- package/dist/{EthiopicCalendar.mjs → private/calendars/EthiopicCalendar.mjs} +30 -30
- package/dist/private/calendars/EthiopicCalendar.mjs.map +1 -0
- package/dist/{GregorianCalendar.main.js → private/calendars/GregorianCalendar.cjs} +31 -31
- package/dist/{GregorianCalendar.main.js.map → private/calendars/GregorianCalendar.cjs.map} +1 -1
- package/dist/{GregorianCalendar.module.js → private/calendars/GregorianCalendar.js} +27 -27
- package/dist/{GregorianCalendar.module.js.map → private/calendars/GregorianCalendar.js.map} +1 -1
- package/dist/{GregorianCalendar.mjs → private/calendars/GregorianCalendar.mjs} +27 -27
- package/dist/private/calendars/GregorianCalendar.mjs.map +1 -0
- package/dist/{HebrewCalendar.main.js → private/calendars/HebrewCalendar.cjs} +44 -44
- package/dist/{HebrewCalendar.main.js.map → private/calendars/HebrewCalendar.cjs.map} +1 -1
- package/dist/{HebrewCalendar.module.js → private/calendars/HebrewCalendar.js} +44 -44
- package/dist/{HebrewCalendar.module.js.map → private/calendars/HebrewCalendar.js.map} +1 -1
- package/dist/{HebrewCalendar.mjs → private/calendars/HebrewCalendar.mjs} +44 -44
- package/dist/private/calendars/HebrewCalendar.mjs.map +1 -0
- package/dist/{IndianCalendar.main.js → private/calendars/IndianCalendar.cjs} +20 -20
- package/dist/{IndianCalendar.main.js.map → private/calendars/IndianCalendar.cjs.map} +1 -1
- package/dist/{IndianCalendar.module.js → private/calendars/IndianCalendar.js} +20 -20
- package/dist/{IndianCalendar.module.js.map → private/calendars/IndianCalendar.js.map} +1 -1
- package/dist/{IndianCalendar.mjs → private/calendars/IndianCalendar.mjs} +20 -20
- package/dist/private/calendars/IndianCalendar.mjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.cjs +168 -0
- package/dist/private/calendars/IslamicCalendar.cjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.js +161 -0
- package/dist/{IslamicCalendar.module.js.map → private/calendars/IslamicCalendar.js.map} +1 -1
- package/dist/private/calendars/IslamicCalendar.mjs +161 -0
- package/dist/private/calendars/IslamicCalendar.mjs.map +1 -0
- package/dist/{JapaneseCalendar.main.js → private/calendars/JapaneseCalendar.cjs} +37 -37
- package/dist/{JapaneseCalendar.main.js.map → private/calendars/JapaneseCalendar.cjs.map} +1 -1
- package/dist/{JapaneseCalendar.module.js → private/calendars/JapaneseCalendar.js} +37 -37
- package/dist/{JapaneseCalendar.module.js.map → private/calendars/JapaneseCalendar.js.map} +1 -1
- package/dist/{JapaneseCalendar.mjs → private/calendars/JapaneseCalendar.mjs} +37 -37
- package/dist/private/calendars/JapaneseCalendar.mjs.map +1 -0
- package/dist/{PersianCalendar.main.js → private/calendars/PersianCalendar.cjs} +13 -13
- package/dist/{PersianCalendar.main.js.map → private/calendars/PersianCalendar.cjs.map} +1 -1
- package/dist/{PersianCalendar.module.js → private/calendars/PersianCalendar.js} +13 -13
- package/dist/{PersianCalendar.module.js.map → private/calendars/PersianCalendar.js.map} +1 -1
- package/dist/{PersianCalendar.mjs → private/calendars/PersianCalendar.mjs} +13 -13
- package/dist/private/calendars/PersianCalendar.mjs.map +1 -0
- package/dist/{TaiwanCalendar.main.js → private/calendars/TaiwanCalendar.cjs} +20 -20
- package/dist/{TaiwanCalendar.main.js.map → private/calendars/TaiwanCalendar.cjs.map} +1 -1
- package/dist/private/calendars/TaiwanCalendar.js +75 -0
- package/dist/{TaiwanCalendar.module.js.map → private/calendars/TaiwanCalendar.js.map} +1 -1
- package/dist/{TaiwanCalendar.mjs → private/calendars/TaiwanCalendar.mjs} +20 -20
- package/dist/private/calendars/TaiwanCalendar.mjs.map +1 -0
- package/dist/{conversion.main.js → private/conversion.cjs} +85 -85
- package/dist/{conversion.main.js.map → private/conversion.cjs.map} +1 -1
- package/dist/{conversion.module.js → private/conversion.js} +71 -71
- package/dist/{conversion.module.js.map → private/conversion.js.map} +1 -1
- package/dist/{conversion.mjs → private/conversion.mjs} +71 -71
- package/dist/private/conversion.mjs.map +1 -0
- package/dist/private/createCalendar.cjs +69 -0
- package/dist/{createCalendar.main.js.map → private/createCalendar.cjs.map} +1 -1
- package/dist/private/createCalendar.js +64 -0
- package/dist/{createCalendar.module.js.map → private/createCalendar.js.map} +1 -1
- package/dist/private/createCalendar.mjs +64 -0
- package/dist/private/createCalendar.mjs.map +1 -0
- package/dist/{manipulation.main.js → private/manipulation.cjs} +106 -109
- package/dist/private/manipulation.cjs.map +1 -0
- package/dist/{manipulation.mjs → private/manipulation.js} +88 -88
- package/dist/{manipulation.module.js.map → private/manipulation.js.map} +1 -1
- package/dist/{manipulation.module.js → private/manipulation.mjs} +93 -96
- package/dist/private/manipulation.mjs.map +1 -0
- package/dist/private/queries.cjs +359 -0
- package/dist/private/queries.cjs.map +1 -0
- package/dist/private/queries.js +326 -0
- package/dist/private/queries.js.map +1 -0
- package/dist/private/queries.mjs +324 -0
- package/dist/private/queries.mjs.map +1 -0
- package/dist/private/string.cjs +181 -0
- package/dist/private/string.cjs.map +1 -0
- package/dist/{string.mjs → private/string.js} +64 -64
- package/dist/{string.module.js.map → private/string.js.map} +1 -1
- package/dist/private/string.mjs +166 -0
- package/dist/private/string.mjs.map +1 -0
- package/dist/{utils.main.js → private/utils.cjs} +3 -3
- package/dist/{utils.main.js.map → private/utils.cjs.map} +1 -1
- package/dist/{utils.module.js → private/utils.js} +3 -3
- package/dist/{utils.module.js.map → private/utils.js.map} +1 -1
- package/dist/{utils.mjs → private/utils.mjs} +3 -3
- package/dist/private/utils.mjs.map +1 -0
- package/dist/{weekStartData.main.js → private/weekStartData.cjs} +3 -3
- package/dist/{weekStartData.main.js.map → private/weekStartData.cjs.map} +1 -1
- package/dist/{weekStartData.module.js → private/weekStartData.js} +3 -3
- package/dist/{weekStartData.module.js.map → private/weekStartData.js.map} +1 -1
- package/dist/{weekStartData.mjs → private/weekStartData.mjs} +3 -3
- package/dist/private/weekStartData.mjs.map +1 -0
- package/dist/types/src/CalendarDate.d.ts +177 -0
- package/dist/types/src/DateFormatter.d.ts +21 -0
- package/dist/types/src/calendars/BuddhistCalendar.d.ts +16 -0
- package/dist/types/src/calendars/EthiopicCalendar.d.ts +45 -0
- package/dist/types/src/calendars/GregorianCalendar.d.ts +25 -0
- package/dist/types/src/calendars/HebrewCalendar.d.ts +21 -0
- package/dist/types/src/calendars/IndianCalendar.d.ts +17 -0
- package/dist/types/src/calendars/IslamicCalendar.d.ts +48 -0
- package/dist/types/src/calendars/JapaneseCalendar.d.ts +21 -0
- package/dist/types/src/calendars/PersianCalendar.d.ts +19 -0
- package/dist/types/src/calendars/TaiwanCalendar.d.ts +19 -0
- package/dist/types/src/conversion.d.ts +42 -0
- package/dist/types/src/createCalendar.d.ts +3 -0
- package/dist/types/src/index.d.ts +17 -0
- package/dist/types/src/manipulation.d.ts +25 -0
- package/dist/types/src/queries.d.ts +87 -0
- package/dist/types/src/string.d.ts +35 -0
- package/dist/types/src/types.d.ts +132 -0
- package/dist/types/src/utils.d.ts +4 -0
- package/dist/types/src/weekStartData.d.ts +97 -0
- package/package.json +26 -11
- package/src/CalendarDate.ts +2 -0
- package/src/index.ts +1 -0
- package/src/queries.ts +1 -3
- package/dist/CalendarDate.main.js.map +0 -1
- package/dist/CalendarDate.module.js.map +0 -1
- package/dist/DateFormatter.main.js.map +0 -1
- package/dist/IslamicCalendar.main.js +0 -168
- package/dist/IslamicCalendar.main.js.map +0 -1
- package/dist/IslamicCalendar.mjs +0 -161
- package/dist/IslamicCalendar.module.js +0 -161
- package/dist/TaiwanCalendar.module.js +0 -75
- package/dist/createCalendar.main.js +0 -69
- package/dist/createCalendar.mjs +0 -64
- package/dist/createCalendar.module.js +0 -64
- package/dist/import.mjs +0 -45
- package/dist/main.js +0 -113
- package/dist/main.js.map +0 -1
- package/dist/manipulation.main.js.map +0 -1
- package/dist/module.js +0 -45
- package/dist/module.js.map +0 -1
- package/dist/queries.main.js +0 -361
- package/dist/queries.main.js.map +0 -1
- package/dist/queries.mjs +0 -326
- package/dist/queries.module.js +0 -326
- package/dist/queries.module.js.map +0 -1
- package/dist/string.main.js +0 -190
- package/dist/string.main.js.map +0 -1
- package/dist/string.module.js +0 -175
- package/dist/types.d.ts +0 -672
- package/dist/types.d.ts.map +0 -1
package/dist/queries.main.js
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
var $4ae0260a69729f1d$exports = require("./conversion.main.js");
|
|
2
|
-
var $4d88eff242b38a9e$exports = require("./weekStartData.main.js");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
$parcel$export(module.exports, "isSameDay", () => $1f0f7ebf1ae6c530$export$ea39ec197993aef0);
|
|
10
|
-
$parcel$export(module.exports, "isSameMonth", () => $1f0f7ebf1ae6c530$export$a18c89cbd24170ff);
|
|
11
|
-
$parcel$export(module.exports, "startOfMonth", () => $1f0f7ebf1ae6c530$export$a5a3b454ada2268e);
|
|
12
|
-
$parcel$export(module.exports, "isSameYear", () => $1f0f7ebf1ae6c530$export$5841f9eb9773f25f);
|
|
13
|
-
$parcel$export(module.exports, "startOfYear", () => $1f0f7ebf1ae6c530$export$f91e89d3d0406102);
|
|
14
|
-
$parcel$export(module.exports, "isEqualDay", () => $1f0f7ebf1ae6c530$export$91b62ebf2ba703ee);
|
|
15
|
-
$parcel$export(module.exports, "isEqualCalendar", () => $1f0f7ebf1ae6c530$export$dbc69fd56b53d5e);
|
|
16
|
-
$parcel$export(module.exports, "isEqualMonth", () => $1f0f7ebf1ae6c530$export$5a8da0c44a3afdf2);
|
|
17
|
-
$parcel$export(module.exports, "isEqualYear", () => $1f0f7ebf1ae6c530$export$ea840f5a6dda8147);
|
|
18
|
-
$parcel$export(module.exports, "isToday", () => $1f0f7ebf1ae6c530$export$629b0a497aa65267);
|
|
19
|
-
$parcel$export(module.exports, "today", () => $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3);
|
|
20
|
-
$parcel$export(module.exports, "getDayOfWeek", () => $1f0f7ebf1ae6c530$export$2061056d06d7cdf7);
|
|
21
|
-
$parcel$export(module.exports, "now", () => $1f0f7ebf1ae6c530$export$461939dd4422153);
|
|
22
|
-
$parcel$export(module.exports, "compareDate", () => $1f0f7ebf1ae6c530$export$68781ddf31c0090f);
|
|
23
|
-
$parcel$export(module.exports, "compareTime", () => $1f0f7ebf1ae6c530$export$c19a80a9721b80f6);
|
|
24
|
-
$parcel$export(module.exports, "getHoursInDay", () => $1f0f7ebf1ae6c530$export$126c91c941de7e);
|
|
25
|
-
$parcel$export(module.exports, "getLocalTimeZone", () => $1f0f7ebf1ae6c530$export$aa8b41735afcabd2);
|
|
26
|
-
$parcel$export(module.exports, "setLocalTimeZone", () => $1f0f7ebf1ae6c530$export$61a9d83ceb59a3dd);
|
|
27
|
-
$parcel$export(module.exports, "resetLocalTimeZone", () => $1f0f7ebf1ae6c530$export$55753838ffe79333);
|
|
28
|
-
$parcel$export(module.exports, "isLocalTimeZoneOverridden", () => $1f0f7ebf1ae6c530$export$6ab69b273755230b);
|
|
29
|
-
$parcel$export(module.exports, "endOfMonth", () => $1f0f7ebf1ae6c530$export$a2258d9c4118825c);
|
|
30
|
-
$parcel$export(module.exports, "endOfYear", () => $1f0f7ebf1ae6c530$export$8b7aa55c66d5569e);
|
|
31
|
-
$parcel$export(module.exports, "getMinimumMonthInYear", () => $1f0f7ebf1ae6c530$export$5412ac11713b72ad);
|
|
32
|
-
$parcel$export(module.exports, "getMinimumDayInMonth", () => $1f0f7ebf1ae6c530$export$b2f4953d301981d5);
|
|
33
|
-
$parcel$export(module.exports, "startOfWeek", () => $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4);
|
|
34
|
-
$parcel$export(module.exports, "endOfWeek", () => $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e);
|
|
35
|
-
$parcel$export(module.exports, "getWeeksInMonth", () => $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654);
|
|
36
|
-
$parcel$export(module.exports, "minDate", () => $1f0f7ebf1ae6c530$export$5c333a116e949cdd);
|
|
37
|
-
$parcel$export(module.exports, "maxDate", () => $1f0f7ebf1ae6c530$export$a75f2bff57811055);
|
|
38
|
-
$parcel$export(module.exports, "isWeekend", () => $1f0f7ebf1ae6c530$export$618d60ea299da42);
|
|
39
|
-
$parcel$export(module.exports, "isWeekday", () => $1f0f7ebf1ae6c530$export$ee9d87258e1d19ed);
|
|
40
|
-
/*
|
|
41
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
42
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
43
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
44
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
45
|
-
*
|
|
46
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
47
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
48
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
49
|
-
* governing permissions and limitations under the License.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
function $1f0f7ebf1ae6c530$export$ea39ec197993aef0(a, b) {
|
|
53
|
-
b = (0, $4ae0260a69729f1d$exports.toCalendar)(b, a.calendar);
|
|
54
|
-
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
|
|
55
|
-
}
|
|
56
|
-
function $1f0f7ebf1ae6c530$export$a18c89cbd24170ff(a, b) {
|
|
57
|
-
b = (0, $4ae0260a69729f1d$exports.toCalendar)(b, a.calendar);
|
|
58
|
-
// In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.
|
|
59
|
-
a = $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(a);
|
|
60
|
-
b = $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(b);
|
|
61
|
-
return a.era === b.era && a.year === b.year && a.month === b.month;
|
|
62
|
-
}
|
|
63
|
-
function $1f0f7ebf1ae6c530$export$5841f9eb9773f25f(a, b) {
|
|
64
|
-
b = (0, $4ae0260a69729f1d$exports.toCalendar)(b, a.calendar);
|
|
65
|
-
a = $1f0f7ebf1ae6c530$export$f91e89d3d0406102(a);
|
|
66
|
-
b = $1f0f7ebf1ae6c530$export$f91e89d3d0406102(b);
|
|
67
|
-
return a.era === b.era && a.year === b.year;
|
|
68
|
-
}
|
|
69
|
-
function $1f0f7ebf1ae6c530$export$91b62ebf2ba703ee(a, b) {
|
|
70
|
-
return $1f0f7ebf1ae6c530$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $1f0f7ebf1ae6c530$export$ea39ec197993aef0(a, b);
|
|
71
|
-
}
|
|
72
|
-
function $1f0f7ebf1ae6c530$export$5a8da0c44a3afdf2(a, b) {
|
|
73
|
-
return $1f0f7ebf1ae6c530$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $1f0f7ebf1ae6c530$export$a18c89cbd24170ff(a, b);
|
|
74
|
-
}
|
|
75
|
-
function $1f0f7ebf1ae6c530$export$ea840f5a6dda8147(a, b) {
|
|
76
|
-
return $1f0f7ebf1ae6c530$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $1f0f7ebf1ae6c530$export$5841f9eb9773f25f(a, b);
|
|
77
|
-
}
|
|
78
|
-
function $1f0f7ebf1ae6c530$export$dbc69fd56b53d5e(a, b) {
|
|
79
|
-
var _a_isEqual, _b_isEqual;
|
|
80
|
-
var _a_isEqual1, _ref;
|
|
81
|
-
return (_ref = (_a_isEqual1 = (_a_isEqual = a.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a, b)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b, a)) !== null && _ref !== void 0 ? _ref : a.identifier === b.identifier;
|
|
82
|
-
}
|
|
83
|
-
function $1f0f7ebf1ae6c530$export$629b0a497aa65267(date, timeZone) {
|
|
84
|
-
return $1f0f7ebf1ae6c530$export$ea39ec197993aef0(date, $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3(timeZone));
|
|
85
|
-
}
|
|
86
|
-
const $1f0f7ebf1ae6c530$var$DAY_MAP = {
|
|
87
|
-
sun: 0,
|
|
88
|
-
mon: 1,
|
|
89
|
-
tue: 2,
|
|
90
|
-
wed: 3,
|
|
91
|
-
thu: 4,
|
|
92
|
-
fri: 5,
|
|
93
|
-
sat: 6
|
|
94
|
-
};
|
|
95
|
-
function $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
|
|
96
|
-
let julian = date.calendar.toJulianDay(date);
|
|
97
|
-
// If julian is negative, then julian % 7 will be negative, so we adjust
|
|
98
|
-
// accordingly. Julian day 0 is Monday.
|
|
99
|
-
let weekStart = firstDayOfWeek ? $1f0f7ebf1ae6c530$var$DAY_MAP[firstDayOfWeek] : $1f0f7ebf1ae6c530$var$getWeekStart(locale);
|
|
100
|
-
let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
|
|
101
|
-
if (dayOfWeek < 0) dayOfWeek += 7;
|
|
102
|
-
return dayOfWeek;
|
|
103
|
-
}
|
|
104
|
-
function $1f0f7ebf1ae6c530$export$461939dd4422153(timeZone) {
|
|
105
|
-
return (0, $4ae0260a69729f1d$exports.fromAbsolute)(Date.now(), timeZone);
|
|
106
|
-
}
|
|
107
|
-
function $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3(timeZone) {
|
|
108
|
-
return (0, $4ae0260a69729f1d$exports.toCalendarDate)($1f0f7ebf1ae6c530$export$461939dd4422153(timeZone));
|
|
109
|
-
}
|
|
110
|
-
function $1f0f7ebf1ae6c530$export$68781ddf31c0090f(a, b) {
|
|
111
|
-
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
|
|
112
|
-
}
|
|
113
|
-
function $1f0f7ebf1ae6c530$export$c19a80a9721b80f6(a, b) {
|
|
114
|
-
return $1f0f7ebf1ae6c530$var$timeToMs(a) - $1f0f7ebf1ae6c530$var$timeToMs(b);
|
|
115
|
-
}
|
|
116
|
-
function $1f0f7ebf1ae6c530$var$timeToMs(a) {
|
|
117
|
-
return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
|
|
118
|
-
}
|
|
119
|
-
function $1f0f7ebf1ae6c530$export$126c91c941de7e(a, timeZone) {
|
|
120
|
-
let ms = (0, $4ae0260a69729f1d$exports.toAbsolute)(a, timeZone);
|
|
121
|
-
let tomorrow = a.add({
|
|
122
|
-
days: 1
|
|
123
|
-
});
|
|
124
|
-
let tomorrowMs = (0, $4ae0260a69729f1d$exports.toAbsolute)(tomorrow, timeZone);
|
|
125
|
-
return (tomorrowMs - ms) / 3600000;
|
|
126
|
-
}
|
|
127
|
-
let $1f0f7ebf1ae6c530$var$localTimeZone = null;
|
|
128
|
-
let $1f0f7ebf1ae6c530$var$localTimeZoneOverride = false;
|
|
129
|
-
function $1f0f7ebf1ae6c530$export$aa8b41735afcabd2() {
|
|
130
|
-
if ($1f0f7ebf1ae6c530$var$localTimeZone == null) $1f0f7ebf1ae6c530$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
131
|
-
return $1f0f7ebf1ae6c530$var$localTimeZone;
|
|
132
|
-
}
|
|
133
|
-
function $1f0f7ebf1ae6c530$export$61a9d83ceb59a3dd(timeZone) {
|
|
134
|
-
$1f0f7ebf1ae6c530$var$localTimeZoneOverride = true;
|
|
135
|
-
$1f0f7ebf1ae6c530$var$localTimeZone = timeZone;
|
|
136
|
-
}
|
|
137
|
-
function $1f0f7ebf1ae6c530$export$55753838ffe79333() {
|
|
138
|
-
$1f0f7ebf1ae6c530$var$localTimeZoneOverride = false;
|
|
139
|
-
$1f0f7ebf1ae6c530$var$localTimeZone = null;
|
|
140
|
-
}
|
|
141
|
-
function $1f0f7ebf1ae6c530$export$6ab69b273755230b() {
|
|
142
|
-
return $1f0f7ebf1ae6c530$var$localTimeZoneOverride;
|
|
143
|
-
}
|
|
144
|
-
function $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date) {
|
|
145
|
-
// Use `subtract` instead of `set` so we don't get constrained in an era.
|
|
146
|
-
return date.subtract({
|
|
147
|
-
days: date.day - 1
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
function $1f0f7ebf1ae6c530$export$a2258d9c4118825c(date) {
|
|
151
|
-
return date.add({
|
|
152
|
-
days: date.calendar.getDaysInMonth(date) - date.day
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
function $1f0f7ebf1ae6c530$export$f91e89d3d0406102(date) {
|
|
156
|
-
return $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date.subtract({
|
|
157
|
-
months: date.month - 1
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
function $1f0f7ebf1ae6c530$export$8b7aa55c66d5569e(date) {
|
|
161
|
-
return $1f0f7ebf1ae6c530$export$a2258d9c4118825c(date.add({
|
|
162
|
-
months: date.calendar.getMonthsInYear(date) - date.month
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
165
|
-
function $1f0f7ebf1ae6c530$export$5412ac11713b72ad(date) {
|
|
166
|
-
if (date.calendar.getMinimumMonthInYear) return date.calendar.getMinimumMonthInYear(date);
|
|
167
|
-
return 1;
|
|
168
|
-
}
|
|
169
|
-
function $1f0f7ebf1ae6c530$export$b2f4953d301981d5(date) {
|
|
170
|
-
if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
|
|
171
|
-
return 1;
|
|
172
|
-
}
|
|
173
|
-
function $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek) {
|
|
174
|
-
let dayOfWeek = $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale, firstDayOfWeek);
|
|
175
|
-
return date.subtract({
|
|
176
|
-
days: dayOfWeek
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
function $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e(date, locale, firstDayOfWeek) {
|
|
180
|
-
return $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek).add({
|
|
181
|
-
days: 6
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
const $1f0f7ebf1ae6c530$var$cachedRegions = new Map();
|
|
185
|
-
const $1f0f7ebf1ae6c530$var$cachedWeekInfo = new Map();
|
|
186
|
-
function $1f0f7ebf1ae6c530$var$getRegion(locale) {
|
|
187
|
-
// If the Intl.Locale API is available, use it to get the region for the locale.
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
if (Intl.Locale) {
|
|
190
|
-
// Constructing an Intl.Locale is expensive, so cache the result.
|
|
191
|
-
let region = $1f0f7ebf1ae6c530$var$cachedRegions.get(locale);
|
|
192
|
-
if (!region) {
|
|
193
|
-
// @ts-ignore
|
|
194
|
-
region = new Intl.Locale(locale).maximize().region;
|
|
195
|
-
if (region) $1f0f7ebf1ae6c530$var$cachedRegions.set(locale, region);
|
|
196
|
-
}
|
|
197
|
-
return region;
|
|
198
|
-
}
|
|
199
|
-
// If not, just try splitting the string.
|
|
200
|
-
// If the second part of the locale string is 'u',
|
|
201
|
-
// then this is a unicode extension, so ignore it.
|
|
202
|
-
// Otherwise, it should be the region.
|
|
203
|
-
let part = locale.split('-')[1];
|
|
204
|
-
return part === 'u' ? undefined : part;
|
|
205
|
-
}
|
|
206
|
-
function $1f0f7ebf1ae6c530$var$getWeekStart(locale) {
|
|
207
|
-
// TODO: use Intl.Locale for this once browsers support the weekInfo property
|
|
208
|
-
// https://github.com/tc39/proposal-intl-locale-info
|
|
209
|
-
let weekInfo = $1f0f7ebf1ae6c530$var$cachedWeekInfo.get(locale);
|
|
210
|
-
if (!weekInfo) {
|
|
211
|
-
if (Intl.Locale) {
|
|
212
|
-
// @ts-ignore
|
|
213
|
-
let localeInst = new Intl.Locale(locale);
|
|
214
|
-
if ('getWeekInfo' in localeInst) {
|
|
215
|
-
// @ts-expect-error
|
|
216
|
-
weekInfo = localeInst.getWeekInfo();
|
|
217
|
-
if (weekInfo) {
|
|
218
|
-
$1f0f7ebf1ae6c530$var$cachedWeekInfo.set(locale, weekInfo);
|
|
219
|
-
return weekInfo.firstDay;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
let region = $1f0f7ebf1ae6c530$var$getRegion(locale);
|
|
224
|
-
if (locale.includes('-fw-')) {
|
|
225
|
-
// pull the value for the attribute fw from strings such as en-US-u-ca-iso8601-fw-tue or en-US-u-ca-iso8601-fw-mon-nu-thai
|
|
226
|
-
// where the fw attribute could be followed by another unicode locale extension or not
|
|
227
|
-
let day = locale.split('-fw-')[1].split('-')[0];
|
|
228
|
-
if (day === 'mon') weekInfo = {
|
|
229
|
-
firstDay: 1
|
|
230
|
-
};
|
|
231
|
-
else if (day === 'tue') weekInfo = {
|
|
232
|
-
firstDay: 2
|
|
233
|
-
};
|
|
234
|
-
else if (day === 'wed') weekInfo = {
|
|
235
|
-
firstDay: 3
|
|
236
|
-
};
|
|
237
|
-
else if (day === 'thu') weekInfo = {
|
|
238
|
-
firstDay: 4
|
|
239
|
-
};
|
|
240
|
-
else if (day === 'fri') weekInfo = {
|
|
241
|
-
firstDay: 5
|
|
242
|
-
};
|
|
243
|
-
else if (day === 'sat') weekInfo = {
|
|
244
|
-
firstDay: 6
|
|
245
|
-
};
|
|
246
|
-
else weekInfo = {
|
|
247
|
-
firstDay: 0
|
|
248
|
-
};
|
|
249
|
-
} else if (locale.includes('-ca-iso8601')) weekInfo = {
|
|
250
|
-
firstDay: 1
|
|
251
|
-
};
|
|
252
|
-
else weekInfo = {
|
|
253
|
-
firstDay: region ? (0, $4d88eff242b38a9e$exports.weekStartData)[region] || 0 : 0
|
|
254
|
-
};
|
|
255
|
-
$1f0f7ebf1ae6c530$var$cachedWeekInfo.set(locale, weekInfo);
|
|
256
|
-
}
|
|
257
|
-
return weekInfo.firstDay;
|
|
258
|
-
}
|
|
259
|
-
function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale, firstDayOfWeek) {
|
|
260
|
-
let days = date.calendar.getDaysInMonth(date);
|
|
261
|
-
return Math.ceil(($1f0f7ebf1ae6c530$export$2061056d06d7cdf7($1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date), locale, firstDayOfWeek) + days) / 7);
|
|
262
|
-
}
|
|
263
|
-
function $1f0f7ebf1ae6c530$export$5c333a116e949cdd(a, b) {
|
|
264
|
-
if (a && b) return a.compare(b) <= 0 ? a : b;
|
|
265
|
-
return a || b;
|
|
266
|
-
}
|
|
267
|
-
function $1f0f7ebf1ae6c530$export$a75f2bff57811055(a, b) {
|
|
268
|
-
if (a && b) return a.compare(b) >= 0 ? a : b;
|
|
269
|
-
return a || b;
|
|
270
|
-
}
|
|
271
|
-
const $1f0f7ebf1ae6c530$var$WEEKEND_DATA = {
|
|
272
|
-
AF: [
|
|
273
|
-
4,
|
|
274
|
-
5
|
|
275
|
-
],
|
|
276
|
-
AE: [
|
|
277
|
-
5,
|
|
278
|
-
6
|
|
279
|
-
],
|
|
280
|
-
BH: [
|
|
281
|
-
5,
|
|
282
|
-
6
|
|
283
|
-
],
|
|
284
|
-
DZ: [
|
|
285
|
-
5,
|
|
286
|
-
6
|
|
287
|
-
],
|
|
288
|
-
EG: [
|
|
289
|
-
5,
|
|
290
|
-
6
|
|
291
|
-
],
|
|
292
|
-
IL: [
|
|
293
|
-
5,
|
|
294
|
-
6
|
|
295
|
-
],
|
|
296
|
-
IQ: [
|
|
297
|
-
5,
|
|
298
|
-
6
|
|
299
|
-
],
|
|
300
|
-
IR: [
|
|
301
|
-
5,
|
|
302
|
-
5
|
|
303
|
-
],
|
|
304
|
-
JO: [
|
|
305
|
-
5,
|
|
306
|
-
6
|
|
307
|
-
],
|
|
308
|
-
KW: [
|
|
309
|
-
5,
|
|
310
|
-
6
|
|
311
|
-
],
|
|
312
|
-
LY: [
|
|
313
|
-
5,
|
|
314
|
-
6
|
|
315
|
-
],
|
|
316
|
-
OM: [
|
|
317
|
-
5,
|
|
318
|
-
6
|
|
319
|
-
],
|
|
320
|
-
QA: [
|
|
321
|
-
5,
|
|
322
|
-
6
|
|
323
|
-
],
|
|
324
|
-
SA: [
|
|
325
|
-
5,
|
|
326
|
-
6
|
|
327
|
-
],
|
|
328
|
-
SD: [
|
|
329
|
-
5,
|
|
330
|
-
6
|
|
331
|
-
],
|
|
332
|
-
SY: [
|
|
333
|
-
5,
|
|
334
|
-
6
|
|
335
|
-
],
|
|
336
|
-
YE: [
|
|
337
|
-
5,
|
|
338
|
-
6
|
|
339
|
-
]
|
|
340
|
-
};
|
|
341
|
-
function $1f0f7ebf1ae6c530$export$618d60ea299da42(date, locale) {
|
|
342
|
-
let julian = date.calendar.toJulianDay(date);
|
|
343
|
-
// If julian is negative, then julian % 7 will be negative, so we adjust
|
|
344
|
-
// accordingly. Julian day 0 is Monday.
|
|
345
|
-
let dayOfWeek = Math.ceil(julian + 1) % 7;
|
|
346
|
-
if (dayOfWeek < 0) dayOfWeek += 7;
|
|
347
|
-
let region = $1f0f7ebf1ae6c530$var$getRegion(locale);
|
|
348
|
-
// Use Intl.Locale for this once weekInfo is supported.
|
|
349
|
-
// https://github.com/tc39/proposal-intl-locale-info
|
|
350
|
-
let [start, end] = $1f0f7ebf1ae6c530$var$WEEKEND_DATA[region] || [
|
|
351
|
-
6,
|
|
352
|
-
0
|
|
353
|
-
];
|
|
354
|
-
return dayOfWeek === start || dayOfWeek === end;
|
|
355
|
-
}
|
|
356
|
-
function $1f0f7ebf1ae6c530$export$ee9d87258e1d19ed(date, locale) {
|
|
357
|
-
return !$1f0f7ebf1ae6c530$export$618d60ea299da42(date, locale);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
//# sourceMappingURL=queries.main.js.map
|
package/dist/queries.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAUM,SA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AC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;IACV,IAAI;QAAC;QAAG;KAAE;AACZ;AAGO,SAAS,yCAAU,IAAe,EAAE,MAAc;IACvD,IAAI,SAAS,KAAK,QAAQ,CAAC,WAAW,CAAC;IAEvC,wEAAwE;IACxE,wCAAwC;IACxC,IAAI,YAAY,KAAK,IAAI,CAAC,SAAS,KAAK;IACxC,IAAI,YAAY,GACd,aAAa;IAGf,IAAI,SAAS,gCAAU;IACvB,uDAAuD;IACvD,oDAAoD;IACpD,IAAI,CAAC,OAAO,IAAI,GAAG,kCAAY,CAAC,OAAQ,IAAI;QAAC;QAAG;KAAE;IAClD,OAAO,cAAc,SAAS,cAAc;AAC9C;AAGO,SAAS,0CAAU,IAAe,EAAE,MAAc;IACvD,OAAO,CAAC,yCAAU,MAAM;AAC1B","sources":["packages/@internationalized/date/src/queries.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AnyCalendarDate, AnyTime, Calendar} from './types';\nimport {CalendarDate, CalendarDateTime, ZonedDateTime} from './CalendarDate';\nimport {fromAbsolute, toAbsolute, toCalendar, toCalendarDate} from './conversion';\nimport {weekStartData} from './weekStartData';\n\ntype DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Returns whether the given dates occur on the same day, regardless of the time or calendar system. */\nexport function isSameDay(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;\n}\n\n/** Returns whether the given dates occur in the same month, using the calendar system of the first date. */\nexport function isSameMonth(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n // In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.\n a = startOfMonth(a);\n b = startOfMonth(b);\n return a.era === b.era && a.year === b.year && a.month === b.month;\n}\n\n/** Returns whether the given dates occur in the same year, using the calendar system of the first date. */\nexport function isSameYear(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n a = startOfYear(a);\n b = startOfYear(b);\n return a.era === b.era && a.year === b.year;\n}\n\n/** Returns whether the given dates occur on the same day, and are of the same calendar system. */\nexport function isEqualDay(a: DateValue, b: DateValue): boolean {\n return isEqualCalendar(a.calendar, b.calendar) && isSameDay(a, b);\n}\n\n/** Returns whether the given dates occur in the same month, and are of the same calendar system. */\nexport function isEqualMonth(a: DateValue, b: DateValue): boolean {\n return isEqualCalendar(a.calendar, b.calendar) && isSameMonth(a, b);\n}\n\n/** Returns whether the given dates occur in the same year, and are of the same calendar system. */\nexport function isEqualYear(a: DateValue, b: DateValue): boolean {\n return isEqualCalendar(a.calendar, b.calendar) && isSameYear(a, b);\n}\n\n/** Returns whether two calendars are the same. */\nexport function isEqualCalendar(a: Calendar, b: Calendar): boolean {\n return a.isEqual?.(b) ?? b.isEqual?.(a) ?? a.identifier === b.identifier;\n}\n\n/** Returns whether the date is today in the given time zone. */\nexport function isToday(date: DateValue, timeZone: string): boolean {\n return isSameDay(date, today(timeZone));\n}\n\nconst DAY_MAP = {\n sun: 0,\n mon: 1,\n tue: 2,\n wed: 3,\n thu: 4,\n fri: 5,\n sat: 6\n};\n\ntype DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';\n\n/**\n * Returns the day of week for the given date and locale. Days are numbered from zero to six,\n * where zero is the first day of the week in the given locale. For example, in the United States,\n * the first day of the week is Sunday, but in France it is Monday.\n */\nexport function getDayOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let weekStart = firstDayOfWeek ? DAY_MAP[firstDayOfWeek] : getWeekStart(locale);\n let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n return dayOfWeek;\n}\n\n/** Returns the current time in the given time zone. */\nexport function now(timeZone: string): ZonedDateTime {\n return fromAbsolute(Date.now(), timeZone);\n}\n\n/** Returns today's date in the given time zone. */\nexport function today(timeZone: string): CalendarDate {\n return toCalendarDate(now(timeZone));\n}\n\nexport function compareDate(a: AnyCalendarDate, b: AnyCalendarDate): number {\n return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);\n}\n\nexport function compareTime(a: AnyTime, b: AnyTime): number {\n return timeToMs(a) - timeToMs(b);\n}\n\nfunction timeToMs(a: AnyTime): number {\n return a.hour * 60 * 60 * 1000 + a.minute * 60 * 1000 + a.second * 1000 + a.millisecond;\n}\n\n/**\n * Returns the number of hours in the given date and time zone.\n * Usually this is 24, but it could be 23 or 25 if the date is on a daylight saving transition.\n */\nexport function getHoursInDay(a: CalendarDate, timeZone: string): number {\n let ms = toAbsolute(a, timeZone);\n let tomorrow = a.add({days: 1});\n let tomorrowMs = toAbsolute(tomorrow, timeZone);\n return (tomorrowMs - ms) / 3600000;\n}\n\nlet localTimeZone: string | null = null;\nlet localTimeZoneOverride = false;\n\n/** Returns the time zone identifier for the current user. */\nexport function getLocalTimeZone(): string {\n if (localTimeZone == null) {\n localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return localTimeZone!;\n}\n\n/** Sets the time zone identifier for the current user. */\nexport function setLocalTimeZone(timeZone: string): void {\n localTimeZoneOverride = true;\n localTimeZone = timeZone;\n}\n\n/** Resets the time zone identifier for the current user. */\nexport function resetLocalTimeZone(): void {\n localTimeZoneOverride = false;\n localTimeZone = null;\n}\n\n/** Returns whether the local time zone has been explicitly overridden via `setLocalTimeZone`. */\nexport function isLocalTimeZoneOverridden(): boolean {\n return localTimeZoneOverride;\n}\n\n/** Returns the first date of the month for the given date. */\nexport function startOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function startOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function startOfMonth(date: CalendarDate): CalendarDate;\nexport function startOfMonth(date: DateValue): DateValue;\nexport function startOfMonth(date: DateValue): DateValue {\n // Use `subtract` instead of `set` so we don't get constrained in an era.\n return date.subtract({days: date.day - 1});\n}\n\n/** Returns the last date of the month for the given date. */\nexport function endOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function endOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function endOfMonth(date: CalendarDate): CalendarDate;\nexport function endOfMonth(date: DateValue): DateValue;\nexport function endOfMonth(date: DateValue): DateValue {\n return date.add({days: date.calendar.getDaysInMonth(date) - date.day});\n}\n\n/** Returns the first day of the year for the given date. */\nexport function startOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function startOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function startOfYear(date: CalendarDate): CalendarDate;\nexport function startOfYear(date: DateValue): DateValue;\nexport function startOfYear(date: DateValue): DateValue {\n return startOfMonth(date.subtract({months: date.month - 1}));\n}\n\n/** Returns the last day of the year for the given date. */\nexport function endOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function endOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function endOfYear(date: CalendarDate): CalendarDate;\nexport function endOfYear(date: DateValue): DateValue;\nexport function endOfYear(date: DateValue): DateValue {\n return endOfMonth(date.add({months: date.calendar.getMonthsInYear(date) - date.month}));\n}\n\nexport function getMinimumMonthInYear(date: AnyCalendarDate): number {\n if (date.calendar.getMinimumMonthInYear) {\n return date.calendar.getMinimumMonthInYear(date);\n }\n\n return 1;\n}\n\nexport function getMinimumDayInMonth(date: AnyCalendarDate): number {\n if (date.calendar.getMinimumDayInMonth) {\n return date.calendar.getMinimumDayInMonth(date);\n }\n\n return 1;\n}\n\n/** Returns the first date of the week for the given date and locale. */\nexport function startOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;\nexport function startOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;\nexport function startOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;\nexport function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;\nexport function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue {\n let dayOfWeek = getDayOfWeek(date, locale, firstDayOfWeek);\n return date.subtract({days: dayOfWeek});\n}\n\n/** Returns the last date of the week for the given date and locale. */\nexport function endOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;\nexport function endOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;\nexport function endOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;\nexport function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;\nexport function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue {\n return startOfWeek(date, locale, firstDayOfWeek).add({days: 6});\n}\n\nconst cachedRegions = new Map<string, string>();\nconst cachedWeekInfo = new Map<string, {firstDay: number}>();\n\nfunction getRegion(locale: string): string | undefined {\n // If the Intl.Locale API is available, use it to get the region for the locale.\n // @ts-ignore\n if (Intl.Locale) {\n // Constructing an Intl.Locale is expensive, so cache the result.\n let region = cachedRegions.get(locale);\n if (!region) {\n // @ts-ignore\n region = new Intl.Locale(locale).maximize().region;\n if (region) {\n cachedRegions.set(locale, region);\n }\n }\n return region;\n }\n\n // If not, just try splitting the string.\n // If the second part of the locale string is 'u',\n // then this is a unicode extension, so ignore it.\n // Otherwise, it should be the region.\n let part = locale.split('-')[1];\n return part === 'u' ? undefined : part;\n}\n\nfunction getWeekStart(locale: string): number {\n // TODO: use Intl.Locale for this once browsers support the weekInfo property\n // https://github.com/tc39/proposal-intl-locale-info\n let weekInfo = cachedWeekInfo.get(locale);\n if (!weekInfo) {\n if (Intl.Locale) {\n // @ts-ignore\n let localeInst = new Intl.Locale(locale);\n if ('getWeekInfo' in localeInst) {\n // @ts-expect-error\n weekInfo = localeInst.getWeekInfo();\n if (weekInfo) {\n cachedWeekInfo.set(locale, weekInfo);\n return weekInfo.firstDay;\n }\n }\n }\n let region = getRegion(locale);\n if (locale.includes('-fw-')) {\n // pull the value for the attribute fw from strings such as en-US-u-ca-iso8601-fw-tue or en-US-u-ca-iso8601-fw-mon-nu-thai\n // where the fw attribute could be followed by another unicode locale extension or not\n let day = locale.split('-fw-')[1].split('-')[0];\n if (day === 'mon') {\n weekInfo = {firstDay: 1};\n } else if (day === 'tue') {\n weekInfo = {firstDay: 2};\n } else if (day === 'wed') {\n weekInfo = {firstDay: 3};\n } else if (day === 'thu') {\n weekInfo = {firstDay: 4};\n } else if (day === 'fri') {\n weekInfo = {firstDay: 5};\n } else if (day === 'sat') {\n weekInfo = {firstDay: 6};\n } else {\n weekInfo = {firstDay: 0};\n }\n } else if (locale.includes('-ca-iso8601')) {\n weekInfo = {firstDay: 1};\n } else {\n weekInfo = {firstDay: region ? weekStartData[region] || 0 : 0};\n }\n cachedWeekInfo.set(locale, weekInfo);\n }\n\n return weekInfo.firstDay;\n}\n\n/** Returns the number of weeks in the given month and locale. */\nexport function getWeeksInMonth(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number {\n let days = date.calendar.getDaysInMonth(date);\n return Math.ceil((getDayOfWeek(startOfMonth(date), locale, firstDayOfWeek) + days) / 7);\n}\n\n/** Returns the lesser of the two provider dates. */\nexport function minDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined {\n if (a && b) {\n return a.compare(b) <= 0 ? a : b;\n }\n\n return a || b;\n}\n\n/** Returns the greater of the two provider dates. */\nexport function maxDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined {\n if (a && b) {\n return a.compare(b) >= 0 ? a : b;\n }\n\n return a || b;\n}\n\nconst WEEKEND_DATA = {\n AF: [4, 5],\n AE: [5, 6],\n BH: [5, 6],\n DZ: [5, 6],\n EG: [5, 6],\n IL: [5, 6],\n IQ: [5, 6],\n IR: [5, 5],\n JO: [5, 6],\n KW: [5, 6],\n LY: [5, 6],\n OM: [5, 6],\n QA: [5, 6],\n SA: [5, 6],\n SD: [5, 6],\n SY: [5, 6],\n YE: [5, 6]\n};\n\n/** Returns whether the given date is on a weekend in the given locale. */\nexport function isWeekend(date: DateValue, locale: string): boolean {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let dayOfWeek = Math.ceil(julian + 1) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n let region = getRegion(locale);\n // Use Intl.Locale for this once weekInfo is supported.\n // https://github.com/tc39/proposal-intl-locale-info\n let [start, end] = WEEKEND_DATA[region!] || [6, 0];\n return dayOfWeek === start || dayOfWeek === end;\n}\n\n/** Returns whether the given date is on a weekday in the given locale. */\nexport function isWeekday(date: DateValue, locale: string): boolean {\n return !isWeekend(date, locale);\n}\n"],"names":[],"version":3,"file":"queries.main.js.map"}
|