node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "BuddhistCalendar", () => $561c4ef058278b74$export$42d20a78301dee44);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $561c4ef058278b74$var$BUDDHIST_ERA_START = -543;
class $561c4ef058278b74$export$42d20a78301dee44 extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
fromJulianDay(jd) {
let gregorianDate = super.fromJulianDay(jd);
let year = (0, $af14c9812fdceb33$exports.getExtendedYear)(gregorianDate.era, gregorianDate.year);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, year - $561c4ef058278b74$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
}
toJulianDay(date) {
return super.toJulianDay($561c4ef058278b74$var$toGregorian(date));
}
getEras() {
return [
'BE'
];
}
getDaysInMonth(date) {
return super.getDaysInMonth($561c4ef058278b74$var$toGregorian(date));
}
balanceDate() {}
constructor(...args){
super(...args);
this.identifier = 'buddhist';
}
}
function $561c4ef058278b74$var$toGregorian(date) {
let [era, year] = (0, $af14c9812fdceb33$exports.fromExtendedYear)(date.year + $561c4ef058278b74$var$BUDDHIST_ERA_START);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(era, year, date.month, date.day);
}
//# sourceMappingURL=BuddhistCalendar.main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;;aAzBf,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.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\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.main.js.map"}

View File

@@ -0,0 +1,49 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, getExtendedYear as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $8d73d47422ca7302$var$BUDDHIST_ERA_START = -543;
class $8d73d47422ca7302$export$42d20a78301dee44 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let gregorianDate = super.fromJulianDay(jd);
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(gregorianDate.era, gregorianDate.year);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year - $8d73d47422ca7302$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
}
toJulianDay(date) {
return super.toJulianDay($8d73d47422ca7302$var$toGregorian(date));
}
getEras() {
return [
'BE'
];
}
getDaysInMonth(date) {
return super.getDaysInMonth($8d73d47422ca7302$var$toGregorian(date));
}
balanceDate() {}
constructor(...args){
super(...args);
this.identifier = 'buddhist';
}
}
function $8d73d47422ca7302$var$toGregorian(date) {
let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)(date.year + $8d73d47422ca7302$var$BUDDHIST_ERA_START);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$8d73d47422ca7302$export$42d20a78301dee44 as BuddhistCalendar};
//# sourceMappingURL=BuddhistCalendar.module.js.map

View File

@@ -0,0 +1,49 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, getExtendedYear as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $8d73d47422ca7302$var$BUDDHIST_ERA_START = -543;
class $8d73d47422ca7302$export$42d20a78301dee44 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let gregorianDate = super.fromJulianDay(jd);
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(gregorianDate.era, gregorianDate.year);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year - $8d73d47422ca7302$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
}
toJulianDay(date) {
return super.toJulianDay($8d73d47422ca7302$var$toGregorian(date));
}
getEras() {
return [
'BE'
];
}
getDaysInMonth(date) {
return super.getDaysInMonth($8d73d47422ca7302$var$toGregorian(date));
}
balanceDate() {}
constructor(...args){
super(...args);
this.identifier = 'buddhist';
}
}
function $8d73d47422ca7302$var$toGregorian(date) {
let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)(date.year + $8d73d47422ca7302$var$BUDDHIST_ERA_START);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$8d73d47422ca7302$export$42d20a78301dee44 as BuddhistCalendar};
//# sourceMappingURL=BuddhistCalendar.module.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;;aAzBf,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.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\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.module.js.map"}

View File

@@ -0,0 +1,260 @@
var $5c0571aa5b6fb5da$exports = require("./manipulation.main.js");
var $1f0f7ebf1ae6c530$exports = require("./queries.main.js");
var $4c32e2d98e5a5134$exports = require("./string.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
var $4ae0260a69729f1d$exports = require("./conversion.main.js");
var $lislG$swchelperscjs_class_private_field_initcjs = require("@swc/helpers/cjs/_class_private_field_init.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "CalendarDate", () => $625ad1e1f4c43bc1$export$99faa760c7908e4f);
$parcel$export(module.exports, "Time", () => $625ad1e1f4c43bc1$export$680ea196effce5f);
$parcel$export(module.exports, "CalendarDateTime", () => $625ad1e1f4c43bc1$export$ca871e8dbb80966f);
$parcel$export(module.exports, "ZonedDateTime", () => $625ad1e1f4c43bc1$export$d3b7288e7994edea);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $625ad1e1f4c43bc1$var$shiftArgs(args) {
let calendar = typeof args[0] === 'object' ? args.shift() : new (0, $af14c9812fdceb33$exports.GregorianCalendar)();
let era;
if (typeof args[0] === 'string') era = args.shift();
else {
let eras = calendar.getEras();
era = eras[eras.length - 1];
}
let year = args.shift();
let month = args.shift();
let day = args.shift();
return [
calendar,
era,
year,
month,
day
];
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
// If that behavior is desired, use the AnyCalendarDate interface instead.
// @ts-ignore
$625ad1e1f4c43bc1$var$_type = /*#__PURE__*/ new WeakMap();
class $625ad1e1f4c43bc1$export$99faa760c7908e4f {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $625ad1e1f4c43bc1$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
else return new $625ad1e1f4c43bc1$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
}
/** Returns a new `CalendarDate` with the given duration added to it. */ add(duration) {
return (0, $5c0571aa5b6fb5da$exports.add)(this, duration);
}
/** Returns a new `CalendarDate` with the given duration subtracted from it. */ subtract(duration) {
return (0, $5c0571aa5b6fb5da$exports.subtract)(this, duration);
}
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $5c0571aa5b6fb5da$exports.set)(this, fields);
}
/**
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $5c0571aa5b6fb5da$exports.cycleDate)(this, field, amount, options);
}
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ toDate(timeZone) {
return (0, $4ae0260a69729f1d$exports.toDate)(this, timeZone);
}
/** Converts the date to an ISO 8601 formatted string. */ toString() {
return (0, $4c32e2d98e5a5134$exports.dateToString)(this);
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
return (0, $1f0f7ebf1ae6c530$exports.compareDate)(this, b);
}
constructor(...args){
(0, $lislG$swchelperscjs_class_private_field_initcjs._)(this, $625ad1e1f4c43bc1$var$_type, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $625ad1e1f4c43bc1$var$shiftArgs(args);
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
(0, $5c0571aa5b6fb5da$exports.constrain)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$625ad1e1f4c43bc1$var$_type1 = /*#__PURE__*/ new WeakMap();
class $625ad1e1f4c43bc1$export$680ea196effce5f {
/** Returns a copy of this time. */ copy() {
return new $625ad1e1f4c43bc1$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `Time` with the given duration added to it. */ add(duration) {
return (0, $5c0571aa5b6fb5da$exports.addTime)(this, duration);
}
/** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
return (0, $5c0571aa5b6fb5da$exports.subtractTime)(this, duration);
}
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $5c0571aa5b6fb5da$exports.setTime)(this, fields);
}
/**
* Returns a new `Time` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $5c0571aa5b6fb5da$exports.cycleTime)(this, field, amount, options);
}
/** Converts the time to an ISO 8601 formatted string. */ toString() {
return (0, $4c32e2d98e5a5134$exports.timeToString)(this);
}
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
return (0, $1f0f7ebf1ae6c530$exports.compareTime)(this, b);
}
constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
(0, $lislG$swchelperscjs_class_private_field_initcjs._)(this, $625ad1e1f4c43bc1$var$_type1, {
writable: true,
value: void 0
});
this.hour = hour;
this.minute = minute;
this.second = second;
this.millisecond = millisecond;
(0, $5c0571aa5b6fb5da$exports.constrainTime)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$625ad1e1f4c43bc1$var$_type2 = /*#__PURE__*/ new WeakMap();
class $625ad1e1f4c43bc1$export$ca871e8dbb80966f {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $625ad1e1f4c43bc1$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
else return new $625ad1e1f4c43bc1$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `CalendarDateTime` with the given duration added to it. */ add(duration) {
return (0, $5c0571aa5b6fb5da$exports.add)(this, duration);
}
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ subtract(duration) {
return (0, $5c0571aa5b6fb5da$exports.subtract)(this, duration);
}
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $5c0571aa5b6fb5da$exports.set)((0, $5c0571aa5b6fb5da$exports.setTime)(this, fields), fields);
}
/**
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
switch(field){
case 'era':
case 'year':
case 'month':
case 'day':
return (0, $5c0571aa5b6fb5da$exports.cycleDate)(this, field, amount, options);
default:
return (0, $5c0571aa5b6fb5da$exports.cycleTime)(this, field, amount, options);
}
}
/** Converts the date to a native JavaScript Date object in the given time zone. */ toDate(timeZone, disambiguation) {
return (0, $4ae0260a69729f1d$exports.toDate)(this, timeZone, disambiguation);
}
/** Converts the date to an ISO 8601 formatted string. */ toString() {
return (0, $4c32e2d98e5a5134$exports.dateTimeToString)(this);
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
let res = (0, $1f0f7ebf1ae6c530$exports.compareDate)(this, b);
if (res === 0) return (0, $1f0f7ebf1ae6c530$exports.compareTime)(this, (0, $4ae0260a69729f1d$exports.toCalendarDateTime)(b));
return res;
}
constructor(...args){
(0, $lislG$swchelperscjs_class_private_field_initcjs._)(this, $625ad1e1f4c43bc1$var$_type2, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $625ad1e1f4c43bc1$var$shiftArgs(args);
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
this.hour = args.shift() || 0;
this.minute = args.shift() || 0;
this.second = args.shift() || 0;
this.millisecond = args.shift() || 0;
(0, $5c0571aa5b6fb5da$exports.constrain)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$625ad1e1f4c43bc1$var$_type3 = /*#__PURE__*/ new WeakMap();
class $625ad1e1f4c43bc1$export$d3b7288e7994edea {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $625ad1e1f4c43bc1$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
else return new $625ad1e1f4c43bc1$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `ZonedDateTime` with the given duration added to it. */ add(duration) {
return (0, $5c0571aa5b6fb5da$exports.addZoned)(this, duration);
}
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ subtract(duration) {
return (0, $5c0571aa5b6fb5da$exports.subtractZoned)(this, duration);
}
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields, disambiguation) {
return (0, $5c0571aa5b6fb5da$exports.setZoned)(this, fields, disambiguation);
}
/**
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $5c0571aa5b6fb5da$exports.cycleZoned)(this, field, amount, options);
}
/** Converts the date to a native JavaScript Date object. */ toDate() {
return (0, $4ae0260a69729f1d$exports.zonedToDate)(this);
}
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ toString() {
return (0, $4c32e2d98e5a5134$exports.zonedDateTimeToString)(this);
}
/** Converts the date to an ISO 8601 formatted string in UTC. */ toAbsoluteString() {
return this.toDate().toISOString();
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
// TODO: Is this a bad idea??
return this.toDate().getTime() - (0, $4ae0260a69729f1d$exports.toZoned)(b, this.timeZone).toDate().getTime();
}
constructor(...args){
(0, $lislG$swchelperscjs_class_private_field_initcjs._)(this, $625ad1e1f4c43bc1$var$_type3, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $625ad1e1f4c43bc1$var$shiftArgs(args);
let timeZone = args.shift();
let offset = args.shift();
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
this.timeZone = timeZone;
this.offset = offset;
this.hour = args.shift() || 0;
this.minute = args.shift() || 0;
this.second = args.shift() || 0;
this.millisecond = args.shift() || 0;
(0, $5c0571aa5b6fb5da$exports.constrain)(this);
}
}
//# sourceMappingURL=CalendarDate.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,252 @@
import {add as $735220c2d4774dd3$export$e16d8520af44a096, addTime as $735220c2d4774dd3$export$7ed87b6bc2506470, addZoned as $735220c2d4774dd3$export$96b1d28349274637, constrain as $735220c2d4774dd3$export$c4e2ecac49351ef2, constrainTime as $735220c2d4774dd3$export$7555de1e070510cb, cycleDate as $735220c2d4774dd3$export$d52ced6badfb9a4c, cycleTime as $735220c2d4774dd3$export$dd02b3e0007dfe28, cycleZoned as $735220c2d4774dd3$export$9a297d111fc86b79, set as $735220c2d4774dd3$export$adaa4cf7ef1b65be, setTime as $735220c2d4774dd3$export$e5d5e1c1822b6e56, setZoned as $735220c2d4774dd3$export$31b5430eb18be4f8, subtract as $735220c2d4774dd3$export$4e2d2ead65e5f7e3, subtractTime as $735220c2d4774dd3$export$fe34d3a381cd7501, subtractZoned as $735220c2d4774dd3$export$6814caac34ca03c7} from "./manipulation.mjs";
import {compareDate as $14e0f24ef4ac5c92$export$68781ddf31c0090f, compareTime as $14e0f24ef4ac5c92$export$c19a80a9721b80f6} from "./queries.mjs";
import {dateTimeToString as $fae977aafc393c5c$export$4223de14708adc63, dateToString as $fae977aafc393c5c$export$60dfd74aa96791bd, timeToString as $fae977aafc393c5c$export$f59dee82248f5ad4, zonedDateTimeToString as $fae977aafc393c5c$export$bf79f1ebf4b18792} from "./string.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
import {toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toDate as $11d87f3f76e88657$export$e67a095c620b86fe, toZoned as $11d87f3f76e88657$export$84c95a83c799e074, zonedToDate as $11d87f3f76e88657$export$83aac07b4c37b25} from "./conversion.mjs";
import {_ as $aksy1$_} from "@swc/helpers/_/_class_private_field_init";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
let calendar = typeof args[0] === 'object' ? args.shift() : new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
let era;
if (typeof args[0] === 'string') era = args.shift();
else {
let eras = calendar.getEras();
era = eras[eras.length - 1];
}
let year = args.shift();
let month = args.shift();
let day = args.shift();
return [
calendar,
era,
year,
month,
day
];
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
// If that behavior is desired, use the AnyCalendarDate interface instead.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
else return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
}
/** Returns a new `CalendarDate` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
}
/** Returns a new `CalendarDate` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
}
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)(this, fields);
}
/**
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
}
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ toDate(timeZone) {
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone);
}
/** Converts the date to an ISO 8601 formatted string. */ toString() {
return (0, $fae977aafc393c5c$export$60dfd74aa96791bd)(this);
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
return (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
}
constructor(...args){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type1 = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$680ea196effce5f {
/** Returns a copy of this time. */ copy() {
return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `Time` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration);
}
/** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$fe34d3a381cd7501)(this, duration);
}
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields);
}
/**
* Returns a new `Time` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
}
/** Converts the time to an ISO 8601 formatted string. */ toString() {
return (0, $fae977aafc393c5c$export$f59dee82248f5ad4)(this);
}
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, b);
}
constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type1, {
writable: true,
value: void 0
});
this.hour = hour;
this.minute = minute;
this.second = second;
this.millisecond = millisecond;
(0, $735220c2d4774dd3$export$7555de1e070510cb)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type2 = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
else return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `CalendarDateTime` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
}
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
}
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)((0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields), fields);
}
/**
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
switch(field){
case 'era':
case 'year':
case 'month':
case 'day':
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
default:
return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
}
}
/** Converts the date to a native JavaScript Date object in the given time zone. */ toDate(timeZone, disambiguation) {
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone, disambiguation);
}
/** Converts the date to an ISO 8601 formatted string. */ toString() {
return (0, $fae977aafc393c5c$export$4223de14708adc63)(this);
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
let res = (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
if (res === 0) return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, (0, $11d87f3f76e88657$export$b21e0b124e224484)(b));
return res;
}
constructor(...args){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type2, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
this.hour = args.shift() || 0;
this.minute = args.shift() || 0;
this.second = args.shift() || 0;
this.millisecond = args.shift() || 0;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type3 = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
else return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `ZonedDateTime` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$96b1d28349274637)(this, duration);
}
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$6814caac34ca03c7)(this, duration);
}
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields, disambiguation) {
return (0, $735220c2d4774dd3$export$31b5430eb18be4f8)(this, fields, disambiguation);
}
/**
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $735220c2d4774dd3$export$9a297d111fc86b79)(this, field, amount, options);
}
/** Converts the date to a native JavaScript Date object. */ toDate() {
return (0, $11d87f3f76e88657$export$83aac07b4c37b25)(this);
}
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ toString() {
return (0, $fae977aafc393c5c$export$bf79f1ebf4b18792)(this);
}
/** Converts the date to an ISO 8601 formatted string in UTC. */ toAbsoluteString() {
return this.toDate().toISOString();
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
// TODO: Is this a bad idea??
return this.toDate().getTime() - (0, $11d87f3f76e88657$export$84c95a83c799e074)(b, this.timeZone).toDate().getTime();
}
constructor(...args){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type3, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
let timeZone = args.shift();
let offset = args.shift();
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
this.timeZone = timeZone;
this.offset = offset;
this.hour = args.shift() || 0;
this.minute = args.shift() || 0;
this.second = args.shift() || 0;
this.millisecond = args.shift() || 0;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
}
}
export {$35ea8db9cb2ccb90$export$99faa760c7908e4f as CalendarDate, $35ea8db9cb2ccb90$export$680ea196effce5f as Time, $35ea8db9cb2ccb90$export$ca871e8dbb80966f as CalendarDateTime, $35ea8db9cb2ccb90$export$d3b7288e7994edea as ZonedDateTime};
//# sourceMappingURL=CalendarDate.module.js.map

View File

@@ -0,0 +1,252 @@
import {add as $735220c2d4774dd3$export$e16d8520af44a096, addTime as $735220c2d4774dd3$export$7ed87b6bc2506470, addZoned as $735220c2d4774dd3$export$96b1d28349274637, constrain as $735220c2d4774dd3$export$c4e2ecac49351ef2, constrainTime as $735220c2d4774dd3$export$7555de1e070510cb, cycleDate as $735220c2d4774dd3$export$d52ced6badfb9a4c, cycleTime as $735220c2d4774dd3$export$dd02b3e0007dfe28, cycleZoned as $735220c2d4774dd3$export$9a297d111fc86b79, set as $735220c2d4774dd3$export$adaa4cf7ef1b65be, setTime as $735220c2d4774dd3$export$e5d5e1c1822b6e56, setZoned as $735220c2d4774dd3$export$31b5430eb18be4f8, subtract as $735220c2d4774dd3$export$4e2d2ead65e5f7e3, subtractTime as $735220c2d4774dd3$export$fe34d3a381cd7501, subtractZoned as $735220c2d4774dd3$export$6814caac34ca03c7} from "./manipulation.module.js";
import {compareDate as $14e0f24ef4ac5c92$export$68781ddf31c0090f, compareTime as $14e0f24ef4ac5c92$export$c19a80a9721b80f6} from "./queries.module.js";
import {dateTimeToString as $fae977aafc393c5c$export$4223de14708adc63, dateToString as $fae977aafc393c5c$export$60dfd74aa96791bd, timeToString as $fae977aafc393c5c$export$f59dee82248f5ad4, zonedDateTimeToString as $fae977aafc393c5c$export$bf79f1ebf4b18792} from "./string.module.js";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
import {toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toDate as $11d87f3f76e88657$export$e67a095c620b86fe, toZoned as $11d87f3f76e88657$export$84c95a83c799e074, zonedToDate as $11d87f3f76e88657$export$83aac07b4c37b25} from "./conversion.module.js";
import {_ as $aksy1$_} from "@swc/helpers/_/_class_private_field_init";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
let calendar = typeof args[0] === 'object' ? args.shift() : new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
let era;
if (typeof args[0] === 'string') era = args.shift();
else {
let eras = calendar.getEras();
era = eras[eras.length - 1];
}
let year = args.shift();
let month = args.shift();
let day = args.shift();
return [
calendar,
era,
year,
month,
day
];
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
// If that behavior is desired, use the AnyCalendarDate interface instead.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
else return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
}
/** Returns a new `CalendarDate` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
}
/** Returns a new `CalendarDate` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
}
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)(this, fields);
}
/**
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
}
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ toDate(timeZone) {
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone);
}
/** Converts the date to an ISO 8601 formatted string. */ toString() {
return (0, $fae977aafc393c5c$export$60dfd74aa96791bd)(this);
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
return (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
}
constructor(...args){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type1 = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$680ea196effce5f {
/** Returns a copy of this time. */ copy() {
return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `Time` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration);
}
/** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$fe34d3a381cd7501)(this, duration);
}
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields);
}
/**
* Returns a new `Time` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
}
/** Converts the time to an ISO 8601 formatted string. */ toString() {
return (0, $fae977aafc393c5c$export$f59dee82248f5ad4)(this);
}
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, b);
}
constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type1, {
writable: true,
value: void 0
});
this.hour = hour;
this.minute = minute;
this.second = second;
this.millisecond = millisecond;
(0, $735220c2d4774dd3$export$7555de1e070510cb)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type2 = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
else return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `CalendarDateTime` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
}
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
}
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)((0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields), fields);
}
/**
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
switch(field){
case 'era':
case 'year':
case 'month':
case 'day':
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
default:
return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
}
}
/** Converts the date to a native JavaScript Date object in the given time zone. */ toDate(timeZone, disambiguation) {
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone, disambiguation);
}
/** Converts the date to an ISO 8601 formatted string. */ toString() {
return (0, $fae977aafc393c5c$export$4223de14708adc63)(this);
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
let res = (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
if (res === 0) return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, (0, $11d87f3f76e88657$export$b21e0b124e224484)(b));
return res;
}
constructor(...args){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type2, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
this.hour = args.shift() || 0;
this.minute = args.shift() || 0;
this.second = args.shift() || 0;
this.millisecond = args.shift() || 0;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
}
}
var // This prevents TypeScript from allowing other types with the same fields to match.
// @ts-ignore
$35ea8db9cb2ccb90$var$_type3 = /*#__PURE__*/ new WeakMap();
class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
/** Returns a copy of this date. */ copy() {
if (this.era) return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
else return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
}
/** Returns a new `ZonedDateTime` with the given duration added to it. */ add(duration) {
return (0, $735220c2d4774dd3$export$96b1d28349274637)(this, duration);
}
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ subtract(duration) {
return (0, $735220c2d4774dd3$export$6814caac34ca03c7)(this, duration);
}
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields, disambiguation) {
return (0, $735220c2d4774dd3$export$31b5430eb18be4f8)(this, fields, disambiguation);
}
/**
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/ cycle(field, amount, options) {
return (0, $735220c2d4774dd3$export$9a297d111fc86b79)(this, field, amount, options);
}
/** Converts the date to a native JavaScript Date object. */ toDate() {
return (0, $11d87f3f76e88657$export$83aac07b4c37b25)(this);
}
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ toString() {
return (0, $fae977aafc393c5c$export$bf79f1ebf4b18792)(this);
}
/** Converts the date to an ISO 8601 formatted string in UTC. */ toAbsoluteString() {
return this.toDate().toISOString();
}
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
// TODO: Is this a bad idea??
return this.toDate().getTime() - (0, $11d87f3f76e88657$export$84c95a83c799e074)(b, this.timeZone).toDate().getTime();
}
constructor(...args){
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type3, {
writable: true,
value: void 0
});
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
let timeZone = args.shift();
let offset = args.shift();
this.calendar = calendar;
this.era = era;
this.year = year;
this.month = month;
this.day = day;
this.timeZone = timeZone;
this.offset = offset;
this.hour = args.shift() || 0;
this.minute = args.shift() || 0;
this.second = args.shift() || 0;
this.millisecond = args.shift() || 0;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
}
}
export {$35ea8db9cb2ccb90$export$99faa760c7908e4f as CalendarDate, $35ea8db9cb2ccb90$export$680ea196effce5f as Time, $35ea8db9cb2ccb90$export$ca871e8dbb80966f as CalendarDateTime, $35ea8db9cb2ccb90$export$d3b7288e7994edea as ZonedDateTime};
//# sourceMappingURL=CalendarDate.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,145 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "DateFormatter", () => $8f23a04ae90a588b$export$ad991b66133851cf);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ let $8f23a04ae90a588b$var$formatterCache = new Map();
class $8f23a04ae90a588b$export$ad991b66133851cf {
/** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
return this.formatter.format(value);
}
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) {
return this.formatter.formatToParts(value);
}
/** Formats a date range as a string. */ formatRange(start, end) {
// @ts-ignore
if (typeof this.formatter.formatRange === 'function') // @ts-ignore
return this.formatter.formatRange(start, end);
if (end < start) throw new RangeError('End date must be >= start date');
// Very basic fallback for old browsers.
return `${this.formatter.format(start)} \u{2013} ${this.formatter.format(end)}`;
}
/** Formats a date range as an array of parts. */ formatRangeToParts(start, end) {
// @ts-ignore
if (typeof this.formatter.formatRangeToParts === 'function') // @ts-ignore
return this.formatter.formatRangeToParts(start, end);
if (end < start) throw new RangeError('End date must be >= start date');
let startParts = this.formatter.formatToParts(start);
let endParts = this.formatter.formatToParts(end);
return [
...startParts.map((p)=>({
...p,
source: 'startRange'
})),
{
type: 'literal',
value: " \u2013 ",
source: 'shared'
},
...endParts.map((p)=>({
...p,
source: 'endRange'
}))
];
}
/** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
let resolvedOptions = this.formatter.resolvedOptions();
if ($8f23a04ae90a588b$var$hasBuggyResolvedHourCycle()) {
if (!this.resolvedHourCycle) this.resolvedHourCycle = $8f23a04ae90a588b$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
resolvedOptions.hourCycle = this.resolvedHourCycle;
resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
}
// Safari uses a different name for the Ethiopic (Amete Alem) calendar.
// https://bugs.webkit.org/show_bug.cgi?id=241564
if (resolvedOptions.calendar === 'ethiopic-amete-alem') resolvedOptions.calendar = 'ethioaa';
return resolvedOptions;
}
constructor(locale, options = {}){
this.formatter = $8f23a04ae90a588b$var$getCachedDateFormatter(locale, options);
this.options = options;
}
}
// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)
// rather than h12 (12:00 - 11:59).
// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal
// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]
// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791
// [2] https://github.com/tc39/ecma402/issues/402
// [3] https://bugs.webkit.org/show_bug.cgi?id=229313
// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
const $8f23a04ae90a588b$var$hour12Preferences = {
true: {
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
ja: 'h11'
},
false: {
}
};
function $8f23a04ae90a588b$var$getCachedDateFormatter(locale, options = {}) {
// Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
// Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
if (typeof options.hour12 === 'boolean' && $8f23a04ae90a588b$var$hasBuggyHour12Behavior()) {
options = {
...options
};
let pref = $8f23a04ae90a588b$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
delete options.hour12;
}
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
if ($8f23a04ae90a588b$var$formatterCache.has(cacheKey)) return $8f23a04ae90a588b$var$formatterCache.get(cacheKey);
let numberFormatter = new Intl.DateTimeFormat(locale, options);
$8f23a04ae90a588b$var$formatterCache.set(cacheKey, numberFormatter);
return numberFormatter;
}
let $8f23a04ae90a588b$var$_hasBuggyHour12Behavior = null;
function $8f23a04ae90a588b$var$hasBuggyHour12Behavior() {
if ($8f23a04ae90a588b$var$_hasBuggyHour12Behavior == null) $8f23a04ae90a588b$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
hour12: false
}).format(new Date(2020, 2, 3, 0)) === '24';
return $8f23a04ae90a588b$var$_hasBuggyHour12Behavior;
}
let $8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle = null;
function $8f23a04ae90a588b$var$hasBuggyResolvedHourCycle() {
if ($8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle == null) $8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
hour: 'numeric',
hour12: false
}).resolvedOptions().hourCycle === 'h12';
return $8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle;
}
function $8f23a04ae90a588b$var$getResolvedHourCycle(locale, options) {
if (!options.timeStyle && !options.hour) return undefined;
// Work around buggy results in resolved hourCycle and hour12 options in WebKit.
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
let formatter = $8f23a04ae90a588b$var$getCachedDateFormatter(locale, {
...options,
timeZone: undefined // use local timezone
});
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p)=>p.type === 'hour').value, 10);
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p)=>p.type === 'hour').value, 10);
if (min === 0 && max === 23) return 'h23';
if (min === 24 && max === 23) return 'h24';
if (min === 0 && max === 11) return 'h11';
if (min === 12 && max === 11) return 'h12';
throw new Error('Unexpected hour cycle result');
}
//# sourceMappingURL=DateFormatter.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,140 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ let $fb18d541ea1ad717$var$formatterCache = new Map();
class $fb18d541ea1ad717$export$ad991b66133851cf {
/** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
return this.formatter.format(value);
}
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) {
return this.formatter.formatToParts(value);
}
/** Formats a date range as a string. */ formatRange(start, end) {
// @ts-ignore
if (typeof this.formatter.formatRange === 'function') // @ts-ignore
return this.formatter.formatRange(start, end);
if (end < start) throw new RangeError('End date must be >= start date');
// Very basic fallback for old browsers.
return `${this.formatter.format(start)} \u{2013} ${this.formatter.format(end)}`;
}
/** Formats a date range as an array of parts. */ formatRangeToParts(start, end) {
// @ts-ignore
if (typeof this.formatter.formatRangeToParts === 'function') // @ts-ignore
return this.formatter.formatRangeToParts(start, end);
if (end < start) throw new RangeError('End date must be >= start date');
let startParts = this.formatter.formatToParts(start);
let endParts = this.formatter.formatToParts(end);
return [
...startParts.map((p)=>({
...p,
source: 'startRange'
})),
{
type: 'literal',
value: " \u2013 ",
source: 'shared'
},
...endParts.map((p)=>({
...p,
source: 'endRange'
}))
];
}
/** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
let resolvedOptions = this.formatter.resolvedOptions();
if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
resolvedOptions.hourCycle = this.resolvedHourCycle;
resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
}
// Safari uses a different name for the Ethiopic (Amete Alem) calendar.
// https://bugs.webkit.org/show_bug.cgi?id=241564
if (resolvedOptions.calendar === 'ethiopic-amete-alem') resolvedOptions.calendar = 'ethioaa';
return resolvedOptions;
}
constructor(locale, options = {}){
this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
this.options = options;
}
}
// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)
// rather than h12 (12:00 - 11:59).
// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal
// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]
// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791
// [2] https://github.com/tc39/ecma402/issues/402
// [3] https://bugs.webkit.org/show_bug.cgi?id=229313
// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
const $fb18d541ea1ad717$var$hour12Preferences = {
true: {
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
ja: 'h11'
},
false: {
}
};
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
// Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
// Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
if (typeof options.hour12 === 'boolean' && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
options = {
...options
};
let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
delete options.hour12;
}
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
let numberFormatter = new Intl.DateTimeFormat(locale, options);
$fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
return numberFormatter;
}
let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
hour12: false
}).format(new Date(2020, 2, 3, 0)) === '24';
return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
}
let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
hour: 'numeric',
hour12: false
}).resolvedOptions().hourCycle === 'h12';
return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
}
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
if (!options.timeStyle && !options.hour) return undefined;
// Work around buggy results in resolved hourCycle and hour12 options in WebKit.
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
...options,
timeZone: undefined // use local timezone
});
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p)=>p.type === 'hour').value, 10);
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p)=>p.type === 'hour').value, 10);
if (min === 0 && max === 23) return 'h23';
if (min === 24 && max === 23) return 'h24';
if (min === 0 && max === 11) return 'h11';
if (min === 12 && max === 11) return 'h12';
throw new Error('Unexpected hour cycle result');
}
export {$fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
//# sourceMappingURL=DateFormatter.module.js.map

View File

@@ -0,0 +1,140 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ let $fb18d541ea1ad717$var$formatterCache = new Map();
class $fb18d541ea1ad717$export$ad991b66133851cf {
/** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
return this.formatter.format(value);
}
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) {
return this.formatter.formatToParts(value);
}
/** Formats a date range as a string. */ formatRange(start, end) {
// @ts-ignore
if (typeof this.formatter.formatRange === 'function') // @ts-ignore
return this.formatter.formatRange(start, end);
if (end < start) throw new RangeError('End date must be >= start date');
// Very basic fallback for old browsers.
return `${this.formatter.format(start)} \u{2013} ${this.formatter.format(end)}`;
}
/** Formats a date range as an array of parts. */ formatRangeToParts(start, end) {
// @ts-ignore
if (typeof this.formatter.formatRangeToParts === 'function') // @ts-ignore
return this.formatter.formatRangeToParts(start, end);
if (end < start) throw new RangeError('End date must be >= start date');
let startParts = this.formatter.formatToParts(start);
let endParts = this.formatter.formatToParts(end);
return [
...startParts.map((p)=>({
...p,
source: 'startRange'
})),
{
type: 'literal',
value: " \u2013 ",
source: 'shared'
},
...endParts.map((p)=>({
...p,
source: 'endRange'
}))
];
}
/** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
let resolvedOptions = this.formatter.resolvedOptions();
if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
resolvedOptions.hourCycle = this.resolvedHourCycle;
resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
}
// Safari uses a different name for the Ethiopic (Amete Alem) calendar.
// https://bugs.webkit.org/show_bug.cgi?id=241564
if (resolvedOptions.calendar === 'ethiopic-amete-alem') resolvedOptions.calendar = 'ethioaa';
return resolvedOptions;
}
constructor(locale, options = {}){
this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
this.options = options;
}
}
// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)
// rather than h12 (12:00 - 11:59).
// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal
// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]
// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791
// [2] https://github.com/tc39/ecma402/issues/402
// [3] https://bugs.webkit.org/show_bug.cgi?id=229313
// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
const $fb18d541ea1ad717$var$hour12Preferences = {
true: {
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
ja: 'h11'
},
false: {
}
};
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
// Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
// Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
if (typeof options.hour12 === 'boolean' && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
options = {
...options
};
let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
delete options.hour12;
}
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
let numberFormatter = new Intl.DateTimeFormat(locale, options);
$fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
return numberFormatter;
}
let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
hour12: false
}).format(new Date(2020, 2, 3, 0)) === '24';
return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
}
let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
hour: 'numeric',
hour12: false
}).resolvedOptions().hourCycle === 'h12';
return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
}
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
if (!options.timeStyle && !options.hour) return undefined;
// Work around buggy results in resolved hourCycle and hour12 options in WebKit.
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
...options,
timeZone: undefined // use local timezone
});
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p)=>p.type === 'hour').value, 10);
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p)=>p.type === 'hour').value, 10);
if (min === 0 && max === 23) return 'h23';
if (min === 24 && max === 23) return 'h24';
if (min === 0 && max === 11) return 'h11';
if (min === 12 && max === 11) return 'h12';
throw new Error('Unexpected hour cycle result');
}
export {$fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
//# sourceMappingURL=DateFormatter.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,170 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "EthiopicCalendar", () => $4db04d1051af0f2f$export$26ba6eab5e20cd7d);
$parcel$export(module.exports, "EthiopicAmeteAlemCalendar", () => $4db04d1051af0f2f$export$d72e0c37005a4914);
$parcel$export(module.exports, "CopticCalendar", () => $4db04d1051af0f2f$export$fe6243cbe1a4b7c1);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $4db04d1051af0f2f$var$ETHIOPIC_EPOCH = 1723856;
const $4db04d1051af0f2f$var$COPTIC_EPOCH = 1824665;
// The delta between Amete Alem 1 and Amete Mihret 1
// AA 5501 = AM 1
const $4db04d1051af0f2f$var$AMETE_MIHRET_DELTA = 5500;
function $4db04d1051af0f2f$var$ceToJulianDay(epoch, year, month, day) {
return epoch // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ Math.floor(year / 4) // extra day of leap year
+ 30 * (month - 1 // number of days from months (1 based)
) + day - 1 // number of days for present month (1 based)
;
}
function $4db04d1051af0f2f$var$julianDayToCE(epoch, jd) {
let year = Math.floor(4 * (jd - epoch) / 1461);
let month = 1 + Math.floor((jd - $4db04d1051af0f2f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
let day = jd + 1 - $4db04d1051af0f2f$var$ceToJulianDay(epoch, year, month, 1);
return [
year,
month,
day
];
}
function $4db04d1051af0f2f$var$getLeapDay(year) {
return Math.floor(year % 4 / 3);
}
function $4db04d1051af0f2f$var$getDaysInMonth(year, month) {
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
// an intercalary month at the end of the year of 5 or 6 days, depending whether
// the year is a leap year or not. The Leap Year follows the same rules as the
// Julian Calendar so that the extra month always has six days in the year before
// a Julian Leap Year.
if (month % 13 !== 0) // not intercalary month
return 30;
else // intercalary month 5 days + possible leap day
return $4db04d1051af0f2f$var$getLeapDay(year) + 5;
}
class $4db04d1051af0f2f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $4db04d1051af0f2f$var$julianDayToCE($4db04d1051af0f2f$var$ETHIOPIC_EPOCH, jd);
let era = 'AM';
if (year <= 0) {
era = 'AA';
year += $4db04d1051af0f2f$var$AMETE_MIHRET_DELTA;
}
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'AA') year -= $4db04d1051af0f2f$var$AMETE_MIHRET_DELTA;
return $4db04d1051af0f2f$var$ceToJulianDay($4db04d1051af0f2f$var$ETHIOPIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
return $4db04d1051af0f2f$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear() {
return 13;
}
getDaysInYear(date) {
return 365 + $4db04d1051af0f2f$var$getLeapDay(date.year);
}
getYearsInEra(date) {
// 9999-12-31 gregorian is 9992-20-02 ethiopic.
// Round down to 9991 for the last full year.
// AA 9999-01-01 ethiopic is 4506-09-30 gregorian.
return date.era === 'AA' ? 9999 : 9991;
}
getEras() {
return [
'AA',
'AM'
];
}
constructor(){
this.identifier = 'ethiopic';
}
}
class $4db04d1051af0f2f$export$d72e0c37005a4914 extends $4db04d1051af0f2f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $4db04d1051af0f2f$var$julianDayToCE($4db04d1051af0f2f$var$ETHIOPIC_EPOCH, jd);
year += $4db04d1051af0f2f$var$AMETE_MIHRET_DELTA;
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, 'AA', year, month, day);
}
getEras() {
return [
'AA'
];
}
getYearsInEra() {
// 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.
return 9999;
}
constructor(...args){
super(...args);
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
;
}
}
class $4db04d1051af0f2f$export$fe6243cbe1a4b7c1 extends $4db04d1051af0f2f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $4db04d1051af0f2f$var$julianDayToCE($4db04d1051af0f2f$var$COPTIC_EPOCH, jd);
let era = 'CE';
if (year <= 0) {
era = 'BCE';
year = 1 - year;
}
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $4db04d1051af0f2f$var$ceToJulianDay($4db04d1051af0f2f$var$COPTIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $4db04d1051af0f2f$var$getDaysInMonth(year, date.month);
}
isInverseEra(date) {
return date.era === 'BCE';
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === 'BCE' ? 'CE' : 'BCE';
date.year = 1 - date.year;
}
}
getEras() {
return [
'BCE',
'CE'
];
}
getYearsInEra(date) {
// 9999-12-30 gregorian is 9716-02-20 coptic.
// Round down to 9715 for the last full year.
// BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.
return date.era === 'BCE' ? 9999 : 9715;
}
constructor(...args){
super(...args);
this.identifier = 'coptic';
}
}
//# sourceMappingURL=EthiopicCalendar.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,163 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
// The delta between Amete Alem 1 and Amete Mihret 1
// AA 5501 = AM 1
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
return epoch // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ Math.floor(year / 4) // extra day of leap year
+ 30 * (month - 1 // number of days from months (1 based)
) + day - 1 // number of days for present month (1 based)
;
}
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd) {
let year = Math.floor(4 * (jd - epoch) / 1461);
let month = 1 + Math.floor((jd - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
let day = jd + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
return [
year,
month,
day
];
}
function $b956b2d7a6cf451f$var$getLeapDay(year) {
return Math.floor(year % 4 / 3);
}
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
// an intercalary month at the end of the year of 5 or 6 days, depending whether
// the year is a leap year or not. The Leap Year follows the same rules as the
// Julian Calendar so that the extra month always has six days in the year before
// a Julian Leap Year.
if (month % 13 !== 0) // not intercalary month
return 30;
else // intercalary month 5 days + possible leap day
return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
}
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
let era = 'AM';
if (year <= 0) {
era = 'AA';
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'AA') year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
return $b956b2d7a6cf451f$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear() {
return 13;
}
getDaysInYear(date) {
return 365 + $b956b2d7a6cf451f$var$getLeapDay(date.year);
}
getYearsInEra(date) {
// 9999-12-31 gregorian is 9992-20-02 ethiopic.
// Round down to 9991 for the last full year.
// AA 9999-01-01 ethiopic is 4506-09-30 gregorian.
return date.era === 'AA' ? 9999 : 9991;
}
getEras() {
return [
'AA',
'AM'
];
}
constructor(){
this.identifier = 'ethiopic';
}
}
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, 'AA', year, month, day);
}
getEras() {
return [
'AA'
];
}
getYearsInEra() {
// 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.
return 9999;
}
constructor(...args){
super(...args);
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
;
}
}
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd);
let era = 'CE';
if (year <= 0) {
era = 'BCE';
year = 1 - year;
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $b956b2d7a6cf451f$var$getDaysInMonth(year, date.month);
}
isInverseEra(date) {
return date.era === 'BCE';
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === 'BCE' ? 'CE' : 'BCE';
date.year = 1 - date.year;
}
}
getEras() {
return [
'BCE',
'CE'
];
}
getYearsInEra(date) {
// 9999-12-30 gregorian is 9716-02-20 coptic.
// Round down to 9715 for the last full year.
// BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.
return date.era === 'BCE' ? 9999 : 9715;
}
constructor(...args){
super(...args);
this.identifier = 'coptic';
}
}
export {$b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar};
//# sourceMappingURL=EthiopicCalendar.module.js.map

View File

@@ -0,0 +1,163 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
// The delta between Amete Alem 1 and Amete Mihret 1
// AA 5501 = AM 1
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
return epoch // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ Math.floor(year / 4) // extra day of leap year
+ 30 * (month - 1 // number of days from months (1 based)
) + day - 1 // number of days for present month (1 based)
;
}
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd) {
let year = Math.floor(4 * (jd - epoch) / 1461);
let month = 1 + Math.floor((jd - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
let day = jd + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
return [
year,
month,
day
];
}
function $b956b2d7a6cf451f$var$getLeapDay(year) {
return Math.floor(year % 4 / 3);
}
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
// an intercalary month at the end of the year of 5 or 6 days, depending whether
// the year is a leap year or not. The Leap Year follows the same rules as the
// Julian Calendar so that the extra month always has six days in the year before
// a Julian Leap Year.
if (month % 13 !== 0) // not intercalary month
return 30;
else // intercalary month 5 days + possible leap day
return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
}
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
let era = 'AM';
if (year <= 0) {
era = 'AA';
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'AA') year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
return $b956b2d7a6cf451f$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear() {
return 13;
}
getDaysInYear(date) {
return 365 + $b956b2d7a6cf451f$var$getLeapDay(date.year);
}
getYearsInEra(date) {
// 9999-12-31 gregorian is 9992-20-02 ethiopic.
// Round down to 9991 for the last full year.
// AA 9999-01-01 ethiopic is 4506-09-30 gregorian.
return date.era === 'AA' ? 9999 : 9991;
}
getEras() {
return [
'AA',
'AM'
];
}
constructor(){
this.identifier = 'ethiopic';
}
}
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, 'AA', year, month, day);
}
getEras() {
return [
'AA'
];
}
getYearsInEra() {
// 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.
return 9999;
}
constructor(...args){
super(...args);
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
;
}
}
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd);
let era = 'CE';
if (year <= 0) {
era = 'BCE';
year = 1 - year;
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $b956b2d7a6cf451f$var$getDaysInMonth(year, date.month);
}
isInverseEra(date) {
return date.era === 'BCE';
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === 'BCE' ? 'CE' : 'BCE';
date.year = 1 - date.year;
}
}
getEras() {
return [
'BCE',
'CE'
];
}
getYearsInEra(date) {
// 9999-12-30 gregorian is 9716-02-20 coptic.
// Round down to 9715 for the last full year.
// BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.
return date.era === 'BCE' ? 9999 : 9715;
}
constructor(...args){
super(...args);
this.identifier = 'coptic';
}
}
export {$b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar};
//# sourceMappingURL=EthiopicCalendar.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,143 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $a5090d6430502238$exports = require("./utils.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "gregorianToJulianDay", () => $af14c9812fdceb33$export$f297eb839006d339);
$parcel$export(module.exports, "getExtendedYear", () => $af14c9812fdceb33$export$c36e0ecb2d4fa69d);
$parcel$export(module.exports, "isLeapYear", () => $af14c9812fdceb33$export$553d7fa8e3805fc0);
$parcel$export(module.exports, "fromExtendedYear", () => $af14c9812fdceb33$export$4475b7e617eb123c);
$parcel$export(module.exports, "GregorianCalendar", () => $af14c9812fdceb33$export$80ee6245ec4f29ec);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $af14c9812fdceb33$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
function $af14c9812fdceb33$export$f297eb839006d339(era, year, month, day) {
year = $af14c9812fdceb33$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($af14c9812fdceb33$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $af14c9812fdceb33$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
}
function $af14c9812fdceb33$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $af14c9812fdceb33$export$c36e0ecb2d4fa69d(era, year) {
return era === 'BC' ? 1 - year : year;
}
function $af14c9812fdceb33$export$4475b7e617eb123c(year) {
let era = 'AD';
if (year <= 0) {
era = 'BC';
year = 1 - year;
}
return [
era,
year
];
}
const $af14c9812fdceb33$var$daysInMonth = {
standard: [
31,
28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
],
leapyear: [
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
]
};
class $af14c9812fdceb33$export$80ee6245ec4f29ec {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $af14c9812fdceb33$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = (0, $a5090d6430502238$exports.mod)(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = (0, $a5090d6430502238$exports.mod)(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = (0, $a5090d6430502238$exports.mod)(dcent, 1461);
let yindex = Math.floor(dquad / 365);
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
let [era, year] = $af14c9812fdceb33$export$4475b7e617eb123c(extendedYear);
let yearDay = jd0 - $af14c9812fdceb33$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $af14c9812fdceb33$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($af14c9812fdceb33$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
let day = jd0 - $af14c9812fdceb33$export$f297eb839006d339(era, year, month, 1) + 1;
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(era, year, month, day);
}
toJulianDay(date) {
return $af14c9812fdceb33$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $af14c9812fdceb33$var$daysInMonth[$af14c9812fdceb33$export$553d7fa8e3805fc0(date.year) ? 'leapyear' : 'standard'][date.month - 1];
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getMonthsInYear(date) {
return 12;
}
getDaysInYear(date) {
return $af14c9812fdceb33$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getYearsInEra(date) {
return 9999;
}
getEras() {
return [
'BC',
'AD'
];
}
isInverseEra(date) {
return date.era === 'BC';
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === 'BC' ? 'AD' : 'BC';
date.year = 1 - date.year;
}
}
constructor(){
this.identifier = 'gregory';
}
}
//# sourceMappingURL=GregorianCalendar.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,134 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $3b62074eb05584b2$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
}
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
return era === 'BC' ? 1 - year : year;
}
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
let era = 'AD';
if (year <= 0) {
era = 'BC';
year = 1 - year;
}
return [
era,
year
];
}
const $3b62074eb05584b2$var$daysInMonth = {
standard: [
31,
28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
],
leapyear: [
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
]
};
class $3b62074eb05584b2$export$80ee6245ec4f29ec {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dcent, 1461);
let yindex = Math.floor(dquad / 365);
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, month, day);
}
toJulianDay(date) {
return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 'leapyear' : 'standard'][date.month - 1];
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getMonthsInYear(date) {
return 12;
}
getDaysInYear(date) {
return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getYearsInEra(date) {
return 9999;
}
getEras() {
return [
'BC',
'AD'
];
}
isInverseEra(date) {
return date.era === 'BC';
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === 'BC' ? 'AD' : 'BC';
date.year = 1 - date.year;
}
}
constructor(){
this.identifier = 'gregory';
}
}
export {$3b62074eb05584b2$export$f297eb839006d339 as gregorianToJulianDay, $3b62074eb05584b2$export$c36e0ecb2d4fa69d as getExtendedYear, $3b62074eb05584b2$export$553d7fa8e3805fc0 as isLeapYear, $3b62074eb05584b2$export$4475b7e617eb123c as fromExtendedYear, $3b62074eb05584b2$export$80ee6245ec4f29ec as GregorianCalendar};
//# sourceMappingURL=GregorianCalendar.module.js.map

View File

@@ -0,0 +1,134 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $3b62074eb05584b2$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
}
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
return era === 'BC' ? 1 - year : year;
}
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
let era = 'AD';
if (year <= 0) {
era = 'BC';
year = 1 - year;
}
return [
era,
year
];
}
const $3b62074eb05584b2$var$daysInMonth = {
standard: [
31,
28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
],
leapyear: [
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
]
};
class $3b62074eb05584b2$export$80ee6245ec4f29ec {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dcent, 1461);
let yindex = Math.floor(dquad / 365);
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, month, day);
}
toJulianDay(date) {
return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 'leapyear' : 'standard'][date.month - 1];
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getMonthsInYear(date) {
return 12;
}
getDaysInYear(date) {
return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getYearsInEra(date) {
return 9999;
}
getEras() {
return [
'BC',
'AD'
];
}
isInverseEra(date) {
return date.era === 'BC';
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === 'BC' ? 'AD' : 'BC';
date.year = 1 - date.year;
}
}
constructor(){
this.identifier = 'gregory';
}
}
export {$3b62074eb05584b2$export$f297eb839006d339 as gregorianToJulianDay, $3b62074eb05584b2$export$c36e0ecb2d4fa69d as getExtendedYear, $3b62074eb05584b2$export$553d7fa8e3805fc0 as isLeapYear, $3b62074eb05584b2$export$4475b7e617eb123c as fromExtendedYear, $3b62074eb05584b2$export$80ee6245ec4f29ec as GregorianCalendar};
//# sourceMappingURL=GregorianCalendar.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,149 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $a5090d6430502238$exports = require("./utils.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "HebrewCalendar", () => $0f5324ee3bdd9396$export$ca405048b8fb5af);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $0f5324ee3bdd9396$var$HEBREW_EPOCH = 347997;
// Hebrew date calculations are performed in terms of days, hours, and
// "parts" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.
const $0f5324ee3bdd9396$var$HOUR_PARTS = 1080;
const $0f5324ee3bdd9396$var$DAY_PARTS = 24 * $0f5324ee3bdd9396$var$HOUR_PARTS;
// An approximate value for the length of a lunar month.
// It is used to calculate the approximate year and month of a given
// absolute date.
const $0f5324ee3bdd9396$var$MONTH_DAYS = 29;
const $0f5324ee3bdd9396$var$MONTH_FRACT = 12 * $0f5324ee3bdd9396$var$HOUR_PARTS + 793;
const $0f5324ee3bdd9396$var$MONTH_PARTS = $0f5324ee3bdd9396$var$MONTH_DAYS * $0f5324ee3bdd9396$var$DAY_PARTS + $0f5324ee3bdd9396$var$MONTH_FRACT;
function $0f5324ee3bdd9396$var$isLeapYear(year) {
return (0, $a5090d6430502238$exports.mod)(year * 7 + 1, 19) < 7;
}
// Test for delay of start of new year and to avoid
// Sunday, Wednesday, and Friday as start of the new year.
function $0f5324ee3bdd9396$var$hebrewDelay1(year) {
let months = Math.floor((235 * year - 234) / 19);
let parts = 12084 + 13753 * months;
let day = months * 29 + Math.floor(parts / 25920);
if ((0, $a5090d6430502238$exports.mod)(3 * (day + 1), 7) < 3) day += 1;
return day;
}
// Check for delay in start of new year due to length of adjacent years
function $0f5324ee3bdd9396$var$hebrewDelay2(year) {
let last = $0f5324ee3bdd9396$var$hebrewDelay1(year - 1);
let present = $0f5324ee3bdd9396$var$hebrewDelay1(year);
let next = $0f5324ee3bdd9396$var$hebrewDelay1(year + 1);
if (next - present === 356) return 2;
if (present - last === 382) return 1;
return 0;
}
function $0f5324ee3bdd9396$var$startOfYear(year) {
return $0f5324ee3bdd9396$var$hebrewDelay1(year) + $0f5324ee3bdd9396$var$hebrewDelay2(year);
}
function $0f5324ee3bdd9396$var$getDaysInYear(year) {
return $0f5324ee3bdd9396$var$startOfYear(year + 1) - $0f5324ee3bdd9396$var$startOfYear(year);
}
function $0f5324ee3bdd9396$var$getYearType(year) {
let yearLength = $0f5324ee3bdd9396$var$getDaysInYear(year);
if (yearLength > 380) yearLength -= 30; // Subtract length of leap month.
switch(yearLength){
case 353:
return 0; // deficient
case 354:
return 1; // normal
case 355:
return 2; // complete
}
}
function $0f5324ee3bdd9396$var$getDaysInMonth(year, month) {
// Normalize month numbers from 1 - 13, even on non-leap years
if (month >= 6 && !$0f5324ee3bdd9396$var$isLeapYear(year)) month++;
// First of all, dispose of fixed-length 29 day months
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) return 29;
let yearType = $0f5324ee3bdd9396$var$getYearType(year);
// If it's Heshvan, days depend on length of year
if (month === 2) return yearType === 2 ? 30 : 29;
// Similarly, Kislev varies with the length of year
if (month === 3) return yearType === 0 ? 29 : 30;
// Adar I only exists in leap years
if (month === 6) return $0f5324ee3bdd9396$var$isLeapYear(year) ? 30 : 0;
return 30;
}
class $0f5324ee3bdd9396$export$ca405048b8fb5af {
fromJulianDay(jd) {
let d = jd - $0f5324ee3bdd9396$var$HEBREW_EPOCH;
let m = d * $0f5324ee3bdd9396$var$DAY_PARTS / $0f5324ee3bdd9396$var$MONTH_PARTS; // Months (approx)
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
let ys = $0f5324ee3bdd9396$var$startOfYear(year); // 1st day of year
let dayOfYear = Math.floor(d - ys);
// Because of the postponement rules, it's possible to guess wrong. Fix it.
while(dayOfYear < 1){
year--;
ys = $0f5324ee3bdd9396$var$startOfYear(year);
dayOfYear = Math.floor(d - ys);
}
// Now figure out which month we're in, and the date within that month
let month = 1;
let monthStart = 0;
while(monthStart < dayOfYear){
monthStart += $0f5324ee3bdd9396$var$getDaysInMonth(year, month);
month++;
}
month--;
monthStart -= $0f5324ee3bdd9396$var$getDaysInMonth(year, month);
let day = dayOfYear - monthStart;
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, year, month, day);
}
toJulianDay(date) {
let jd = $0f5324ee3bdd9396$var$startOfYear(date.year);
for(let month = 1; month < date.month; month++)jd += $0f5324ee3bdd9396$var$getDaysInMonth(date.year, month);
return jd + date.day + $0f5324ee3bdd9396$var$HEBREW_EPOCH;
}
getDaysInMonth(date) {
return $0f5324ee3bdd9396$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear(date) {
return $0f5324ee3bdd9396$var$isLeapYear(date.year) ? 13 : 12;
}
getDaysInYear(date) {
return $0f5324ee3bdd9396$var$getDaysInYear(date.year);
}
getYearsInEra() {
// 6239 gregorian
return 9999;
}
getEras() {
return [
'AM'
];
}
balanceYearMonth(date, previousDate) {
// Keep date in the same month when switching between leap years and non leap years
if (previousDate.year !== date.year) {
if ($0f5324ee3bdd9396$var$isLeapYear(previousDate.year) && !$0f5324ee3bdd9396$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
else if (!$0f5324ee3bdd9396$var$isLeapYear(previousDate.year) && $0f5324ee3bdd9396$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
}
}
constructor(){
this.identifier = 'hebrew';
}
}
//# sourceMappingURL=HebrewCalendar.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,144 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $7c5f6fbf42389787$var$HEBREW_EPOCH = 347997;
// Hebrew date calculations are performed in terms of days, hours, and
// "parts" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.
const $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
const $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
// An approximate value for the length of a lunar month.
// It is used to calculate the approximate year and month of a given
// absolute date.
const $7c5f6fbf42389787$var$MONTH_DAYS = 29;
const $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
const $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
function $7c5f6fbf42389787$var$isLeapYear(year) {
return (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(year * 7 + 1, 19) < 7;
}
// Test for delay of start of new year and to avoid
// Sunday, Wednesday, and Friday as start of the new year.
function $7c5f6fbf42389787$var$hebrewDelay1(year) {
let months = Math.floor((235 * year - 234) / 19);
let parts = 12084 + 13753 * months;
let day = months * 29 + Math.floor(parts / 25920);
if ((0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(3 * (day + 1), 7) < 3) day += 1;
return day;
}
// Check for delay in start of new year due to length of adjacent years
function $7c5f6fbf42389787$var$hebrewDelay2(year) {
let last = $7c5f6fbf42389787$var$hebrewDelay1(year - 1);
let present = $7c5f6fbf42389787$var$hebrewDelay1(year);
let next = $7c5f6fbf42389787$var$hebrewDelay1(year + 1);
if (next - present === 356) return 2;
if (present - last === 382) return 1;
return 0;
}
function $7c5f6fbf42389787$var$startOfYear(year) {
return $7c5f6fbf42389787$var$hebrewDelay1(year) + $7c5f6fbf42389787$var$hebrewDelay2(year);
}
function $7c5f6fbf42389787$var$getDaysInYear(year) {
return $7c5f6fbf42389787$var$startOfYear(year + 1) - $7c5f6fbf42389787$var$startOfYear(year);
}
function $7c5f6fbf42389787$var$getYearType(year) {
let yearLength = $7c5f6fbf42389787$var$getDaysInYear(year);
if (yearLength > 380) yearLength -= 30; // Subtract length of leap month.
switch(yearLength){
case 353:
return 0; // deficient
case 354:
return 1; // normal
case 355:
return 2; // complete
}
}
function $7c5f6fbf42389787$var$getDaysInMonth(year, month) {
// Normalize month numbers from 1 - 13, even on non-leap years
if (month >= 6 && !$7c5f6fbf42389787$var$isLeapYear(year)) month++;
// First of all, dispose of fixed-length 29 day months
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) return 29;
let yearType = $7c5f6fbf42389787$var$getYearType(year);
// If it's Heshvan, days depend on length of year
if (month === 2) return yearType === 2 ? 30 : 29;
// Similarly, Kislev varies with the length of year
if (month === 3) return yearType === 0 ? 29 : 30;
// Adar I only exists in leap years
if (month === 6) return $7c5f6fbf42389787$var$isLeapYear(year) ? 30 : 0;
return 30;
}
class $7c5f6fbf42389787$export$ca405048b8fb5af {
fromJulianDay(jd) {
let d = jd - $7c5f6fbf42389787$var$HEBREW_EPOCH;
let m = d * $7c5f6fbf42389787$var$DAY_PARTS / $7c5f6fbf42389787$var$MONTH_PARTS; // Months (approx)
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
let ys = $7c5f6fbf42389787$var$startOfYear(year); // 1st day of year
let dayOfYear = Math.floor(d - ys);
// Because of the postponement rules, it's possible to guess wrong. Fix it.
while(dayOfYear < 1){
year--;
ys = $7c5f6fbf42389787$var$startOfYear(year);
dayOfYear = Math.floor(d - ys);
}
// Now figure out which month we're in, and the date within that month
let month = 1;
let monthStart = 0;
while(monthStart < dayOfYear){
monthStart += $7c5f6fbf42389787$var$getDaysInMonth(year, month);
month++;
}
month--;
monthStart -= $7c5f6fbf42389787$var$getDaysInMonth(year, month);
let day = dayOfYear - monthStart;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month, day);
}
toJulianDay(date) {
let jd = $7c5f6fbf42389787$var$startOfYear(date.year);
for(let month = 1; month < date.month; month++)jd += $7c5f6fbf42389787$var$getDaysInMonth(date.year, month);
return jd + date.day + $7c5f6fbf42389787$var$HEBREW_EPOCH;
}
getDaysInMonth(date) {
return $7c5f6fbf42389787$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear(date) {
return $7c5f6fbf42389787$var$isLeapYear(date.year) ? 13 : 12;
}
getDaysInYear(date) {
return $7c5f6fbf42389787$var$getDaysInYear(date.year);
}
getYearsInEra() {
// 6239 gregorian
return 9999;
}
getEras() {
return [
'AM'
];
}
balanceYearMonth(date, previousDate) {
// Keep date in the same month when switching between leap years and non leap years
if (previousDate.year !== date.year) {
if ($7c5f6fbf42389787$var$isLeapYear(previousDate.year) && !$7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
else if (!$7c5f6fbf42389787$var$isLeapYear(previousDate.year) && $7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
}
}
constructor(){
this.identifier = 'hebrew';
}
}
export {$7c5f6fbf42389787$export$ca405048b8fb5af as HebrewCalendar};
//# sourceMappingURL=HebrewCalendar.module.js.map

View File

@@ -0,0 +1,144 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $7c5f6fbf42389787$var$HEBREW_EPOCH = 347997;
// Hebrew date calculations are performed in terms of days, hours, and
// "parts" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.
const $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
const $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
// An approximate value for the length of a lunar month.
// It is used to calculate the approximate year and month of a given
// absolute date.
const $7c5f6fbf42389787$var$MONTH_DAYS = 29;
const $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
const $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
function $7c5f6fbf42389787$var$isLeapYear(year) {
return (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(year * 7 + 1, 19) < 7;
}
// Test for delay of start of new year and to avoid
// Sunday, Wednesday, and Friday as start of the new year.
function $7c5f6fbf42389787$var$hebrewDelay1(year) {
let months = Math.floor((235 * year - 234) / 19);
let parts = 12084 + 13753 * months;
let day = months * 29 + Math.floor(parts / 25920);
if ((0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(3 * (day + 1), 7) < 3) day += 1;
return day;
}
// Check for delay in start of new year due to length of adjacent years
function $7c5f6fbf42389787$var$hebrewDelay2(year) {
let last = $7c5f6fbf42389787$var$hebrewDelay1(year - 1);
let present = $7c5f6fbf42389787$var$hebrewDelay1(year);
let next = $7c5f6fbf42389787$var$hebrewDelay1(year + 1);
if (next - present === 356) return 2;
if (present - last === 382) return 1;
return 0;
}
function $7c5f6fbf42389787$var$startOfYear(year) {
return $7c5f6fbf42389787$var$hebrewDelay1(year) + $7c5f6fbf42389787$var$hebrewDelay2(year);
}
function $7c5f6fbf42389787$var$getDaysInYear(year) {
return $7c5f6fbf42389787$var$startOfYear(year + 1) - $7c5f6fbf42389787$var$startOfYear(year);
}
function $7c5f6fbf42389787$var$getYearType(year) {
let yearLength = $7c5f6fbf42389787$var$getDaysInYear(year);
if (yearLength > 380) yearLength -= 30; // Subtract length of leap month.
switch(yearLength){
case 353:
return 0; // deficient
case 354:
return 1; // normal
case 355:
return 2; // complete
}
}
function $7c5f6fbf42389787$var$getDaysInMonth(year, month) {
// Normalize month numbers from 1 - 13, even on non-leap years
if (month >= 6 && !$7c5f6fbf42389787$var$isLeapYear(year)) month++;
// First of all, dispose of fixed-length 29 day months
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) return 29;
let yearType = $7c5f6fbf42389787$var$getYearType(year);
// If it's Heshvan, days depend on length of year
if (month === 2) return yearType === 2 ? 30 : 29;
// Similarly, Kislev varies with the length of year
if (month === 3) return yearType === 0 ? 29 : 30;
// Adar I only exists in leap years
if (month === 6) return $7c5f6fbf42389787$var$isLeapYear(year) ? 30 : 0;
return 30;
}
class $7c5f6fbf42389787$export$ca405048b8fb5af {
fromJulianDay(jd) {
let d = jd - $7c5f6fbf42389787$var$HEBREW_EPOCH;
let m = d * $7c5f6fbf42389787$var$DAY_PARTS / $7c5f6fbf42389787$var$MONTH_PARTS; // Months (approx)
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
let ys = $7c5f6fbf42389787$var$startOfYear(year); // 1st day of year
let dayOfYear = Math.floor(d - ys);
// Because of the postponement rules, it's possible to guess wrong. Fix it.
while(dayOfYear < 1){
year--;
ys = $7c5f6fbf42389787$var$startOfYear(year);
dayOfYear = Math.floor(d - ys);
}
// Now figure out which month we're in, and the date within that month
let month = 1;
let monthStart = 0;
while(monthStart < dayOfYear){
monthStart += $7c5f6fbf42389787$var$getDaysInMonth(year, month);
month++;
}
month--;
monthStart -= $7c5f6fbf42389787$var$getDaysInMonth(year, month);
let day = dayOfYear - monthStart;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month, day);
}
toJulianDay(date) {
let jd = $7c5f6fbf42389787$var$startOfYear(date.year);
for(let month = 1; month < date.month; month++)jd += $7c5f6fbf42389787$var$getDaysInMonth(date.year, month);
return jd + date.day + $7c5f6fbf42389787$var$HEBREW_EPOCH;
}
getDaysInMonth(date) {
return $7c5f6fbf42389787$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear(date) {
return $7c5f6fbf42389787$var$isLeapYear(date.year) ? 13 : 12;
}
getDaysInYear(date) {
return $7c5f6fbf42389787$var$getDaysInYear(date.year);
}
getYearsInEra() {
// 6239 gregorian
return 9999;
}
getEras() {
return [
'AM'
];
}
balanceYearMonth(date, previousDate) {
// Keep date in the same month when switching between leap years and non leap years
if (previousDate.year !== date.year) {
if ($7c5f6fbf42389787$var$isLeapYear(previousDate.year) && !$7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
else if (!$7c5f6fbf42389787$var$isLeapYear(previousDate.year) && $7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
}
}
constructor(){
this.identifier = 'hebrew';
}
}
export {$7c5f6fbf42389787$export$ca405048b8fb5af as HebrewCalendar};
//# sourceMappingURL=HebrewCalendar.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,107 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "IndianCalendar", () => $5f1dfa5c67609fe6$export$39f31c639fa15726);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
// Starts in 78 AD,
const $5f1dfa5c67609fe6$var$INDIAN_ERA_START = 78;
// The Indian year starts 80 days later than the Gregorian year.
const $5f1dfa5c67609fe6$var$INDIAN_YEAR_START = 80;
class $5f1dfa5c67609fe6$export$39f31c639fa15726 extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
fromJulianDay(jd) {
// Gregorian date for Julian day
let date = super.fromJulianDay(jd);
// Year in Saka era
let indianYear = date.year - $5f1dfa5c67609fe6$var$INDIAN_ERA_START;
// Day number in Gregorian year (starting from 0)
let yDay = jd - (0, $af14c9812fdceb33$exports.gregorianToJulianDay)(date.era, date.year, 1, 1);
let leapMonth;
if (yDay < $5f1dfa5c67609fe6$var$INDIAN_YEAR_START) {
// Day is at the end of the preceding Saka year
indianYear--;
// Days in leapMonth this year, previous Gregorian year
leapMonth = (0, $af14c9812fdceb33$exports.isLeapYear)(date.year - 1) ? 31 : 30;
yDay += leapMonth + 155 + 90 + 10;
} else {
// Days in leapMonth this year
leapMonth = (0, $af14c9812fdceb33$exports.isLeapYear)(date.year) ? 31 : 30;
yDay -= $5f1dfa5c67609fe6$var$INDIAN_YEAR_START;
}
let indianMonth;
let indianDay;
if (yDay < leapMonth) {
indianMonth = 1;
indianDay = yDay + 1;
} else {
let mDay = yDay - leapMonth;
if (mDay < 155) {
indianMonth = Math.floor(mDay / 31) + 2;
indianDay = mDay % 31 + 1;
} else {
mDay -= 155;
indianMonth = Math.floor(mDay / 30) + 7;
indianDay = mDay % 30 + 1;
}
}
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, indianYear, indianMonth, indianDay);
}
toJulianDay(date) {
let extendedYear = date.year + $5f1dfa5c67609fe6$var$INDIAN_ERA_START;
let [era, year] = (0, $af14c9812fdceb33$exports.fromExtendedYear)(extendedYear);
let leapMonth;
let jd;
if ((0, $af14c9812fdceb33$exports.isLeapYear)(year)) {
leapMonth = 31;
jd = (0, $af14c9812fdceb33$exports.gregorianToJulianDay)(era, year, 3, 21);
} else {
leapMonth = 30;
jd = (0, $af14c9812fdceb33$exports.gregorianToJulianDay)(era, year, 3, 22);
}
if (date.month === 1) return jd + date.day - 1;
jd += leapMonth + Math.min(date.month - 2, 5) * 31;
if (date.month >= 8) jd += (date.month - 7) * 30;
jd += date.day - 1;
return jd;
}
getDaysInMonth(date) {
if (date.month === 1 && (0, $af14c9812fdceb33$exports.isLeapYear)(date.year + $5f1dfa5c67609fe6$var$INDIAN_ERA_START)) return 31;
if (date.month >= 2 && date.month <= 6) return 31;
return 30;
}
getYearsInEra() {
// 9999-12-31 gregorian is 9920-10-10 indian.
// Round down to 9919 for the last full year.
return 9919;
}
getEras() {
return [
'saka'
];
}
balanceDate() {}
constructor(...args){
super(...args);
this.identifier = 'indian';
}
}
//# sourceMappingURL=IndianCalendar.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,102 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec, gregorianToJulianDay as $3b62074eb05584b2$export$f297eb839006d339, isLeapYear as $3b62074eb05584b2$export$553d7fa8e3805fc0} from "./GregorianCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
// Starts in 78 AD,
const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
// The Indian year starts 80 days later than the Gregorian year.
const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
class $82c358003bdda0a8$export$39f31c639fa15726 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
// Gregorian date for Julian day
let date = super.fromJulianDay(jd);
// Year in Saka era
let indianYear = date.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
// Day number in Gregorian year (starting from 0)
let yDay = jd - (0, $3b62074eb05584b2$export$f297eb839006d339)(date.era, date.year, 1, 1);
let leapMonth;
if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
// Day is at the end of the preceding Saka year
indianYear--;
// Days in leapMonth this year, previous Gregorian year
leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year - 1) ? 31 : 30;
yDay += leapMonth + 155 + 90 + 10;
} else {
// Days in leapMonth this year
leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year) ? 31 : 30;
yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
}
let indianMonth;
let indianDay;
if (yDay < leapMonth) {
indianMonth = 1;
indianDay = yDay + 1;
} else {
let mDay = yDay - leapMonth;
if (mDay < 155) {
indianMonth = Math.floor(mDay / 31) + 2;
indianDay = mDay % 31 + 1;
} else {
mDay -= 155;
indianMonth = Math.floor(mDay / 30) + 7;
indianDay = mDay % 30 + 1;
}
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, indianYear, indianMonth, indianDay);
}
toJulianDay(date) {
let extendedYear = date.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)(extendedYear);
let leapMonth;
let jd;
if ((0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(year)) {
leapMonth = 31;
jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 21);
} else {
leapMonth = 30;
jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 22);
}
if (date.month === 1) return jd + date.day - 1;
jd += leapMonth + Math.min(date.month - 2, 5) * 31;
if (date.month >= 8) jd += (date.month - 7) * 30;
jd += date.day - 1;
return jd;
}
getDaysInMonth(date) {
if (date.month === 1 && (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year + $82c358003bdda0a8$var$INDIAN_ERA_START)) return 31;
if (date.month >= 2 && date.month <= 6) return 31;
return 30;
}
getYearsInEra() {
// 9999-12-31 gregorian is 9920-10-10 indian.
// Round down to 9919 for the last full year.
return 9919;
}
getEras() {
return [
'saka'
];
}
balanceDate() {}
constructor(...args){
super(...args);
this.identifier = 'indian';
}
}
export {$82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar};
//# sourceMappingURL=IndianCalendar.module.js.map

View File

@@ -0,0 +1,102 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec, gregorianToJulianDay as $3b62074eb05584b2$export$f297eb839006d339, isLeapYear as $3b62074eb05584b2$export$553d7fa8e3805fc0} from "./GregorianCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
// Starts in 78 AD,
const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
// The Indian year starts 80 days later than the Gregorian year.
const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
class $82c358003bdda0a8$export$39f31c639fa15726 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
// Gregorian date for Julian day
let date = super.fromJulianDay(jd);
// Year in Saka era
let indianYear = date.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
// Day number in Gregorian year (starting from 0)
let yDay = jd - (0, $3b62074eb05584b2$export$f297eb839006d339)(date.era, date.year, 1, 1);
let leapMonth;
if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
// Day is at the end of the preceding Saka year
indianYear--;
// Days in leapMonth this year, previous Gregorian year
leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year - 1) ? 31 : 30;
yDay += leapMonth + 155 + 90 + 10;
} else {
// Days in leapMonth this year
leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year) ? 31 : 30;
yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
}
let indianMonth;
let indianDay;
if (yDay < leapMonth) {
indianMonth = 1;
indianDay = yDay + 1;
} else {
let mDay = yDay - leapMonth;
if (mDay < 155) {
indianMonth = Math.floor(mDay / 31) + 2;
indianDay = mDay % 31 + 1;
} else {
mDay -= 155;
indianMonth = Math.floor(mDay / 30) + 7;
indianDay = mDay % 30 + 1;
}
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, indianYear, indianMonth, indianDay);
}
toJulianDay(date) {
let extendedYear = date.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)(extendedYear);
let leapMonth;
let jd;
if ((0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(year)) {
leapMonth = 31;
jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 21);
} else {
leapMonth = 30;
jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 22);
}
if (date.month === 1) return jd + date.day - 1;
jd += leapMonth + Math.min(date.month - 2, 5) * 31;
if (date.month >= 8) jd += (date.month - 7) * 30;
jd += date.day - 1;
return jd;
}
getDaysInMonth(date) {
if (date.month === 1 && (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year + $82c358003bdda0a8$var$INDIAN_ERA_START)) return 31;
if (date.month >= 2 && date.month <= 6) return 31;
return 30;
}
getYearsInEra() {
// 9999-12-31 gregorian is 9920-10-10 indian.
// Round down to 9919 for the last full year.
return 9919;
}
getEras() {
return [
'saka'
];
}
balanceDate() {}
constructor(...args){
super(...args);
this.identifier = 'indian';
}
}
export {$82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar};
//# sourceMappingURL=IndianCalendar.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,164 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "IslamicCivilCalendar", () => $ecb2c4cc8c9aae25$export$2066795aadd37bfc);
$parcel$export(module.exports, "IslamicTabularCalendar", () => $ecb2c4cc8c9aae25$export$37f0887f2f9d22f7);
$parcel$export(module.exports, "IslamicUmalquraCalendar", () => $ecb2c4cc8c9aae25$export$5baab4758c231076);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $ecb2c4cc8c9aae25$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
const $ecb2c4cc8c9aae25$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
const $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START = 1300;
const $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END = 1600;
const $ecb2c4cc8c9aae25$var$UMALQURA_START_DAYS = 460322;
function $ecb2c4cc8c9aae25$var$islamicToJulianDay(epoch, year, month, day) {
return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
}
function $ecb2c4cc8c9aae25$var$julianDayToIslamic(calendar, epoch, jd) {
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
let month = Math.min(12, Math.ceil((jd - (29 + $ecb2c4cc8c9aae25$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
let day = jd - $ecb2c4cc8c9aae25$var$islamicToJulianDay(epoch, year, month, 1) + 1;
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(calendar, year, month, day);
}
function $ecb2c4cc8c9aae25$var$isLeapYear(year) {
return (14 + 11 * year) % 30 < 11;
}
class $ecb2c4cc8c9aae25$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $ecb2c4cc8c9aae25$var$julianDayToIslamic(this, $ecb2c4cc8c9aae25$var$CIVIL_EPOC, jd);
}
toJulianDay(date) {
return $ecb2c4cc8c9aae25$var$islamicToJulianDay($ecb2c4cc8c9aae25$var$CIVIL_EPOC, date.year, date.month, date.day);
}
getDaysInMonth(date) {
let length = 29 + date.month % 2;
if (date.month === 12 && $ecb2c4cc8c9aae25$var$isLeapYear(date.year)) length++;
return length;
}
getMonthsInYear() {
return 12;
}
getDaysInYear(date) {
return $ecb2c4cc8c9aae25$var$isLeapYear(date.year) ? 355 : 354;
}
getYearsInEra() {
// 9999 gregorian
return 9665;
}
getEras() {
return [
'AH'
];
}
constructor(){
this.identifier = 'islamic-civil';
}
}
class $ecb2c4cc8c9aae25$export$37f0887f2f9d22f7 extends $ecb2c4cc8c9aae25$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $ecb2c4cc8c9aae25$var$julianDayToIslamic(this, $ecb2c4cc8c9aae25$var$ASTRONOMICAL_EPOC, jd);
}
toJulianDay(date) {
return $ecb2c4cc8c9aae25$var$islamicToJulianDay($ecb2c4cc8c9aae25$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
}
constructor(...args){
super(...args);
this.identifier = 'islamic-tbla';
}
}
// Generated by scripts/generate-umalqura.js
const $ecb2c4cc8c9aae25$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
let $ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH;
let $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE;
function $ecb2c4cc8c9aae25$var$umalquraYearStart(year) {
return $ecb2c4cc8c9aae25$var$UMALQURA_START_DAYS + $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START];
}
function $ecb2c4cc8c9aae25$var$umalquraMonthLength(year, month) {
let idx = year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START;
let mask = 0x01 << 11 - (month - 1);
if (($ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
else return 30;
}
function $ecb2c4cc8c9aae25$var$umalquraMonthStart(year, month) {
let day = $ecb2c4cc8c9aae25$var$umalquraYearStart(year);
for(let i = 1; i < month; i++)day += $ecb2c4cc8c9aae25$var$umalquraMonthLength(year, i);
return day;
}
function $ecb2c4cc8c9aae25$var$umalquraYearLength(year) {
return $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year + 1 - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START] - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START];
}
class $ecb2c4cc8c9aae25$export$5baab4758c231076 extends $ecb2c4cc8c9aae25$export$2066795aadd37bfc {
fromJulianDay(jd) {
let days = jd - $ecb2c4cc8c9aae25$var$CIVIL_EPOC;
let startDays = $ecb2c4cc8c9aae25$var$umalquraYearStart($ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START);
let endDays = $ecb2c4cc8c9aae25$var$umalquraYearStart($ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END);
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
else {
let y = $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START - 1;
let m = 1;
let d = 1;
while(d > 0){
y++;
d = days - $ecb2c4cc8c9aae25$var$umalquraYearStart(y) + 1;
let yearLength = $ecb2c4cc8c9aae25$var$umalquraYearLength(y);
if (d === yearLength) {
m = 12;
break;
} else if (d < yearLength) {
let monthLength = $ecb2c4cc8c9aae25$var$umalquraMonthLength(y, m);
m = 1;
while(d > monthLength){
d -= monthLength;
m++;
monthLength = $ecb2c4cc8c9aae25$var$umalquraMonthLength(y, m);
}
break;
}
}
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, y, m, days - $ecb2c4cc8c9aae25$var$umalquraMonthStart(y, m) + 1);
}
}
toJulianDay(date) {
if (date.year < $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START || date.year > $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
return $ecb2c4cc8c9aae25$var$CIVIL_EPOC + $ecb2c4cc8c9aae25$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
}
getDaysInMonth(date) {
if (date.year < $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START || date.year > $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
return $ecb2c4cc8c9aae25$var$umalquraMonthLength(date.year, date.month);
}
getDaysInYear(date) {
if (date.year < $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START || date.year > $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
return $ecb2c4cc8c9aae25$var$umalquraYearLength(date.year);
}
constructor(){
super();
this.identifier = 'islamic-umalqura';
if (!$ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH) $ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($ecb2c4cc8c9aae25$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
if (!$ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE) {
$ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START + 1);
let yearStart = 0;
for(let year = $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START; year <= $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END; year++){
$ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START] = yearStart;
for(let i = 1; i <= 12; i++)yearStart += $ecb2c4cc8c9aae25$var$umalquraMonthLength(year, i);
}
}
}
}
//# sourceMappingURL=IslamicCalendar.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,157 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $f2f3e0e3a817edbd$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
const $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START = 1300;
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END = 1600;
const $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS = 460322;
function $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, day) {
return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
}
function $f2f3e0e3a817edbd$var$julianDayToIslamic(calendar, epoch, jd) {
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
let month = Math.min(12, Math.ceil((jd - (29 + $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
let day = jd - $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, 1) + 1;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(calendar, year, month, day);
}
function $f2f3e0e3a817edbd$var$isLeapYear(year) {
return (14 + 11 * year) % 30 < 11;
}
class $f2f3e0e3a817edbd$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$CIVIL_EPOC, jd);
}
toJulianDay(date) {
return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$CIVIL_EPOC, date.year, date.month, date.day);
}
getDaysInMonth(date) {
let length = 29 + date.month % 2;
if (date.month === 12 && $f2f3e0e3a817edbd$var$isLeapYear(date.year)) length++;
return length;
}
getMonthsInYear() {
return 12;
}
getDaysInYear(date) {
return $f2f3e0e3a817edbd$var$isLeapYear(date.year) ? 355 : 354;
}
getYearsInEra() {
// 9999 gregorian
return 9665;
}
getEras() {
return [
'AH'
];
}
constructor(){
this.identifier = 'islamic-civil';
}
}
class $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, jd);
}
toJulianDay(date) {
return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
}
constructor(...args){
super(...args);
this.identifier = 'islamic-tbla';
}
}
// Generated by scripts/generate-umalqura.js
const $f2f3e0e3a817edbd$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
let $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH;
let $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE;
function $f2f3e0e3a817edbd$var$umalquraYearStart(year) {
return $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS + $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
function $f2f3e0e3a817edbd$var$umalquraMonthLength(year, month) {
let idx = year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START;
let mask = 0x01 << 11 - (month - 1);
if (($f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
else return 30;
}
function $f2f3e0e3a817edbd$var$umalquraMonthStart(year, month) {
let day = $f2f3e0e3a817edbd$var$umalquraYearStart(year);
for(let i = 1; i < month; i++)day += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i);
return day;
}
function $f2f3e0e3a817edbd$var$umalquraYearLength(year) {
return $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year + 1 - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
class $f2f3e0e3a817edbd$export$5baab4758c231076 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
fromJulianDay(jd) {
let days = jd - $f2f3e0e3a817edbd$var$CIVIL_EPOC;
let startDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_START);
let endDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END);
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
else {
let y = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START - 1;
let m = 1;
let d = 1;
while(d > 0){
y++;
d = days - $f2f3e0e3a817edbd$var$umalquraYearStart(y) + 1;
let yearLength = $f2f3e0e3a817edbd$var$umalquraYearLength(y);
if (d === yearLength) {
m = 12;
break;
} else if (d < yearLength) {
let monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y, m);
m = 1;
while(d > monthLength){
d -= monthLength;
m++;
monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y, m);
}
break;
}
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, y, m, days - $f2f3e0e3a817edbd$var$umalquraMonthStart(y, m) + 1);
}
}
toJulianDay(date) {
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
return $f2f3e0e3a817edbd$var$CIVIL_EPOC + $f2f3e0e3a817edbd$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
}
getDaysInMonth(date) {
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
return $f2f3e0e3a817edbd$var$umalquraMonthLength(date.year, date.month);
}
getDaysInYear(date) {
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
return $f2f3e0e3a817edbd$var$umalquraYearLength(date.year);
}
constructor(){
super();
this.identifier = 'islamic-umalqura';
if (!$f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH) $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($f2f3e0e3a817edbd$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
if (!$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE) {
$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START + 1);
let yearStart = 0;
for(let year = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START; year <= $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END; year++){
$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] = yearStart;
for(let i = 1; i <= 12; i++)yearStart += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i);
}
}
}
}
export {$f2f3e0e3a817edbd$export$2066795aadd37bfc as IslamicCivilCalendar, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $f2f3e0e3a817edbd$export$5baab4758c231076 as IslamicUmalquraCalendar};
//# sourceMappingURL=IslamicCalendar.module.js.map

View File

@@ -0,0 +1,157 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $f2f3e0e3a817edbd$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
const $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START = 1300;
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END = 1600;
const $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS = 460322;
function $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, day) {
return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
}
function $f2f3e0e3a817edbd$var$julianDayToIslamic(calendar, epoch, jd) {
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
let month = Math.min(12, Math.ceil((jd - (29 + $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
let day = jd - $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, 1) + 1;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(calendar, year, month, day);
}
function $f2f3e0e3a817edbd$var$isLeapYear(year) {
return (14 + 11 * year) % 30 < 11;
}
class $f2f3e0e3a817edbd$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$CIVIL_EPOC, jd);
}
toJulianDay(date) {
return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$CIVIL_EPOC, date.year, date.month, date.day);
}
getDaysInMonth(date) {
let length = 29 + date.month % 2;
if (date.month === 12 && $f2f3e0e3a817edbd$var$isLeapYear(date.year)) length++;
return length;
}
getMonthsInYear() {
return 12;
}
getDaysInYear(date) {
return $f2f3e0e3a817edbd$var$isLeapYear(date.year) ? 355 : 354;
}
getYearsInEra() {
// 9999 gregorian
return 9665;
}
getEras() {
return [
'AH'
];
}
constructor(){
this.identifier = 'islamic-civil';
}
}
class $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, jd);
}
toJulianDay(date) {
return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
}
constructor(...args){
super(...args);
this.identifier = 'islamic-tbla';
}
}
// Generated by scripts/generate-umalqura.js
const $f2f3e0e3a817edbd$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
let $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH;
let $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE;
function $f2f3e0e3a817edbd$var$umalquraYearStart(year) {
return $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS + $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
function $f2f3e0e3a817edbd$var$umalquraMonthLength(year, month) {
let idx = year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START;
let mask = 0x01 << 11 - (month - 1);
if (($f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
else return 30;
}
function $f2f3e0e3a817edbd$var$umalquraMonthStart(year, month) {
let day = $f2f3e0e3a817edbd$var$umalquraYearStart(year);
for(let i = 1; i < month; i++)day += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i);
return day;
}
function $f2f3e0e3a817edbd$var$umalquraYearLength(year) {
return $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year + 1 - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
class $f2f3e0e3a817edbd$export$5baab4758c231076 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
fromJulianDay(jd) {
let days = jd - $f2f3e0e3a817edbd$var$CIVIL_EPOC;
let startDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_START);
let endDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END);
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
else {
let y = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START - 1;
let m = 1;
let d = 1;
while(d > 0){
y++;
d = days - $f2f3e0e3a817edbd$var$umalquraYearStart(y) + 1;
let yearLength = $f2f3e0e3a817edbd$var$umalquraYearLength(y);
if (d === yearLength) {
m = 12;
break;
} else if (d < yearLength) {
let monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y, m);
m = 1;
while(d > monthLength){
d -= monthLength;
m++;
monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y, m);
}
break;
}
}
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, y, m, days - $f2f3e0e3a817edbd$var$umalquraMonthStart(y, m) + 1);
}
}
toJulianDay(date) {
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
return $f2f3e0e3a817edbd$var$CIVIL_EPOC + $f2f3e0e3a817edbd$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
}
getDaysInMonth(date) {
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
return $f2f3e0e3a817edbd$var$umalquraMonthLength(date.year, date.month);
}
getDaysInYear(date) {
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
return $f2f3e0e3a817edbd$var$umalquraYearLength(date.year);
}
constructor(){
super();
this.identifier = 'islamic-umalqura';
if (!$f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH) $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($f2f3e0e3a817edbd$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
if (!$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE) {
$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START + 1);
let yearStart = 0;
for(let year = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START; year <= $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END; year++){
$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] = yearStart;
for(let i = 1; i <= 12; i++)yearStart += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i);
}
}
}
}
export {$f2f3e0e3a817edbd$export$2066795aadd37bfc as IslamicCivilCalendar, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $f2f3e0e3a817edbd$export$5baab4758c231076 as IslamicUmalquraCalendar};
//# sourceMappingURL=IslamicCalendar.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,180 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "JapaneseCalendar", () => $b0ac0602ef646b2c$export$b746ab2b60cdffbf);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $b0ac0602ef646b2c$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $b0ac0602ef646b2c$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $b0ac0602ef646b2c$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $b0ac0602ef646b2c$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $b0ac0602ef646b2c$var$findEraFromGregorianDate(date) {
const idx = $b0ac0602ef646b2c$var$ERA_START_DATES.findIndex(([year, month, day])=>{
if (date.year < year) return true;
if (date.year === year && date.month < month) return true;
if (date.year === year && date.month === month && date.day < day) return true;
return false;
});
if (idx === -1) return $b0ac0602ef646b2c$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $b0ac0602ef646b2c$var$toGregorian(date) {
let eraAddend = $b0ac0602ef646b2c$var$ERA_ADDENDS[$b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(date.year + eraAddend, date.month, date.day);
}
class $b0ac0602ef646b2c$export$b746ab2b60cdffbf extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $b0ac0602ef646b2c$var$findEraFromGregorianDate(date);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, $b0ac0602ef646b2c$var$ERA_NAMES[era], date.year - $b0ac0602ef646b2c$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($b0ac0602ef646b2c$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $b0ac0602ef646b2c$var$toGregorian(date);
let era = $b0ac0602ef646b2c$var$findEraFromGregorianDate(gregorianDate);
if ($b0ac0602ef646b2c$var$ERA_NAMES[era] !== date.era) {
date.era = $b0ac0602ef646b2c$var$ERA_NAMES[era];
date.year = gregorianDate.year - $b0ac0602ef646b2c$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era);
let end = $b0ac0602ef646b2c$var$ERA_END_DATES[idx];
if (end != null) {
let [endYear, endMonth, endDay] = end;
// Constrain the year to the maximum possible value in the era.
// Then constrain the month and day fields within that.
let maxYear = endYear - $b0ac0602ef646b2c$var$ERA_ADDENDS[idx];
date.year = Math.max(1, Math.min(maxYear, date.year));
if (date.year === maxYear) {
date.month = Math.min(endMonth, date.month);
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
}
}
if (date.year === 1 && idx >= 0) {
let [, startMonth, startDay] = $b0ac0602ef646b2c$var$ERA_START_DATES[idx];
date.month = Math.max(startMonth, date.month);
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
}
}
getEras() {
return $b0ac0602ef646b2c$var$ERA_NAMES;
}
getYearsInEra(date) {
// Get the number of years in the era, taking into account the date's month and day fields.
let era = $b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era);
let cur = $b0ac0602ef646b2c$var$ERA_START_DATES[era];
let next = $b0ac0602ef646b2c$var$ERA_START_DATES[era + 1];
if (next == null) // 9999 gregorian is the maximum year allowed.
return 9999 - cur[0] + 1;
let years = next[0] - cur[0];
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
return years;
}
getDaysInMonth(date) {
return super.getDaysInMonth($b0ac0602ef646b2c$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $b0ac0602ef646b2c$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $b0ac0602ef646b2c$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args);
this.identifier = 'japanese';
}
}
function $b0ac0602ef646b2c$var$getMinimums(date) {
if (date.year === 1) {
let idx = $b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era);
return $b0ac0602ef646b2c$var$ERA_START_DATES[idx];
}
}
//# sourceMappingURL=JapaneseCalendar.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,175 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $62225008020f0a13$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $62225008020f0a13$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $62225008020f0a13$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $62225008020f0a13$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $62225008020f0a13$var$findEraFromGregorianDate(date) {
const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day])=>{
if (date.year < year) return true;
if (date.year === year && date.month < month) return true;
if (date.year === year && date.month === month && date.day < day) return true;
return false;
});
if (idx === -1) return $62225008020f0a13$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $62225008020f0a13$var$toGregorian(date) {
let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.year + eraAddend, date.month, date.day);
}
class $62225008020f0a13$export$b746ab2b60cdffbf extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $62225008020f0a13$var$findEraFromGregorianDate(date);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, $62225008020f0a13$var$ERA_NAMES[era], date.year - $62225008020f0a13$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($62225008020f0a13$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $62225008020f0a13$var$toGregorian(date);
let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
if ($62225008020f0a13$var$ERA_NAMES[era] !== date.era) {
date.era = $62225008020f0a13$var$ERA_NAMES[era];
date.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
let end = $62225008020f0a13$var$ERA_END_DATES[idx];
if (end != null) {
let [endYear, endMonth, endDay] = end;
// Constrain the year to the maximum possible value in the era.
// Then constrain the month and day fields within that.
let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
date.year = Math.max(1, Math.min(maxYear, date.year));
if (date.year === maxYear) {
date.month = Math.min(endMonth, date.month);
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
}
}
if (date.year === 1 && idx >= 0) {
let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
date.month = Math.max(startMonth, date.month);
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
}
}
getEras() {
return $62225008020f0a13$var$ERA_NAMES;
}
getYearsInEra(date) {
// Get the number of years in the era, taking into account the date's month and day fields.
let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
let cur = $62225008020f0a13$var$ERA_START_DATES[era];
let next = $62225008020f0a13$var$ERA_START_DATES[era + 1];
if (next == null) // 9999 gregorian is the maximum year allowed.
return 9999 - cur[0] + 1;
let years = next[0] - cur[0];
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
return years;
}
getDaysInMonth(date) {
return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $62225008020f0a13$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $62225008020f0a13$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args);
this.identifier = 'japanese';
}
}
function $62225008020f0a13$var$getMinimums(date) {
if (date.year === 1) {
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
return $62225008020f0a13$var$ERA_START_DATES[idx];
}
}
export {$62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar};
//# sourceMappingURL=JapaneseCalendar.module.js.map

View File

@@ -0,0 +1,175 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $62225008020f0a13$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $62225008020f0a13$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $62225008020f0a13$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $62225008020f0a13$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $62225008020f0a13$var$findEraFromGregorianDate(date) {
const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day])=>{
if (date.year < year) return true;
if (date.year === year && date.month < month) return true;
if (date.year === year && date.month === month && date.day < day) return true;
return false;
});
if (idx === -1) return $62225008020f0a13$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $62225008020f0a13$var$toGregorian(date) {
let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.year + eraAddend, date.month, date.day);
}
class $62225008020f0a13$export$b746ab2b60cdffbf extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $62225008020f0a13$var$findEraFromGregorianDate(date);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, $62225008020f0a13$var$ERA_NAMES[era], date.year - $62225008020f0a13$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($62225008020f0a13$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $62225008020f0a13$var$toGregorian(date);
let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
if ($62225008020f0a13$var$ERA_NAMES[era] !== date.era) {
date.era = $62225008020f0a13$var$ERA_NAMES[era];
date.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
let end = $62225008020f0a13$var$ERA_END_DATES[idx];
if (end != null) {
let [endYear, endMonth, endDay] = end;
// Constrain the year to the maximum possible value in the era.
// Then constrain the month and day fields within that.
let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
date.year = Math.max(1, Math.min(maxYear, date.year));
if (date.year === maxYear) {
date.month = Math.min(endMonth, date.month);
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
}
}
if (date.year === 1 && idx >= 0) {
let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
date.month = Math.max(startMonth, date.month);
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
}
}
getEras() {
return $62225008020f0a13$var$ERA_NAMES;
}
getYearsInEra(date) {
// Get the number of years in the era, taking into account the date's month and day fields.
let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
let cur = $62225008020f0a13$var$ERA_START_DATES[era];
let next = $62225008020f0a13$var$ERA_START_DATES[era + 1];
if (next == null) // 9999 gregorian is the maximum year allowed.
return 9999 - cur[0] + 1;
let years = next[0] - cur[0];
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
return years;
}
getDaysInMonth(date) {
return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $62225008020f0a13$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $62225008020f0a13$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args);
this.identifier = 'japanese';
}
}
function $62225008020f0a13$var$getMinimums(date) {
if (date.year === 1) {
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
return $62225008020f0a13$var$ERA_START_DATES[idx];
}
}
export {$62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar};
//# sourceMappingURL=JapaneseCalendar.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,81 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $a5090d6430502238$exports = require("./utils.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "PersianCalendar", () => $3c060181fc7249ae$export$37fccdbfd14c5939);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $3c060181fc7249ae$var$PERSIAN_EPOCH = 1948320;
// Number of days from the start of the year to the start of each month.
const $3c060181fc7249ae$var$MONTH_START = [
0,
31,
62,
93,
124,
155,
186,
216,
246,
276,
306,
336 // Esfand
];
class $3c060181fc7249ae$export$37fccdbfd14c5939 {
fromJulianDay(jd) {
let daysSinceEpoch = jd - $3c060181fc7249ae$var$PERSIAN_EPOCH;
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
let dayOfYear = daysSinceEpoch - farvardin1;
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
let day = dayOfYear - $3c060181fc7249ae$var$MONTH_START[month] + 1;
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, year, month + 1, day);
}
toJulianDay(date) {
let jd = $3c060181fc7249ae$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
jd += $3c060181fc7249ae$var$MONTH_START[date.month - 1];
jd += date.day;
return jd;
}
getMonthsInYear() {
return 12;
}
getDaysInMonth(date) {
if (date.month <= 6) return 31;
if (date.month <= 11) return 30;
let isLeapYear = (0, $a5090d6430502238$exports.mod)(25 * date.year + 11, 33) < 8;
return isLeapYear ? 30 : 29;
}
getEras() {
return [
'AP'
];
}
getYearsInEra() {
// 9378-10-10 persian is 9999-12-31 gregorian.
// Round down to 9377 to set the maximum full year.
return 9377;
}
constructor(){
this.identifier = 'persian';
}
}
//# sourceMappingURL=PersianCalendar.main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,sCAAgB;AAEtB,wEAAwE;AACxE,MAAM,oCAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAK,SAAS;CACf;AAQM,MAAM;IAGX,cAAc,EAAU,EAAgB;QACtC,IAAI,iBAAiB,KAAK;QAC1B,IAAI,OAAO,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,iBAAiB,CAAA,IAAK;QACtD,IAAI,aAAa,MAAO,CAAA,OAAO,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,OAAO,EAAC,IAAK;QACjE,IAAI,YAAY,iBAAiB;QACjC,IAAI,QAAQ,YAAY,MACpB,KAAK,KAAK,CAAC,YAAY,MACvB,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACjC,IAAI,MAAM,YAAY,iCAAW,CAAC,MAAM,GAAG;QAC3C,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,IAAI,EAAE,MAAM,QAAQ,GAAG;IACjD;IAEA,YAAY,IAAqB,EAAU;QACzC,IAAI,KAAK,sCAAgB,IAAI,MAAO,CAAA,KAAK,IAAI,GAAG,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,KAAK,IAAI,GAAG,EAAC,IAAK;QACvF,MAAM,iCAAW,CAAC,KAAK,KAAK,GAAG,EAAE;QACjC,MAAM,KAAK,GAAG;QACd,OAAO;IACT;IAEA,kBAA0B;QACxB,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,IAAI,GAChB,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,IAChB,OAAO;QAGT,IAAI,aAAa,CAAA,GAAA,6BAAE,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,MAAM;QAChD,OAAO,aAAa,KAAK;IAC3B;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aA9CA,aAAa;;AA+Cf","sources":["packages/@internationalized/date/src/calendars/PersianCalendar.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\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948320;\n\n// Number of days from the start of the year to the start of each month.\nconst MONTH_START = [\n 0, // Farvardin\n 31, // Ordibehesht\n 62, // Khordad\n 93, // Tir\n 124, // Mordad\n 155, // Shahrivar\n 186, // Mehr\n 216, // Aban\n 246, // Azar\n 276, // Dey\n 306, // Bahman\n 336 // Esfand\n];\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let daysSinceEpoch = jd - PERSIAN_EPOCH;\n let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);\n let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n let dayOfYear = daysSinceEpoch - farvardin1;\n let month = dayOfYear < 216\n ? Math.floor(dayOfYear / 31)\n : Math.floor((dayOfYear - 6) / 30);\n let day = dayOfYear - MONTH_START[month] + 1;\n return new CalendarDate(this, year, month + 1, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n let jd = PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);\n jd += MONTH_START[date.month - 1];\n jd += date.day;\n return jd;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n let isLeapYear = mod(25 * date.year + 11, 33) < 8;\n return isLeapYear ? 30 : 29;\n }\n\n getEras() {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n"],"names":[],"version":3,"file":"PersianCalendar.main.js.map"}

View File

@@ -0,0 +1,76 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
// Number of days from the start of the year to the start of each month.
const $f3ed2e4472ae7e25$var$MONTH_START = [
0,
31,
62,
93,
124,
155,
186,
216,
246,
276,
306,
336 // Esfand
];
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
fromJulianDay(jd) {
let daysSinceEpoch = jd - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
let dayOfYear = daysSinceEpoch - farvardin1;
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month + 1, day);
}
toJulianDay(date) {
let jd = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
jd += $f3ed2e4472ae7e25$var$MONTH_START[date.month - 1];
jd += date.day;
return jd;
}
getMonthsInYear() {
return 12;
}
getDaysInMonth(date) {
if (date.month <= 6) return 31;
if (date.month <= 11) return 30;
let isLeapYear = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
return isLeapYear ? 30 : 29;
}
getEras() {
return [
'AP'
];
}
getYearsInEra() {
// 9378-10-10 persian is 9999-12-31 gregorian.
// Round down to 9377 to set the maximum full year.
return 9377;
}
constructor(){
this.identifier = 'persian';
}
}
export {$f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar};
//# sourceMappingURL=PersianCalendar.module.js.map

View File

@@ -0,0 +1,76 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {mod as $2b4dce13dd5a17fa$export$842a2cf37af977e1} from "./utils.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
// Number of days from the start of the year to the start of each month.
const $f3ed2e4472ae7e25$var$MONTH_START = [
0,
31,
62,
93,
124,
155,
186,
216,
246,
276,
306,
336 // Esfand
];
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
fromJulianDay(jd) {
let daysSinceEpoch = jd - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
let dayOfYear = daysSinceEpoch - farvardin1;
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, year, month + 1, day);
}
toJulianDay(date) {
let jd = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
jd += $f3ed2e4472ae7e25$var$MONTH_START[date.month - 1];
jd += date.day;
return jd;
}
getMonthsInYear() {
return 12;
}
getDaysInMonth(date) {
if (date.month <= 6) return 31;
if (date.month <= 11) return 30;
let isLeapYear = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
return isLeapYear ? 30 : 29;
}
getEras() {
return [
'AP'
];
}
getYearsInEra() {
// 9378-10-10 persian is 9999-12-31 gregorian.
// Round down to 9377 to set the maximum full year.
return 9377;
}
constructor(){
this.identifier = 'persian';
}
}
export {$f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar};
//# sourceMappingURL=PersianCalendar.module.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,sCAAgB;AAEtB,wEAAwE;AACxE,MAAM,oCAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAK,SAAS;CACf;AAQM,MAAM;IAGX,cAAc,EAAU,EAAgB;QACtC,IAAI,iBAAiB,KAAK;QAC1B,IAAI,OAAO,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,iBAAiB,CAAA,IAAK;QACtD,IAAI,aAAa,MAAO,CAAA,OAAO,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,OAAO,EAAC,IAAK;QACjE,IAAI,YAAY,iBAAiB;QACjC,IAAI,QAAQ,YAAY,MACpB,KAAK,KAAK,CAAC,YAAY,MACvB,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACjC,IAAI,MAAM,YAAY,iCAAW,CAAC,MAAM,GAAG;QAC3C,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,MAAM,QAAQ,GAAG;IACjD;IAEA,YAAY,IAAqB,EAAU;QACzC,IAAI,KAAK,sCAAgB,IAAI,MAAO,CAAA,KAAK,IAAI,GAAG,CAAA,IAAK,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,KAAK,IAAI,GAAG,EAAC,IAAK;QACvF,MAAM,iCAAW,CAAC,KAAK,KAAK,GAAG,EAAE;QACjC,MAAM,KAAK,GAAG;QACd,OAAO;IACT;IAEA,kBAA0B;QACxB,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,IAAI,GAChB,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,IAChB,OAAO;QAGT,IAAI,aAAa,CAAA,GAAA,yCAAE,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,MAAM;QAChD,OAAO,aAAa,KAAK;IAC3B;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aA9CA,aAAa;;AA+Cf","sources":["packages/@internationalized/date/src/calendars/PersianCalendar.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\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948320;\n\n// Number of days from the start of the year to the start of each month.\nconst MONTH_START = [\n 0, // Farvardin\n 31, // Ordibehesht\n 62, // Khordad\n 93, // Tir\n 124, // Mordad\n 155, // Shahrivar\n 186, // Mehr\n 216, // Aban\n 246, // Azar\n 276, // Dey\n 306, // Bahman\n 336 // Esfand\n];\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let daysSinceEpoch = jd - PERSIAN_EPOCH;\n let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);\n let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n let dayOfYear = daysSinceEpoch - farvardin1;\n let month = dayOfYear < 216\n ? Math.floor(dayOfYear / 31)\n : Math.floor((dayOfYear - 6) / 30);\n let day = dayOfYear - MONTH_START[month] + 1;\n return new CalendarDate(this, year, month + 1, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n let jd = PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);\n jd += MONTH_START[date.month - 1];\n jd += date.day;\n return jd;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n let isLeapYear = mod(25 * date.year + 11, 33) < 8;\n return isLeapYear ? 30 : 29;\n }\n\n getEras() {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n"],"names":[],"version":3,"file":"PersianCalendar.module.js.map"}

View File

@@ -0,0 +1,81 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "TaiwanCalendar", () => $9cc5d3577ec40243$export$65e01080afcb0799);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $9cc5d3577ec40243$var$TAIWAN_ERA_START = 1911;
function $9cc5d3577ec40243$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $9cc5d3577ec40243$var$TAIWAN_ERA_START : 1 - date.year + $9cc5d3577ec40243$var$TAIWAN_ERA_START;
}
function $9cc5d3577ec40243$var$gregorianToTaiwan(year) {
let y = year - $9cc5d3577ec40243$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $9cc5d3577ec40243$export$65e01080afcb0799 extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $af14c9812fdceb33$exports.getExtendedYear)(date.era, date.year);
let [era, year] = $9cc5d3577ec40243$var$gregorianToTaiwan(extendedYear);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($9cc5d3577ec40243$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $9cc5d3577ec40243$var$gregorianToTaiwan($9cc5d3577ec40243$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($9cc5d3577ec40243$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $9cc5d3577ec40243$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args);
this.identifier = 'roc' // Republic of China
;
}
}
function $9cc5d3577ec40243$var$toGregorian(date) {
let [era, year] = (0, $af14c9812fdceb33$exports.fromExtendedYear)($9cc5d3577ec40243$var$gregorianYear(date));
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(era, year, date.month, date.day);
}
//# sourceMappingURL=TaiwanCalendar.main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,2CAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;;aAjCA,aAAa,MAAO,oBAAoB;;;AAkC1C;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.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\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.main.js.map"}

View File

@@ -0,0 +1,76 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, getExtendedYear as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $5f31bd6f0c8940b2$var$TAIWAN_ERA_START = 1911;
function $5f31bd6f0c8940b2$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START : 1 - date.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
}
function $5f31bd6f0c8940b2$var$gregorianToTaiwan(year) {
let y = year - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year);
let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan(extendedYear);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($5f31bd6f0c8940b2$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan($5f31bd6f0c8940b2$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($5f31bd6f0c8940b2$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args);
this.identifier = 'roc' // Republic of China
;
}
}
function $5f31bd6f0c8940b2$var$toGregorian(date) {
let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)($5f31bd6f0c8940b2$var$gregorianYear(date));
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$5f31bd6f0c8940b2$export$65e01080afcb0799 as TaiwanCalendar};
//# sourceMappingURL=TaiwanCalendar.module.js.map

View File

@@ -0,0 +1,76 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, getExtendedYear as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from ICU.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $5f31bd6f0c8940b2$var$TAIWAN_ERA_START = 1911;
function $5f31bd6f0c8940b2$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START : 1 - date.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
}
function $5f31bd6f0c8940b2$var$gregorianToTaiwan(year) {
let y = year - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year);
let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan(extendedYear);
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($5f31bd6f0c8940b2$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan($5f31bd6f0c8940b2$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($5f31bd6f0c8940b2$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args);
this.identifier = 'roc' // Republic of China
;
}
}
function $5f31bd6f0c8940b2$var$toGregorian(date) {
let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)($5f31bd6f0c8940b2$var$gregorianYear(date));
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$5f31bd6f0c8940b2$export$65e01080afcb0799 as TaiwanCalendar};
//# sourceMappingURL=TaiwanCalendar.module.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,yCAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;;aAjCA,aAAa,MAAO,oBAAoB;;;AAkC1C;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.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\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.module.js.map"}

View File

@@ -0,0 +1,236 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $5c0571aa5b6fb5da$exports = require("./manipulation.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
var $1f0f7ebf1ae6c530$exports = require("./queries.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "epochFromDate", () => $4ae0260a69729f1d$export$bd4fb2bc8bb06fb);
$parcel$export(module.exports, "toCalendar", () => $4ae0260a69729f1d$export$b4a036af3fc0b032);
$parcel$export(module.exports, "possibleAbsolutes", () => $4ae0260a69729f1d$export$136f38efe7caf549);
$parcel$export(module.exports, "toAbsolute", () => $4ae0260a69729f1d$export$5107c82f94518f5c);
$parcel$export(module.exports, "toCalendarDateTime", () => $4ae0260a69729f1d$export$b21e0b124e224484);
$parcel$export(module.exports, "toDate", () => $4ae0260a69729f1d$export$e67a095c620b86fe);
$parcel$export(module.exports, "fromAbsolute", () => $4ae0260a69729f1d$export$1b96692a1ba042ac);
$parcel$export(module.exports, "fromDate", () => $4ae0260a69729f1d$export$e57ff100d91bd4b9);
$parcel$export(module.exports, "toCalendarDate", () => $4ae0260a69729f1d$export$93522d1a439f3617);
$parcel$export(module.exports, "toTime", () => $4ae0260a69729f1d$export$d33f79e3ffc3dc83);
$parcel$export(module.exports, "toZoned", () => $4ae0260a69729f1d$export$84c95a83c799e074);
$parcel$export(module.exports, "toTimeZone", () => $4ae0260a69729f1d$export$538b00033cc11c75);
$parcel$export(module.exports, "zonedToDate", () => $4ae0260a69729f1d$export$83aac07b4c37b25);
$parcel$export(module.exports, "toLocalTimeZone", () => $4ae0260a69729f1d$export$d9b67bc93c097491);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
function $4ae0260a69729f1d$export$bd4fb2bc8bb06fb(date) {
date = $4ae0260a69729f1d$export$b4a036af3fc0b032(date, new (0, $af14c9812fdceb33$exports.GregorianCalendar)());
let year = (0, $af14c9812fdceb33$exports.getExtendedYear)(date.era, date.year);
return $4ae0260a69729f1d$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
}
function $4ae0260a69729f1d$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
// Note: Date.UTC() interprets one and two-digit years as being in the
// 20th century, so don't use it
let date = new Date();
date.setUTCHours(hour, minute, second, millisecond);
date.setUTCFullYear(year, month - 1, day);
return date.getTime();
}
function $4ae0260a69729f1d$export$59c99f3515d3493f(ms, timeZone) {
// Fast path for UTC.
if (timeZone === 'UTC') return 0;
// Fast path: for local timezone after 1970, use native Date.
if (ms > 0 && timeZone === (0, $1f0f7ebf1ae6c530$exports.getLocalTimeZone)()) return new Date(ms).getTimezoneOffset() * -60000;
let { year: year, month: month, day: day, hour: hour, minute: minute, second: second } = $4ae0260a69729f1d$var$getTimeZoneParts(ms, timeZone);
let utc = $4ae0260a69729f1d$var$epochFromParts(year, month, day, hour, minute, second, 0);
return utc - Math.floor(ms / 1000) * 1000;
}
const $4ae0260a69729f1d$var$formattersByTimeZone = new Map();
function $4ae0260a69729f1d$var$getTimeZoneParts(ms, timeZone) {
let formatter = $4ae0260a69729f1d$var$formattersByTimeZone.get(timeZone);
if (!formatter) {
formatter = new Intl.DateTimeFormat('en-US', {
timeZone: timeZone,
hour12: false,
era: 'short',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
});
$4ae0260a69729f1d$var$formattersByTimeZone.set(timeZone, formatter);
}
let parts = formatter.formatToParts(new Date(ms));
let namedParts = {};
for (let part of parts)if (part.type !== 'literal') namedParts[part.type] = part.value;
return {
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,
month: +namedParts.month,
day: +namedParts.day,
hour: namedParts.hour === '24' ? 0 : +namedParts.hour,
minute: +namedParts.minute,
second: +namedParts.second
};
}
const $4ae0260a69729f1d$var$DAYMILLIS = 86400000;
function $4ae0260a69729f1d$export$136f38efe7caf549(date, timeZone) {
let ms = $4ae0260a69729f1d$export$bd4fb2bc8bb06fb(date);
let earlier = ms - $4ae0260a69729f1d$export$59c99f3515d3493f(ms - $4ae0260a69729f1d$var$DAYMILLIS, timeZone);
let later = ms - $4ae0260a69729f1d$export$59c99f3515d3493f(ms + $4ae0260a69729f1d$var$DAYMILLIS, timeZone);
return $4ae0260a69729f1d$var$getValidWallTimes(date, timeZone, earlier, later);
}
function $4ae0260a69729f1d$var$getValidWallTimes(date, timeZone, earlier, later) {
let found = earlier === later ? [
earlier
] : [
earlier,
later
];
return found.filter((absolute)=>$4ae0260a69729f1d$var$isValidWallTime(date, timeZone, absolute));
}
function $4ae0260a69729f1d$var$isValidWallTime(date, timeZone, absolute) {
let parts = $4ae0260a69729f1d$var$getTimeZoneParts(absolute, timeZone);
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
}
function $4ae0260a69729f1d$export$5107c82f94518f5c(date, timeZone, disambiguation = 'compatible') {
let dateTime = $4ae0260a69729f1d$export$b21e0b124e224484(date);
// Fast path: if the time zone is UTC, use native Date.
if (timeZone === 'UTC') return $4ae0260a69729f1d$export$bd4fb2bc8bb06fb(dateTime);
// Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.
if (timeZone === (0, $1f0f7ebf1ae6c530$exports.getLocalTimeZone)() && disambiguation === 'compatible') {
dateTime = $4ae0260a69729f1d$export$b4a036af3fc0b032(dateTime, new (0, $af14c9812fdceb33$exports.GregorianCalendar)());
// Don't use Date constructor here because two-digit years are interpreted in the 20th century.
let date = new Date();
let year = (0, $af14c9812fdceb33$exports.getExtendedYear)(dateTime.era, dateTime.year);
date.setFullYear(year, dateTime.month - 1, dateTime.day);
date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
return date.getTime();
}
let ms = $4ae0260a69729f1d$export$bd4fb2bc8bb06fb(dateTime);
let offsetBefore = $4ae0260a69729f1d$export$59c99f3515d3493f(ms - $4ae0260a69729f1d$var$DAYMILLIS, timeZone);
let offsetAfter = $4ae0260a69729f1d$export$59c99f3515d3493f(ms + $4ae0260a69729f1d$var$DAYMILLIS, timeZone);
let valid = $4ae0260a69729f1d$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
if (valid.length === 1) return valid[0];
if (valid.length > 1) switch(disambiguation){
// 'compatible' means 'earlier' for "fall back" transitions
case 'compatible':
case 'earlier':
return valid[0];
case 'later':
return valid[valid.length - 1];
case 'reject':
throw new RangeError('Multiple possible absolute times found');
}
switch(disambiguation){
case 'earlier':
return Math.min(ms - offsetBefore, ms - offsetAfter);
// 'compatible' means 'later' for "spring forward" transitions
case 'compatible':
case 'later':
return Math.max(ms - offsetBefore, ms - offsetAfter);
case 'reject':
throw new RangeError('No such absolute time found');
}
}
function $4ae0260a69729f1d$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = 'compatible') {
return new Date($4ae0260a69729f1d$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
}
function $4ae0260a69729f1d$export$1b96692a1ba042ac(ms, timeZone) {
let offset = $4ae0260a69729f1d$export$59c99f3515d3493f(ms, timeZone);
let date = new Date(ms + offset);
let year = date.getUTCFullYear();
let month = date.getUTCMonth() + 1;
let day = date.getUTCDate();
let hour = date.getUTCHours();
let minute = date.getUTCMinutes();
let second = date.getUTCSeconds();
let millisecond = date.getUTCMilliseconds();
return new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)(year, month, day, timeZone, offset, hour, minute, second, millisecond);
}
function $4ae0260a69729f1d$export$e57ff100d91bd4b9(date, timeZone) {
return $4ae0260a69729f1d$export$1b96692a1ba042ac(date.getTime(), timeZone);
}
function $4ae0260a69729f1d$export$d7f92bcd3596b086(date) {
return $4ae0260a69729f1d$export$e57ff100d91bd4b9(date, (0, $1f0f7ebf1ae6c530$exports.getLocalTimeZone)());
}
function $4ae0260a69729f1d$export$93522d1a439f3617(dateTime) {
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
}
function $4ae0260a69729f1d$export$6f4d78149f3f53ac(date) {
return {
era: date.era,
year: date.year,
month: date.month,
day: date.day
};
}
function $4ae0260a69729f1d$export$4d0393e732857be5(date) {
return {
hour: date.hour,
minute: date.minute,
second: date.second,
millisecond: date.millisecond
};
}
function $4ae0260a69729f1d$export$b21e0b124e224484(date, time) {
let hour = 0, minute = 0, second = 0, millisecond = 0;
if ('timeZone' in date) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = date);
else if ('hour' in date && !time) return date;
if (time) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = time);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDateTime)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
}
function $4ae0260a69729f1d$export$d33f79e3ffc3dc83(dateTime) {
return new (0, $625ad1e1f4c43bc1$exports.Time)(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
}
function $4ae0260a69729f1d$export$b4a036af3fc0b032(date, calendar) {
if (date.calendar.identifier === calendar.identifier) return date;
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
let copy = date.copy();
copy.calendar = calendar;
copy.era = calendarDate.era;
copy.year = calendarDate.year;
copy.month = calendarDate.month;
copy.day = calendarDate.day;
(0, $5c0571aa5b6fb5da$exports.constrain)(copy);
return copy;
}
function $4ae0260a69729f1d$export$84c95a83c799e074(date, timeZone, disambiguation) {
if (date instanceof (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)) {
if (date.timeZone === timeZone) return date;
return $4ae0260a69729f1d$export$538b00033cc11c75(date, timeZone);
}
let ms = $4ae0260a69729f1d$export$5107c82f94518f5c(date, timeZone, disambiguation);
return $4ae0260a69729f1d$export$1b96692a1ba042ac(ms, timeZone);
}
function $4ae0260a69729f1d$export$83aac07b4c37b25(date) {
let ms = $4ae0260a69729f1d$export$bd4fb2bc8bb06fb(date) - date.offset;
return new Date(ms);
}
function $4ae0260a69729f1d$export$538b00033cc11c75(date, timeZone) {
let ms = $4ae0260a69729f1d$export$bd4fb2bc8bb06fb(date) - date.offset;
return $4ae0260a69729f1d$export$b4a036af3fc0b032($4ae0260a69729f1d$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
}
function $4ae0260a69729f1d$export$d9b67bc93c097491(date) {
return $4ae0260a69729f1d$export$538b00033cc11c75(date, (0, $1f0f7ebf1ae6c530$exports.getLocalTimeZone)());
}
//# sourceMappingURL=conversion.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,218 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.mjs";
import {constrain as $735220c2d4774dd3$export$c4e2ecac49351ef2} from "./manipulation.mjs";
import {getExtendedYear as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
import {getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2} from "./queries.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year);
return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
}
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
// Note: Date.UTC() interprets one and two-digit years as being in the
// 20th century, so don't use it
let date = new Date();
date.setUTCHours(hour, minute, second, millisecond);
date.setUTCFullYear(year, month - 1, day);
return date.getTime();
}
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
// Fast path for UTC.
if (timeZone === 'UTC') return 0;
// Fast path: for local timezone after 1970, use native Date.
if (ms > 0 && timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)()) return new Date(ms).getTimezoneOffset() * -60000;
let { year: year, month: month, day: day, hour: hour, minute: minute, second: second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
return utc - Math.floor(ms / 1000) * 1000;
}
const $11d87f3f76e88657$var$formattersByTimeZone = new Map();
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
if (!formatter) {
formatter = new Intl.DateTimeFormat('en-US', {
timeZone: timeZone,
hour12: false,
era: 'short',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
});
$11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
}
let parts = formatter.formatToParts(new Date(ms));
let namedParts = {};
for (let part of parts)if (part.type !== 'literal') namedParts[part.type] = part.value;
return {
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,
month: +namedParts.month,
day: +namedParts.day,
hour: namedParts.hour === '24' ? 0 : +namedParts.hour,
minute: +namedParts.minute,
second: +namedParts.second
};
}
const $11d87f3f76e88657$var$DAYMILLIS = 86400000;
function $11d87f3f76e88657$export$136f38efe7caf549(date, timeZone) {
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date);
let earlier = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
let later = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
return $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later);
}
function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
let found = earlier === later ? [
earlier
] : [
earlier,
later
];
return found.filter((absolute)=>$11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
}
function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
}
function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = 'compatible') {
let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
// Fast path: if the time zone is UTC, use native Date.
if (timeZone === 'UTC') return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
// Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.
if (timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)() && disambiguation === 'compatible') {
dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
// Don't use Date constructor here because two-digit years are interpreted in the 20th century.
let date = new Date();
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(dateTime.era, dateTime.year);
date.setFullYear(year, dateTime.month - 1, dateTime.day);
date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
return date.getTime();
}
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
if (valid.length === 1) return valid[0];
if (valid.length > 1) switch(disambiguation){
// 'compatible' means 'earlier' for "fall back" transitions
case 'compatible':
case 'earlier':
return valid[0];
case 'later':
return valid[valid.length - 1];
case 'reject':
throw new RangeError('Multiple possible absolute times found');
}
switch(disambiguation){
case 'earlier':
return Math.min(ms - offsetBefore, ms - offsetAfter);
// 'compatible' means 'later' for "spring forward" transitions
case 'compatible':
case 'later':
return Math.max(ms - offsetBefore, ms - offsetAfter);
case 'reject':
throw new RangeError('No such absolute time found');
}
}
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = 'compatible') {
return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
}
function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
let offset = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
let date = new Date(ms + offset);
let year = date.getUTCFullYear();
let month = date.getUTCMonth() + 1;
let day = date.getUTCDate();
let hour = date.getUTCHours();
let minute = date.getUTCMinutes();
let second = date.getUTCSeconds();
let millisecond = date.getUTCMilliseconds();
return new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(year, month, day, timeZone, offset, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$e57ff100d91bd4b9(date, timeZone) {
return $11d87f3f76e88657$export$1b96692a1ba042ac(date.getTime(), timeZone);
}
function $11d87f3f76e88657$export$d7f92bcd3596b086(date) {
return $11d87f3f76e88657$export$e57ff100d91bd4b9(date, (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)());
}
function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) {
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
}
function $11d87f3f76e88657$export$6f4d78149f3f53ac(date) {
return {
era: date.era,
year: date.year,
month: date.month,
day: date.day
};
}
function $11d87f3f76e88657$export$4d0393e732857be5(date) {
return {
hour: date.hour,
minute: date.minute,
second: date.second,
millisecond: date.millisecond
};
}
function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
let hour = 0, minute = 0, second = 0, millisecond = 0;
if ('timeZone' in date) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = date);
else if ('hour' in date && !time) return date;
if (time) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = time);
return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$d33f79e3ffc3dc83(dateTime) {
return new (0, $35ea8db9cb2ccb90$export$680ea196effce5f)(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
}
function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
if (date.calendar.identifier === calendar.identifier) return date;
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
let copy = date.copy();
copy.calendar = calendar;
copy.era = calendarDate.era;
copy.year = calendarDate.year;
copy.month = calendarDate.month;
copy.day = calendarDate.day;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(copy);
return copy;
}
function $11d87f3f76e88657$export$84c95a83c799e074(date, timeZone, disambiguation) {
if (date instanceof (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)) {
if (date.timeZone === timeZone) return date;
return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
}
let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation);
return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
}
function $11d87f3f76e88657$export$83aac07b4c37b25(date) {
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
return new Date(ms);
}
function $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone) {
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
}
function $11d87f3f76e88657$export$d9b67bc93c097491(date) {
return $11d87f3f76e88657$export$538b00033cc11c75(date, (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)());
}
export {$11d87f3f76e88657$export$bd4fb2bc8bb06fb as epochFromDate, $11d87f3f76e88657$export$b4a036af3fc0b032 as toCalendar, $11d87f3f76e88657$export$59c99f3515d3493f as getTimeZoneOffset, $11d87f3f76e88657$export$136f38efe7caf549 as possibleAbsolutes, $11d87f3f76e88657$export$5107c82f94518f5c as toAbsolute, $11d87f3f76e88657$export$b21e0b124e224484 as toCalendarDateTime, $11d87f3f76e88657$export$e67a095c620b86fe as toDate, $11d87f3f76e88657$export$1b96692a1ba042ac as fromAbsolute, $11d87f3f76e88657$export$e57ff100d91bd4b9 as fromDate, $11d87f3f76e88657$export$d7f92bcd3596b086 as fromDateToLocal, $11d87f3f76e88657$export$93522d1a439f3617 as toCalendarDate, $11d87f3f76e88657$export$6f4d78149f3f53ac as toDateFields, $11d87f3f76e88657$export$4d0393e732857be5 as toTimeFields, $11d87f3f76e88657$export$d33f79e3ffc3dc83 as toTime, $11d87f3f76e88657$export$84c95a83c799e074 as toZoned, $11d87f3f76e88657$export$538b00033cc11c75 as toTimeZone, $11d87f3f76e88657$export$83aac07b4c37b25 as zonedToDate, $11d87f3f76e88657$export$d9b67bc93c097491 as toLocalTimeZone};
//# sourceMappingURL=conversion.module.js.map

View File

@@ -0,0 +1,218 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.module.js";
import {constrain as $735220c2d4774dd3$export$c4e2ecac49351ef2} from "./manipulation.module.js";
import {getExtendedYear as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
import {getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2} from "./queries.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year);
return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
}
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
// Note: Date.UTC() interprets one and two-digit years as being in the
// 20th century, so don't use it
let date = new Date();
date.setUTCHours(hour, minute, second, millisecond);
date.setUTCFullYear(year, month - 1, day);
return date.getTime();
}
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
// Fast path for UTC.
if (timeZone === 'UTC') return 0;
// Fast path: for local timezone after 1970, use native Date.
if (ms > 0 && timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)()) return new Date(ms).getTimezoneOffset() * -60000;
let { year: year, month: month, day: day, hour: hour, minute: minute, second: second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
return utc - Math.floor(ms / 1000) * 1000;
}
const $11d87f3f76e88657$var$formattersByTimeZone = new Map();
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
if (!formatter) {
formatter = new Intl.DateTimeFormat('en-US', {
timeZone: timeZone,
hour12: false,
era: 'short',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
});
$11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
}
let parts = formatter.formatToParts(new Date(ms));
let namedParts = {};
for (let part of parts)if (part.type !== 'literal') namedParts[part.type] = part.value;
return {
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,
month: +namedParts.month,
day: +namedParts.day,
hour: namedParts.hour === '24' ? 0 : +namedParts.hour,
minute: +namedParts.minute,
second: +namedParts.second
};
}
const $11d87f3f76e88657$var$DAYMILLIS = 86400000;
function $11d87f3f76e88657$export$136f38efe7caf549(date, timeZone) {
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date);
let earlier = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
let later = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
return $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later);
}
function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
let found = earlier === later ? [
earlier
] : [
earlier,
later
];
return found.filter((absolute)=>$11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
}
function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
}
function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = 'compatible') {
let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
// Fast path: if the time zone is UTC, use native Date.
if (timeZone === 'UTC') return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
// Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.
if (timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)() && disambiguation === 'compatible') {
dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
// Don't use Date constructor here because two-digit years are interpreted in the 20th century.
let date = new Date();
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(dateTime.era, dateTime.year);
date.setFullYear(year, dateTime.month - 1, dateTime.day);
date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
return date.getTime();
}
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
if (valid.length === 1) return valid[0];
if (valid.length > 1) switch(disambiguation){
// 'compatible' means 'earlier' for "fall back" transitions
case 'compatible':
case 'earlier':
return valid[0];
case 'later':
return valid[valid.length - 1];
case 'reject':
throw new RangeError('Multiple possible absolute times found');
}
switch(disambiguation){
case 'earlier':
return Math.min(ms - offsetBefore, ms - offsetAfter);
// 'compatible' means 'later' for "spring forward" transitions
case 'compatible':
case 'later':
return Math.max(ms - offsetBefore, ms - offsetAfter);
case 'reject':
throw new RangeError('No such absolute time found');
}
}
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = 'compatible') {
return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
}
function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
let offset = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
let date = new Date(ms + offset);
let year = date.getUTCFullYear();
let month = date.getUTCMonth() + 1;
let day = date.getUTCDate();
let hour = date.getUTCHours();
let minute = date.getUTCMinutes();
let second = date.getUTCSeconds();
let millisecond = date.getUTCMilliseconds();
return new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(year, month, day, timeZone, offset, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$e57ff100d91bd4b9(date, timeZone) {
return $11d87f3f76e88657$export$1b96692a1ba042ac(date.getTime(), timeZone);
}
function $11d87f3f76e88657$export$d7f92bcd3596b086(date) {
return $11d87f3f76e88657$export$e57ff100d91bd4b9(date, (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)());
}
function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) {
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
}
function $11d87f3f76e88657$export$6f4d78149f3f53ac(date) {
return {
era: date.era,
year: date.year,
month: date.month,
day: date.day
};
}
function $11d87f3f76e88657$export$4d0393e732857be5(date) {
return {
hour: date.hour,
minute: date.minute,
second: date.second,
millisecond: date.millisecond
};
}
function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
let hour = 0, minute = 0, second = 0, millisecond = 0;
if ('timeZone' in date) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = date);
else if ('hour' in date && !time) return date;
if (time) ({ hour: hour, minute: minute, second: second, millisecond: millisecond } = time);
return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$d33f79e3ffc3dc83(dateTime) {
return new (0, $35ea8db9cb2ccb90$export$680ea196effce5f)(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
}
function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
if (date.calendar.identifier === calendar.identifier) return date;
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
let copy = date.copy();
copy.calendar = calendar;
copy.era = calendarDate.era;
copy.year = calendarDate.year;
copy.month = calendarDate.month;
copy.day = calendarDate.day;
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(copy);
return copy;
}
function $11d87f3f76e88657$export$84c95a83c799e074(date, timeZone, disambiguation) {
if (date instanceof (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)) {
if (date.timeZone === timeZone) return date;
return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
}
let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation);
return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
}
function $11d87f3f76e88657$export$83aac07b4c37b25(date) {
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
return new Date(ms);
}
function $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone) {
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
}
function $11d87f3f76e88657$export$d9b67bc93c097491(date) {
return $11d87f3f76e88657$export$538b00033cc11c75(date, (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)());
}
export {$11d87f3f76e88657$export$bd4fb2bc8bb06fb as epochFromDate, $11d87f3f76e88657$export$b4a036af3fc0b032 as toCalendar, $11d87f3f76e88657$export$59c99f3515d3493f as getTimeZoneOffset, $11d87f3f76e88657$export$136f38efe7caf549 as possibleAbsolutes, $11d87f3f76e88657$export$5107c82f94518f5c as toAbsolute, $11d87f3f76e88657$export$b21e0b124e224484 as toCalendarDateTime, $11d87f3f76e88657$export$e67a095c620b86fe as toDate, $11d87f3f76e88657$export$1b96692a1ba042ac as fromAbsolute, $11d87f3f76e88657$export$e57ff100d91bd4b9 as fromDate, $11d87f3f76e88657$export$d7f92bcd3596b086 as fromDateToLocal, $11d87f3f76e88657$export$93522d1a439f3617 as toCalendarDate, $11d87f3f76e88657$export$6f4d78149f3f53ac as toDateFields, $11d87f3f76e88657$export$4d0393e732857be5 as toTimeFields, $11d87f3f76e88657$export$d33f79e3ffc3dc83 as toTime, $11d87f3f76e88657$export$84c95a83c799e074 as toZoned, $11d87f3f76e88657$export$538b00033cc11c75 as toTimeZone, $11d87f3f76e88657$export$83aac07b4c37b25 as zonedToDate, $11d87f3f76e88657$export$d9b67bc93c097491 as toLocalTimeZone};
//# sourceMappingURL=conversion.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,69 @@
var $561c4ef058278b74$exports = require("./BuddhistCalendar.main.js");
var $4db04d1051af0f2f$exports = require("./EthiopicCalendar.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
var $0f5324ee3bdd9396$exports = require("./HebrewCalendar.main.js");
var $5f1dfa5c67609fe6$exports = require("./IndianCalendar.main.js");
var $ecb2c4cc8c9aae25$exports = require("./IslamicCalendar.main.js");
var $b0ac0602ef646b2c$exports = require("./JapaneseCalendar.main.js");
var $3c060181fc7249ae$exports = require("./PersianCalendar.main.js");
var $9cc5d3577ec40243$exports = require("./TaiwanCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "createCalendar", () => $4922c0a5a69da0ba$export$dd0bbc9b26defe37);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $4922c0a5a69da0ba$export$dd0bbc9b26defe37(name) {
switch(name){
case 'buddhist':
return new (0, $561c4ef058278b74$exports.BuddhistCalendar)();
case 'ethiopic':
return new (0, $4db04d1051af0f2f$exports.EthiopicCalendar)();
case 'ethioaa':
return new (0, $4db04d1051af0f2f$exports.EthiopicAmeteAlemCalendar)();
case 'coptic':
return new (0, $4db04d1051af0f2f$exports.CopticCalendar)();
case 'hebrew':
return new (0, $0f5324ee3bdd9396$exports.HebrewCalendar)();
case 'indian':
return new (0, $5f1dfa5c67609fe6$exports.IndianCalendar)();
case 'islamic-civil':
return new (0, $ecb2c4cc8c9aae25$exports.IslamicCivilCalendar)();
case 'islamic-tbla':
return new (0, $ecb2c4cc8c9aae25$exports.IslamicTabularCalendar)();
case 'islamic-umalqura':
return new (0, $ecb2c4cc8c9aae25$exports.IslamicUmalquraCalendar)();
case 'japanese':
return new (0, $b0ac0602ef646b2c$exports.JapaneseCalendar)();
case 'persian':
return new (0, $3c060181fc7249ae$exports.PersianCalendar)();
case 'roc':
return new (0, $9cc5d3577ec40243$exports.TaiwanCalendar)();
case 'gregory':
default:
return new (0, $af14c9812fdceb33$exports.GregorianCalendar)();
}
}
//# sourceMappingURL=createCalendar.main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcM,SAAS,0CAAe,IAAY;IACzC,OAAQ;QACN,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,0CAAe;QAC5B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,0CAAe;QAC5B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,mDAAwB;QACrC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,wCAAa;QAC1B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,wCAAa;QAC1B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,wCAAa;QAC1B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,8CAAmB;QAChC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,gDAAqB;QAClC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,iDAAsB;QACnC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,0CAAe;QAC5B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAc;QAC3B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,wCAAa;QAC1B,KAAK;QACL;YACE,OAAO,IAAI,CAAA,GAAA,2CAAgB;IAC/B;AACF","sources":["packages/@internationalized/date/src/createCalendar.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 {BuddhistCalendar} from './calendars/BuddhistCalendar';\nimport {Calendar} from './types';\nimport {CopticCalendar, EthiopicAmeteAlemCalendar, EthiopicCalendar} from './calendars/EthiopicCalendar';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {HebrewCalendar} from './calendars/HebrewCalendar';\nimport {IndianCalendar} from './calendars/IndianCalendar';\nimport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nimport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nimport {PersianCalendar} from './calendars/PersianCalendar';\nimport {TaiwanCalendar} from './calendars/TaiwanCalendar';\n\n/** Creates a `Calendar` instance from a Unicode calendar identifier string. */\nexport function createCalendar(name: string): Calendar {\n switch (name) {\n case 'buddhist':\n return new BuddhistCalendar();\n case 'ethiopic':\n return new EthiopicCalendar();\n case 'ethioaa':\n return new EthiopicAmeteAlemCalendar();\n case 'coptic':\n return new CopticCalendar();\n case 'hebrew':\n return new HebrewCalendar();\n case 'indian':\n return new IndianCalendar();\n case 'islamic-civil':\n return new IslamicCivilCalendar();\n case 'islamic-tbla':\n return new IslamicTabularCalendar();\n case 'islamic-umalqura':\n return new IslamicUmalquraCalendar();\n case 'japanese':\n return new JapaneseCalendar();\n case 'persian':\n return new PersianCalendar();\n case 'roc':\n return new TaiwanCalendar();\n case 'gregory':\n default:\n return new GregorianCalendar();\n }\n}\n"],"names":[],"version":3,"file":"createCalendar.main.js.map"}

View File

@@ -0,0 +1,64 @@
import {BuddhistCalendar as $8d73d47422ca7302$export$42d20a78301dee44} from "./BuddhistCalendar.mjs";
import {CopticCalendar as $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1, EthiopicAmeteAlemCalendar as $b956b2d7a6cf451f$export$d72e0c37005a4914, EthiopicCalendar as $b956b2d7a6cf451f$export$26ba6eab5e20cd7d} from "./EthiopicCalendar.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
import {HebrewCalendar as $7c5f6fbf42389787$export$ca405048b8fb5af} from "./HebrewCalendar.mjs";
import {IndianCalendar as $82c358003bdda0a8$export$39f31c639fa15726} from "./IndianCalendar.mjs";
import {IslamicCivilCalendar as $f2f3e0e3a817edbd$export$2066795aadd37bfc, IslamicTabularCalendar as $f2f3e0e3a817edbd$export$37f0887f2f9d22f7, IslamicUmalquraCalendar as $f2f3e0e3a817edbd$export$5baab4758c231076} from "./IslamicCalendar.mjs";
import {JapaneseCalendar as $62225008020f0a13$export$b746ab2b60cdffbf} from "./JapaneseCalendar.mjs";
import {PersianCalendar as $f3ed2e4472ae7e25$export$37fccdbfd14c5939} from "./PersianCalendar.mjs";
import {TaiwanCalendar as $5f31bd6f0c8940b2$export$65e01080afcb0799} from "./TaiwanCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $64244302c3013299$export$dd0bbc9b26defe37(name) {
switch(name){
case 'buddhist':
return new (0, $8d73d47422ca7302$export$42d20a78301dee44)();
case 'ethiopic':
return new (0, $b956b2d7a6cf451f$export$26ba6eab5e20cd7d)();
case 'ethioaa':
return new (0, $b956b2d7a6cf451f$export$d72e0c37005a4914)();
case 'coptic':
return new (0, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1)();
case 'hebrew':
return new (0, $7c5f6fbf42389787$export$ca405048b8fb5af)();
case 'indian':
return new (0, $82c358003bdda0a8$export$39f31c639fa15726)();
case 'islamic-civil':
return new (0, $f2f3e0e3a817edbd$export$2066795aadd37bfc)();
case 'islamic-tbla':
return new (0, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7)();
case 'islamic-umalqura':
return new (0, $f2f3e0e3a817edbd$export$5baab4758c231076)();
case 'japanese':
return new (0, $62225008020f0a13$export$b746ab2b60cdffbf)();
case 'persian':
return new (0, $f3ed2e4472ae7e25$export$37fccdbfd14c5939)();
case 'roc':
return new (0, $5f31bd6f0c8940b2$export$65e01080afcb0799)();
case 'gregory':
default:
return new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
}
}
export {$64244302c3013299$export$dd0bbc9b26defe37 as createCalendar};
//# sourceMappingURL=createCalendar.module.js.map

View File

@@ -0,0 +1,64 @@
import {BuddhistCalendar as $8d73d47422ca7302$export$42d20a78301dee44} from "./BuddhistCalendar.module.js";
import {CopticCalendar as $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1, EthiopicAmeteAlemCalendar as $b956b2d7a6cf451f$export$d72e0c37005a4914, EthiopicCalendar as $b956b2d7a6cf451f$export$26ba6eab5e20cd7d} from "./EthiopicCalendar.module.js";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
import {HebrewCalendar as $7c5f6fbf42389787$export$ca405048b8fb5af} from "./HebrewCalendar.module.js";
import {IndianCalendar as $82c358003bdda0a8$export$39f31c639fa15726} from "./IndianCalendar.module.js";
import {IslamicCivilCalendar as $f2f3e0e3a817edbd$export$2066795aadd37bfc, IslamicTabularCalendar as $f2f3e0e3a817edbd$export$37f0887f2f9d22f7, IslamicUmalquraCalendar as $f2f3e0e3a817edbd$export$5baab4758c231076} from "./IslamicCalendar.module.js";
import {JapaneseCalendar as $62225008020f0a13$export$b746ab2b60cdffbf} from "./JapaneseCalendar.module.js";
import {PersianCalendar as $f3ed2e4472ae7e25$export$37fccdbfd14c5939} from "./PersianCalendar.module.js";
import {TaiwanCalendar as $5f31bd6f0c8940b2$export$65e01080afcb0799} from "./TaiwanCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $64244302c3013299$export$dd0bbc9b26defe37(name) {
switch(name){
case 'buddhist':
return new (0, $8d73d47422ca7302$export$42d20a78301dee44)();
case 'ethiopic':
return new (0, $b956b2d7a6cf451f$export$26ba6eab5e20cd7d)();
case 'ethioaa':
return new (0, $b956b2d7a6cf451f$export$d72e0c37005a4914)();
case 'coptic':
return new (0, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1)();
case 'hebrew':
return new (0, $7c5f6fbf42389787$export$ca405048b8fb5af)();
case 'indian':
return new (0, $82c358003bdda0a8$export$39f31c639fa15726)();
case 'islamic-civil':
return new (0, $f2f3e0e3a817edbd$export$2066795aadd37bfc)();
case 'islamic-tbla':
return new (0, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7)();
case 'islamic-umalqura':
return new (0, $f2f3e0e3a817edbd$export$5baab4758c231076)();
case 'japanese':
return new (0, $62225008020f0a13$export$b746ab2b60cdffbf)();
case 'persian':
return new (0, $f3ed2e4472ae7e25$export$37fccdbfd14c5939)();
case 'roc':
return new (0, $5f31bd6f0c8940b2$export$65e01080afcb0799)();
case 'gregory':
default:
return new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
}
}
export {$64244302c3013299$export$dd0bbc9b26defe37 as createCalendar};
//# sourceMappingURL=createCalendar.module.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAcM,SAAS,0CAAe,IAAY;IACzC,OAAQ;QACN,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAe;QAC5B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAe;QAC5B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAwB;QACrC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAa;QAC1B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,wCAAa;QAC1B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAa;QAC1B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAmB;QAChC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAqB;QAClC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAsB;QACnC,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAe;QAC5B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAc;QAC3B,KAAK;YACH,OAAO,IAAI,CAAA,GAAA,yCAAa;QAC1B,KAAK;QACL;YACE,OAAO,IAAI,CAAA,GAAA,yCAAgB;IAC/B;AACF","sources":["packages/@internationalized/date/src/createCalendar.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 {BuddhistCalendar} from './calendars/BuddhistCalendar';\nimport {Calendar} from './types';\nimport {CopticCalendar, EthiopicAmeteAlemCalendar, EthiopicCalendar} from './calendars/EthiopicCalendar';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {HebrewCalendar} from './calendars/HebrewCalendar';\nimport {IndianCalendar} from './calendars/IndianCalendar';\nimport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nimport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nimport {PersianCalendar} from './calendars/PersianCalendar';\nimport {TaiwanCalendar} from './calendars/TaiwanCalendar';\n\n/** Creates a `Calendar` instance from a Unicode calendar identifier string. */\nexport function createCalendar(name: string): Calendar {\n switch (name) {\n case 'buddhist':\n return new BuddhistCalendar();\n case 'ethiopic':\n return new EthiopicCalendar();\n case 'ethioaa':\n return new EthiopicAmeteAlemCalendar();\n case 'coptic':\n return new CopticCalendar();\n case 'hebrew':\n return new HebrewCalendar();\n case 'indian':\n return new IndianCalendar();\n case 'islamic-civil':\n return new IslamicCivilCalendar();\n case 'islamic-tbla':\n return new IslamicTabularCalendar();\n case 'islamic-umalqura':\n return new IslamicUmalquraCalendar();\n case 'japanese':\n return new JapaneseCalendar();\n case 'persian':\n return new PersianCalendar();\n case 'roc':\n return new TaiwanCalendar();\n case 'gregory':\n default:\n return new GregorianCalendar();\n }\n}\n"],"names":[],"version":3,"file":"createCalendar.module.js.map"}

View File

@@ -0,0 +1,45 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
import {JapaneseCalendar as $62225008020f0a13$export$b746ab2b60cdffbf} from "./JapaneseCalendar.mjs";
import {BuddhistCalendar as $8d73d47422ca7302$export$42d20a78301dee44} from "./BuddhistCalendar.mjs";
import {TaiwanCalendar as $5f31bd6f0c8940b2$export$65e01080afcb0799} from "./TaiwanCalendar.mjs";
import {PersianCalendar as $f3ed2e4472ae7e25$export$37fccdbfd14c5939} from "./PersianCalendar.mjs";
import {IndianCalendar as $82c358003bdda0a8$export$39f31c639fa15726} from "./IndianCalendar.mjs";
import {IslamicCivilCalendar as $f2f3e0e3a817edbd$export$2066795aadd37bfc, IslamicTabularCalendar as $f2f3e0e3a817edbd$export$37f0887f2f9d22f7, IslamicUmalquraCalendar as $f2f3e0e3a817edbd$export$5baab4758c231076} from "./IslamicCalendar.mjs";
import {HebrewCalendar as $7c5f6fbf42389787$export$ca405048b8fb5af} from "./HebrewCalendar.mjs";
import {CopticCalendar as $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1, EthiopicAmeteAlemCalendar as $b956b2d7a6cf451f$export$d72e0c37005a4914, EthiopicCalendar as $b956b2d7a6cf451f$export$26ba6eab5e20cd7d} from "./EthiopicCalendar.mjs";
import {createCalendar as $64244302c3013299$export$dd0bbc9b26defe37} from "./createCalendar.mjs";
import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, fromDate as $11d87f3f76e88657$export$e57ff100d91bd4b9, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toLocalTimeZone as $11d87f3f76e88657$export$d9b67bc93c097491, toTime as $11d87f3f76e88657$export$d33f79e3ffc3dc83, toTimeZone as $11d87f3f76e88657$export$538b00033cc11c75, toZoned as $11d87f3f76e88657$export$84c95a83c799e074} from "./conversion.mjs";
import {endOfMonth as $14e0f24ef4ac5c92$export$a2258d9c4118825c, endOfWeek as $14e0f24ef4ac5c92$export$ef8b6d9133084f4e, endOfYear as $14e0f24ef4ac5c92$export$8b7aa55c66d5569e, getDayOfWeek as $14e0f24ef4ac5c92$export$2061056d06d7cdf7, getHoursInDay as $14e0f24ef4ac5c92$export$126c91c941de7e, getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2, getMinimumDayInMonth as $14e0f24ef4ac5c92$export$b2f4953d301981d5, getMinimumMonthInYear as $14e0f24ef4ac5c92$export$5412ac11713b72ad, getWeeksInMonth as $14e0f24ef4ac5c92$export$ccc1b2479e7dd654, isEqualDay as $14e0f24ef4ac5c92$export$91b62ebf2ba703ee, isEqualMonth as $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2, isEqualYear as $14e0f24ef4ac5c92$export$ea840f5a6dda8147, isSameDay as $14e0f24ef4ac5c92$export$ea39ec197993aef0, isSameMonth as $14e0f24ef4ac5c92$export$a18c89cbd24170ff, isSameYear as $14e0f24ef4ac5c92$export$5841f9eb9773f25f, isToday as $14e0f24ef4ac5c92$export$629b0a497aa65267, isWeekday as $14e0f24ef4ac5c92$export$ee9d87258e1d19ed, isWeekend as $14e0f24ef4ac5c92$export$618d60ea299da42, maxDate as $14e0f24ef4ac5c92$export$a75f2bff57811055, minDate as $14e0f24ef4ac5c92$export$5c333a116e949cdd, now as $14e0f24ef4ac5c92$export$461939dd4422153, startOfMonth as $14e0f24ef4ac5c92$export$a5a3b454ada2268e, startOfWeek as $14e0f24ef4ac5c92$export$42c81a444fbfb5d4, startOfYear as $14e0f24ef4ac5c92$export$f91e89d3d0406102, today as $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3} from "./queries.mjs";
import {parseAbsolute as $fae977aafc393c5c$export$5adfdab05168c219, parseAbsoluteToLocal as $fae977aafc393c5c$export$8e384432362ed0f0, parseDate as $fae977aafc393c5c$export$6b862160d295c8e, parseDateTime as $fae977aafc393c5c$export$588937bcd60ade55, parseDuration as $fae977aafc393c5c$export$ecae829bb3747ea6, parseTime as $fae977aafc393c5c$export$c9698ec7f05a07e1, parseZonedDateTime as $fae977aafc393c5c$export$fd7893f06e92a6a4} from "./string.mjs";
import {DateFormatter as $fb18d541ea1ad717$export$ad991b66133851cf} from "./DateFormatter.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$35ea8db9cb2ccb90$export$99faa760c7908e4f as CalendarDate, $35ea8db9cb2ccb90$export$ca871e8dbb80966f as CalendarDateTime, $35ea8db9cb2ccb90$export$680ea196effce5f as Time, $35ea8db9cb2ccb90$export$d3b7288e7994edea as ZonedDateTime, $3b62074eb05584b2$export$80ee6245ec4f29ec as GregorianCalendar, $62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar, $8d73d47422ca7302$export$42d20a78301dee44 as BuddhistCalendar, $5f31bd6f0c8940b2$export$65e01080afcb0799 as TaiwanCalendar, $f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar, $82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar, $f2f3e0e3a817edbd$export$2066795aadd37bfc as IslamicCivilCalendar, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $f2f3e0e3a817edbd$export$5baab4758c231076 as IslamicUmalquraCalendar, $7c5f6fbf42389787$export$ca405048b8fb5af as HebrewCalendar, $b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar, $64244302c3013299$export$dd0bbc9b26defe37 as createCalendar, $11d87f3f76e88657$export$93522d1a439f3617 as toCalendarDate, $11d87f3f76e88657$export$b21e0b124e224484 as toCalendarDateTime, $11d87f3f76e88657$export$d33f79e3ffc3dc83 as toTime, $11d87f3f76e88657$export$b4a036af3fc0b032 as toCalendar, $11d87f3f76e88657$export$84c95a83c799e074 as toZoned, $11d87f3f76e88657$export$538b00033cc11c75 as toTimeZone, $11d87f3f76e88657$export$d9b67bc93c097491 as toLocalTimeZone, $11d87f3f76e88657$export$e57ff100d91bd4b9 as fromDate, $11d87f3f76e88657$export$1b96692a1ba042ac as fromAbsolute, $14e0f24ef4ac5c92$export$ea39ec197993aef0 as isSameDay, $14e0f24ef4ac5c92$export$a18c89cbd24170ff as isSameMonth, $14e0f24ef4ac5c92$export$5841f9eb9773f25f as isSameYear, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee as isEqualDay, $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2 as isEqualMonth, $14e0f24ef4ac5c92$export$ea840f5a6dda8147 as isEqualYear, $14e0f24ef4ac5c92$export$629b0a497aa65267 as isToday, $14e0f24ef4ac5c92$export$2061056d06d7cdf7 as getDayOfWeek, $14e0f24ef4ac5c92$export$461939dd4422153 as now, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3 as today, $14e0f24ef4ac5c92$export$126c91c941de7e as getHoursInDay, $14e0f24ef4ac5c92$export$aa8b41735afcabd2 as getLocalTimeZone, $14e0f24ef4ac5c92$export$a5a3b454ada2268e as startOfMonth, $14e0f24ef4ac5c92$export$42c81a444fbfb5d4 as startOfWeek, $14e0f24ef4ac5c92$export$f91e89d3d0406102 as startOfYear, $14e0f24ef4ac5c92$export$a2258d9c4118825c as endOfMonth, $14e0f24ef4ac5c92$export$ef8b6d9133084f4e as endOfWeek, $14e0f24ef4ac5c92$export$8b7aa55c66d5569e as endOfYear, $14e0f24ef4ac5c92$export$5412ac11713b72ad as getMinimumMonthInYear, $14e0f24ef4ac5c92$export$b2f4953d301981d5 as getMinimumDayInMonth, $14e0f24ef4ac5c92$export$ccc1b2479e7dd654 as getWeeksInMonth, $14e0f24ef4ac5c92$export$5c333a116e949cdd as minDate, $14e0f24ef4ac5c92$export$a75f2bff57811055 as maxDate, $14e0f24ef4ac5c92$export$618d60ea299da42 as isWeekend, $14e0f24ef4ac5c92$export$ee9d87258e1d19ed as isWeekday, $fae977aafc393c5c$export$6b862160d295c8e as parseDate, $fae977aafc393c5c$export$588937bcd60ade55 as parseDateTime, $fae977aafc393c5c$export$c9698ec7f05a07e1 as parseTime, $fae977aafc393c5c$export$5adfdab05168c219 as parseAbsolute, $fae977aafc393c5c$export$8e384432362ed0f0 as parseAbsoluteToLocal, $fae977aafc393c5c$export$fd7893f06e92a6a4 as parseZonedDateTime, $fae977aafc393c5c$export$ecae829bb3747ea6 as parseDuration, $fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
//# sourceMappingURL=module.js.map

View File

@@ -0,0 +1,109 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
var $b0ac0602ef646b2c$exports = require("./JapaneseCalendar.main.js");
var $561c4ef058278b74$exports = require("./BuddhistCalendar.main.js");
var $9cc5d3577ec40243$exports = require("./TaiwanCalendar.main.js");
var $3c060181fc7249ae$exports = require("./PersianCalendar.main.js");
var $5f1dfa5c67609fe6$exports = require("./IndianCalendar.main.js");
var $ecb2c4cc8c9aae25$exports = require("./IslamicCalendar.main.js");
var $0f5324ee3bdd9396$exports = require("./HebrewCalendar.main.js");
var $4db04d1051af0f2f$exports = require("./EthiopicCalendar.main.js");
var $4922c0a5a69da0ba$exports = require("./createCalendar.main.js");
var $4ae0260a69729f1d$exports = require("./conversion.main.js");
var $1f0f7ebf1ae6c530$exports = require("./queries.main.js");
var $4c32e2d98e5a5134$exports = require("./string.main.js");
var $8f23a04ae90a588b$exports = require("./DateFormatter.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "CalendarDate", () => $625ad1e1f4c43bc1$exports.CalendarDate);
$parcel$export(module.exports, "CalendarDateTime", () => $625ad1e1f4c43bc1$exports.CalendarDateTime);
$parcel$export(module.exports, "Time", () => $625ad1e1f4c43bc1$exports.Time);
$parcel$export(module.exports, "ZonedDateTime", () => $625ad1e1f4c43bc1$exports.ZonedDateTime);
$parcel$export(module.exports, "GregorianCalendar", () => $af14c9812fdceb33$exports.GregorianCalendar);
$parcel$export(module.exports, "JapaneseCalendar", () => $b0ac0602ef646b2c$exports.JapaneseCalendar);
$parcel$export(module.exports, "BuddhistCalendar", () => $561c4ef058278b74$exports.BuddhistCalendar);
$parcel$export(module.exports, "TaiwanCalendar", () => $9cc5d3577ec40243$exports.TaiwanCalendar);
$parcel$export(module.exports, "PersianCalendar", () => $3c060181fc7249ae$exports.PersianCalendar);
$parcel$export(module.exports, "IndianCalendar", () => $5f1dfa5c67609fe6$exports.IndianCalendar);
$parcel$export(module.exports, "IslamicCivilCalendar", () => $ecb2c4cc8c9aae25$exports.IslamicCivilCalendar);
$parcel$export(module.exports, "IslamicTabularCalendar", () => $ecb2c4cc8c9aae25$exports.IslamicTabularCalendar);
$parcel$export(module.exports, "IslamicUmalquraCalendar", () => $ecb2c4cc8c9aae25$exports.IslamicUmalquraCalendar);
$parcel$export(module.exports, "HebrewCalendar", () => $0f5324ee3bdd9396$exports.HebrewCalendar);
$parcel$export(module.exports, "EthiopicCalendar", () => $4db04d1051af0f2f$exports.EthiopicCalendar);
$parcel$export(module.exports, "EthiopicAmeteAlemCalendar", () => $4db04d1051af0f2f$exports.EthiopicAmeteAlemCalendar);
$parcel$export(module.exports, "CopticCalendar", () => $4db04d1051af0f2f$exports.CopticCalendar);
$parcel$export(module.exports, "createCalendar", () => $4922c0a5a69da0ba$exports.createCalendar);
$parcel$export(module.exports, "toCalendarDate", () => $4ae0260a69729f1d$exports.toCalendarDate);
$parcel$export(module.exports, "toCalendarDateTime", () => $4ae0260a69729f1d$exports.toCalendarDateTime);
$parcel$export(module.exports, "toTime", () => $4ae0260a69729f1d$exports.toTime);
$parcel$export(module.exports, "toCalendar", () => $4ae0260a69729f1d$exports.toCalendar);
$parcel$export(module.exports, "toZoned", () => $4ae0260a69729f1d$exports.toZoned);
$parcel$export(module.exports, "toTimeZone", () => $4ae0260a69729f1d$exports.toTimeZone);
$parcel$export(module.exports, "toLocalTimeZone", () => $4ae0260a69729f1d$exports.toLocalTimeZone);
$parcel$export(module.exports, "fromDate", () => $4ae0260a69729f1d$exports.fromDate);
$parcel$export(module.exports, "fromAbsolute", () => $4ae0260a69729f1d$exports.fromAbsolute);
$parcel$export(module.exports, "isSameDay", () => $1f0f7ebf1ae6c530$exports.isSameDay);
$parcel$export(module.exports, "isSameMonth", () => $1f0f7ebf1ae6c530$exports.isSameMonth);
$parcel$export(module.exports, "isSameYear", () => $1f0f7ebf1ae6c530$exports.isSameYear);
$parcel$export(module.exports, "isEqualDay", () => $1f0f7ebf1ae6c530$exports.isEqualDay);
$parcel$export(module.exports, "isEqualMonth", () => $1f0f7ebf1ae6c530$exports.isEqualMonth);
$parcel$export(module.exports, "isEqualYear", () => $1f0f7ebf1ae6c530$exports.isEqualYear);
$parcel$export(module.exports, "isToday", () => $1f0f7ebf1ae6c530$exports.isToday);
$parcel$export(module.exports, "getDayOfWeek", () => $1f0f7ebf1ae6c530$exports.getDayOfWeek);
$parcel$export(module.exports, "now", () => $1f0f7ebf1ae6c530$exports.now);
$parcel$export(module.exports, "today", () => $1f0f7ebf1ae6c530$exports.today);
$parcel$export(module.exports, "getHoursInDay", () => $1f0f7ebf1ae6c530$exports.getHoursInDay);
$parcel$export(module.exports, "getLocalTimeZone", () => $1f0f7ebf1ae6c530$exports.getLocalTimeZone);
$parcel$export(module.exports, "startOfMonth", () => $1f0f7ebf1ae6c530$exports.startOfMonth);
$parcel$export(module.exports, "startOfWeek", () => $1f0f7ebf1ae6c530$exports.startOfWeek);
$parcel$export(module.exports, "startOfYear", () => $1f0f7ebf1ae6c530$exports.startOfYear);
$parcel$export(module.exports, "endOfMonth", () => $1f0f7ebf1ae6c530$exports.endOfMonth);
$parcel$export(module.exports, "endOfWeek", () => $1f0f7ebf1ae6c530$exports.endOfWeek);
$parcel$export(module.exports, "endOfYear", () => $1f0f7ebf1ae6c530$exports.endOfYear);
$parcel$export(module.exports, "getMinimumMonthInYear", () => $1f0f7ebf1ae6c530$exports.getMinimumMonthInYear);
$parcel$export(module.exports, "getMinimumDayInMonth", () => $1f0f7ebf1ae6c530$exports.getMinimumDayInMonth);
$parcel$export(module.exports, "getWeeksInMonth", () => $1f0f7ebf1ae6c530$exports.getWeeksInMonth);
$parcel$export(module.exports, "minDate", () => $1f0f7ebf1ae6c530$exports.minDate);
$parcel$export(module.exports, "maxDate", () => $1f0f7ebf1ae6c530$exports.maxDate);
$parcel$export(module.exports, "isWeekend", () => $1f0f7ebf1ae6c530$exports.isWeekend);
$parcel$export(module.exports, "isWeekday", () => $1f0f7ebf1ae6c530$exports.isWeekday);
$parcel$export(module.exports, "parseDate", () => $4c32e2d98e5a5134$exports.parseDate);
$parcel$export(module.exports, "parseDateTime", () => $4c32e2d98e5a5134$exports.parseDateTime);
$parcel$export(module.exports, "parseTime", () => $4c32e2d98e5a5134$exports.parseTime);
$parcel$export(module.exports, "parseAbsolute", () => $4c32e2d98e5a5134$exports.parseAbsolute);
$parcel$export(module.exports, "parseAbsoluteToLocal", () => $4c32e2d98e5a5134$exports.parseAbsoluteToLocal);
$parcel$export(module.exports, "parseZonedDateTime", () => $4c32e2d98e5a5134$exports.parseZonedDateTime);
$parcel$export(module.exports, "parseDuration", () => $4c32e2d98e5a5134$exports.parseDuration);
$parcel$export(module.exports, "DateFormatter", () => $8f23a04ae90a588b$exports.DateFormatter);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
//# sourceMappingURL=main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@internationalized/date/src/index.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\nexport type {\n AnyCalendarDate,\n AnyTime,\n AnyDateTime,\n Calendar,\n DateDuration,\n TimeDuration,\n DateTimeDuration,\n DateFields,\n TimeFields,\n DateField,\n TimeField,\n Disambiguation,\n CycleOptions,\n CycleTimeOptions\n} from './types';\n\nexport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nexport {GregorianCalendar} from './calendars/GregorianCalendar';\nexport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nexport {BuddhistCalendar} from './calendars/BuddhistCalendar';\nexport {TaiwanCalendar} from './calendars/TaiwanCalendar';\nexport {PersianCalendar} from './calendars/PersianCalendar';\nexport {IndianCalendar} from './calendars/IndianCalendar';\nexport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nexport {HebrewCalendar} from './calendars/HebrewCalendar';\nexport {EthiopicCalendar, EthiopicAmeteAlemCalendar, CopticCalendar} from './calendars/EthiopicCalendar';\nexport {createCalendar} from './createCalendar';\nexport {\n toCalendarDate,\n toCalendarDateTime,\n toTime,\n toCalendar,\n toZoned,\n toTimeZone,\n toLocalTimeZone,\n fromDate,\n fromAbsolute\n} from './conversion';\nexport {\n isSameDay,\n isSameMonth,\n isSameYear,\n isEqualDay,\n isEqualMonth,\n isEqualYear,\n isToday,\n getDayOfWeek,\n now,\n today,\n getHoursInDay,\n getLocalTimeZone,\n startOfMonth,\n startOfWeek,\n startOfYear,\n endOfMonth,\n endOfWeek,\n endOfYear,\n getMinimumMonthInYear,\n getMinimumDayInMonth,\n getWeeksInMonth,\n minDate,\n maxDate,\n isWeekend,\n isWeekday\n} from './queries';\nexport {\n parseDate,\n parseDateTime,\n parseTime,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseZonedDateTime,\n parseDuration\n} from './string';\nexport {DateFormatter} from './DateFormatter';\n"],"names":[],"version":3,"file":"main.js.map"}

View File

@@ -0,0 +1,362 @@
var $4ae0260a69729f1d$exports = require("./conversion.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "add", () => $5c0571aa5b6fb5da$export$e16d8520af44a096);
$parcel$export(module.exports, "constrain", () => $5c0571aa5b6fb5da$export$c4e2ecac49351ef2);
$parcel$export(module.exports, "subtract", () => $5c0571aa5b6fb5da$export$4e2d2ead65e5f7e3);
$parcel$export(module.exports, "set", () => $5c0571aa5b6fb5da$export$adaa4cf7ef1b65be);
$parcel$export(module.exports, "setTime", () => $5c0571aa5b6fb5da$export$e5d5e1c1822b6e56);
$parcel$export(module.exports, "constrainTime", () => $5c0571aa5b6fb5da$export$7555de1e070510cb);
$parcel$export(module.exports, "addTime", () => $5c0571aa5b6fb5da$export$7ed87b6bc2506470);
$parcel$export(module.exports, "subtractTime", () => $5c0571aa5b6fb5da$export$fe34d3a381cd7501);
$parcel$export(module.exports, "cycleDate", () => $5c0571aa5b6fb5da$export$d52ced6badfb9a4c);
$parcel$export(module.exports, "cycleTime", () => $5c0571aa5b6fb5da$export$dd02b3e0007dfe28);
$parcel$export(module.exports, "addZoned", () => $5c0571aa5b6fb5da$export$96b1d28349274637);
$parcel$export(module.exports, "subtractZoned", () => $5c0571aa5b6fb5da$export$6814caac34ca03c7);
$parcel$export(module.exports, "cycleZoned", () => $5c0571aa5b6fb5da$export$9a297d111fc86b79);
$parcel$export(module.exports, "setZoned", () => $5c0571aa5b6fb5da$export$31b5430eb18be4f8);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $5c0571aa5b6fb5da$var$ONE_HOUR = 3600000;
function $5c0571aa5b6fb5da$export$e16d8520af44a096(date, duration) {
let mutableDate = date.copy();
let days = 'hour' in mutableDate ? $5c0571aa5b6fb5da$var$addTimeFields(mutableDate, duration) : 0;
$5c0571aa5b6fb5da$var$addYears(mutableDate, duration.years || 0);
if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
mutableDate.month += duration.months || 0;
$5c0571aa5b6fb5da$var$balanceYearMonth(mutableDate);
$5c0571aa5b6fb5da$var$constrainMonthDay(mutableDate);
mutableDate.day += (duration.weeks || 0) * 7;
mutableDate.day += duration.days || 0;
mutableDate.day += days;
$5c0571aa5b6fb5da$var$balanceDay(mutableDate);
if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
// Constrain in case adding ended up with a date outside the valid range for the calendar system.
// The behavior here is slightly different than when constraining in the `set` function in that
// we adjust smaller fields to their minimum/maximum values rather than constraining each field
// individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.
if (mutableDate.year < 1) {
mutableDate.year = 1;
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
if (mutableDate.year > maxYear) {
var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
mutableDate.year = maxYear;
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
}
if (mutableDate.month < 1) {
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
if (mutableDate.month > maxMonth) {
mutableDate.month = maxMonth;
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
}
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
return mutableDate;
}
function $5c0571aa5b6fb5da$var$addYears(date, years) {
var _date_calendar_isInverseEra, _date_calendar;
if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
date.year += years;
}
function $5c0571aa5b6fb5da$var$balanceYearMonth(date) {
while(date.month < 1){
$5c0571aa5b6fb5da$var$addYears(date, -1);
date.month += date.calendar.getMonthsInYear(date);
}
let monthsInYear = 0;
while(date.month > (monthsInYear = date.calendar.getMonthsInYear(date))){
date.month -= monthsInYear;
$5c0571aa5b6fb5da$var$addYears(date, 1);
}
}
function $5c0571aa5b6fb5da$var$balanceDay(date) {
while(date.day < 1){
date.month--;
$5c0571aa5b6fb5da$var$balanceYearMonth(date);
date.day += date.calendar.getDaysInMonth(date);
}
while(date.day > date.calendar.getDaysInMonth(date)){
date.day -= date.calendar.getDaysInMonth(date);
date.month++;
$5c0571aa5b6fb5da$var$balanceYearMonth(date);
}
}
function $5c0571aa5b6fb5da$var$constrainMonthDay(date) {
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
}
function $5c0571aa5b6fb5da$export$c4e2ecac49351ef2(date) {
if (date.calendar.constrainDate) date.calendar.constrainDate(date);
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
$5c0571aa5b6fb5da$var$constrainMonthDay(date);
}
function $5c0571aa5b6fb5da$export$3e2544e88a25bff8(duration) {
let inverseDuration = {};
for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
return inverseDuration;
}
function $5c0571aa5b6fb5da$export$4e2d2ead65e5f7e3(date, duration) {
return $5c0571aa5b6fb5da$export$e16d8520af44a096(date, $5c0571aa5b6fb5da$export$3e2544e88a25bff8(duration));
}
function $5c0571aa5b6fb5da$export$adaa4cf7ef1b65be(date, fields) {
let mutableDate = date.copy();
if (fields.era != null) mutableDate.era = fields.era;
if (fields.year != null) mutableDate.year = fields.year;
if (fields.month != null) mutableDate.month = fields.month;
if (fields.day != null) mutableDate.day = fields.day;
$5c0571aa5b6fb5da$export$c4e2ecac49351ef2(mutableDate);
return mutableDate;
}
function $5c0571aa5b6fb5da$export$e5d5e1c1822b6e56(value, fields) {
let mutableValue = value.copy();
if (fields.hour != null) mutableValue.hour = fields.hour;
if (fields.minute != null) mutableValue.minute = fields.minute;
if (fields.second != null) mutableValue.second = fields.second;
if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
$5c0571aa5b6fb5da$export$7555de1e070510cb(mutableValue);
return mutableValue;
}
function $5c0571aa5b6fb5da$var$balanceTime(time) {
time.second += Math.floor(time.millisecond / 1000);
time.millisecond = $5c0571aa5b6fb5da$var$nonNegativeMod(time.millisecond, 1000);
time.minute += Math.floor(time.second / 60);
time.second = $5c0571aa5b6fb5da$var$nonNegativeMod(time.second, 60);
time.hour += Math.floor(time.minute / 60);
time.minute = $5c0571aa5b6fb5da$var$nonNegativeMod(time.minute, 60);
let days = Math.floor(time.hour / 24);
time.hour = $5c0571aa5b6fb5da$var$nonNegativeMod(time.hour, 24);
return days;
}
function $5c0571aa5b6fb5da$export$7555de1e070510cb(time) {
time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
time.second = Math.max(0, Math.min(time.second, 59));
time.minute = Math.max(0, Math.min(time.minute, 59));
time.hour = Math.max(0, Math.min(time.hour, 23));
}
function $5c0571aa5b6fb5da$var$nonNegativeMod(a, b) {
let result = a % b;
if (result < 0) result += b;
return result;
}
function $5c0571aa5b6fb5da$var$addTimeFields(time, duration) {
time.hour += duration.hours || 0;
time.minute += duration.minutes || 0;
time.second += duration.seconds || 0;
time.millisecond += duration.milliseconds || 0;
return $5c0571aa5b6fb5da$var$balanceTime(time);
}
function $5c0571aa5b6fb5da$export$7ed87b6bc2506470(time, duration) {
let res = time.copy();
$5c0571aa5b6fb5da$var$addTimeFields(res, duration);
return res;
}
function $5c0571aa5b6fb5da$export$fe34d3a381cd7501(time, duration) {
return $5c0571aa5b6fb5da$export$7ed87b6bc2506470(time, $5c0571aa5b6fb5da$export$3e2544e88a25bff8(duration));
}
function $5c0571aa5b6fb5da$export$d52ced6badfb9a4c(value, field, amount, options) {
let mutable = value.copy();
switch(field){
case 'era':
{
let eras = value.calendar.getEras();
let eraIndex = eras.indexOf(value.era);
if (eraIndex < 0) throw new Error('Invalid era: ' + value.era);
eraIndex = $5c0571aa5b6fb5da$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
mutable.era = eras[eraIndex];
// Constrain the year and other fields within the era, so the era doesn't change when we balance below.
$5c0571aa5b6fb5da$export$c4e2ecac49351ef2(mutable);
break;
}
case 'year':
var _mutable_calendar_isInverseEra, _mutable_calendar;
if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
// The year field should not cycle within the era as that can cause weird behavior affecting other fields.
// We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back
// we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.
mutable.year = $5c0571aa5b6fb5da$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
if (mutable.year === -Infinity) mutable.year = 1;
if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
break;
case 'month':
mutable.month = $5c0571aa5b6fb5da$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
break;
case 'day':
mutable.day = $5c0571aa5b6fb5da$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
break;
default:
throw new Error('Unsupported field ' + field);
}
if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
$5c0571aa5b6fb5da$export$c4e2ecac49351ef2(mutable);
return mutable;
}
function $5c0571aa5b6fb5da$export$dd02b3e0007dfe28(value, field, amount, options) {
let mutable = value.copy();
switch(field){
case 'hour':
{
let hours = value.hour;
let min = 0;
let max = 23;
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
let isPM = hours >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
mutable.hour = $5c0571aa5b6fb5da$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
break;
}
case 'minute':
mutable.minute = $5c0571aa5b6fb5da$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
break;
case 'second':
mutable.second = $5c0571aa5b6fb5da$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
break;
case 'millisecond':
mutable.millisecond = $5c0571aa5b6fb5da$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
break;
default:
throw new Error('Unsupported field ' + field);
}
return mutable;
}
function $5c0571aa5b6fb5da$var$cycleValue(value, amount, min, max, round = false) {
if (round) {
value += Math.sign(amount);
if (value < min) value = max;
let div = Math.abs(amount);
if (amount > 0) value = Math.ceil(value / div) * div;
else value = Math.floor(value / div) * div;
if (value > max) value = min;
} else {
value += amount;
if (value < min) value = max - (min - value - 1);
else if (value > max) value = min + (value - max - 1);
}
return value;
}
function $5c0571aa5b6fb5da$export$96b1d28349274637(dateTime, duration) {
let ms;
if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
let res = $5c0571aa5b6fb5da$export$e16d8520af44a096((0, $4ae0260a69729f1d$exports.toCalendarDateTime)(dateTime), {
years: duration.years,
months: duration.months,
weeks: duration.weeks,
days: duration.days
});
// Changing the date may change the timezone offset, so we need to recompute
// using the 'compatible' disambiguation.
ms = (0, $4ae0260a69729f1d$exports.toAbsolute)(res, dateTime.timeZone);
} else // Otherwise, preserve the offset of the original date.
ms = (0, $4ae0260a69729f1d$exports.epochFromDate)(dateTime) - dateTime.offset;
// Perform time manipulation in milliseconds rather than on the original time fields to account for DST.
// For example, adding one hour during a DST transition may result in the hour field staying the same or
// skipping an hour. This results in the offset field changing value instead of the specified field.
ms += duration.milliseconds || 0;
ms += (duration.seconds || 0) * 1000;
ms += (duration.minutes || 0) * 60000;
ms += (duration.hours || 0) * 3600000;
let res = (0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, dateTime.timeZone);
return (0, $4ae0260a69729f1d$exports.toCalendar)(res, dateTime.calendar);
}
function $5c0571aa5b6fb5da$export$6814caac34ca03c7(dateTime, duration) {
return $5c0571aa5b6fb5da$export$96b1d28349274637(dateTime, $5c0571aa5b6fb5da$export$3e2544e88a25bff8(duration));
}
function $5c0571aa5b6fb5da$export$9a297d111fc86b79(dateTime, field, amount, options) {
// For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.
// For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC
// offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.
switch(field){
case 'hour':
{
let min = 0;
let max = 23;
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
let isPM = dateTime.hour >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
// The minimum and maximum hour may be affected by daylight saving time.
// For example, it might jump forward at midnight, and skip 1am.
// Or it might end at midnight and repeat the 11pm hour. To handle this, we get
// the possible absolute times for the min and max, and find the maximum range
// that is within the current day.
let plainDateTime = (0, $4ae0260a69729f1d$exports.toCalendarDateTime)(dateTime);
let minDate = (0, $4ae0260a69729f1d$exports.toCalendar)($5c0571aa5b6fb5da$export$e5d5e1c1822b6e56(plainDateTime, {
hour: min
}), new (0, $af14c9812fdceb33$exports.GregorianCalendar)());
let minAbsolute = [
(0, $4ae0260a69729f1d$exports.toAbsolute)(minDate, dateTime.timeZone, 'earlier'),
(0, $4ae0260a69729f1d$exports.toAbsolute)(minDate, dateTime.timeZone, 'later')
].filter((ms)=>(0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, dateTime.timeZone).day === minDate.day)[0];
let maxDate = (0, $4ae0260a69729f1d$exports.toCalendar)($5c0571aa5b6fb5da$export$e5d5e1c1822b6e56(plainDateTime, {
hour: max
}), new (0, $af14c9812fdceb33$exports.GregorianCalendar)());
let maxAbsolute = [
(0, $4ae0260a69729f1d$exports.toAbsolute)(maxDate, dateTime.timeZone, 'earlier'),
(0, $4ae0260a69729f1d$exports.toAbsolute)(maxDate, dateTime.timeZone, 'later')
].filter((ms)=>(0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, dateTime.timeZone).day === maxDate.day).pop();
// Since hours may repeat, we need to operate on the absolute time in milliseconds.
// This is done in hours from the Unix epoch so that cycleValue works correctly,
// and then converted back to milliseconds.
let ms = (0, $4ae0260a69729f1d$exports.epochFromDate)(dateTime) - dateTime.offset;
let hours = Math.floor(ms / $5c0571aa5b6fb5da$var$ONE_HOUR);
let remainder = ms % $5c0571aa5b6fb5da$var$ONE_HOUR;
ms = $5c0571aa5b6fb5da$var$cycleValue(hours, amount, Math.floor(minAbsolute / $5c0571aa5b6fb5da$var$ONE_HOUR), Math.floor(maxAbsolute / $5c0571aa5b6fb5da$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $5c0571aa5b6fb5da$var$ONE_HOUR + remainder;
// Now compute the new timezone offset, and convert the absolute time back to local time.
return (0, $4ae0260a69729f1d$exports.toCalendar)((0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, dateTime.timeZone), dateTime.calendar);
}
case 'minute':
case 'second':
case 'millisecond':
// @ts-ignore
return $5c0571aa5b6fb5da$export$dd02b3e0007dfe28(dateTime, field, amount, options);
case 'era':
case 'year':
case 'month':
case 'day':
{
let res = $5c0571aa5b6fb5da$export$d52ced6badfb9a4c((0, $4ae0260a69729f1d$exports.toCalendarDateTime)(dateTime), field, amount, options);
let ms = (0, $4ae0260a69729f1d$exports.toAbsolute)(res, dateTime.timeZone);
return (0, $4ae0260a69729f1d$exports.toCalendar)((0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, dateTime.timeZone), dateTime.calendar);
}
default:
throw new Error('Unsupported field ' + field);
}
}
function $5c0571aa5b6fb5da$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
// Set the date/time fields, and recompute the UTC offset to account for DST changes.
// We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.
let plainDateTime = (0, $4ae0260a69729f1d$exports.toCalendarDateTime)(dateTime);
let res = $5c0571aa5b6fb5da$export$e5d5e1c1822b6e56($5c0571aa5b6fb5da$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
// If the resulting plain date time values are equal, return the original time.
// We don't want to change the offset when setting the time to the same value.
if (res.compare(plainDateTime) === 0) return dateTime;
let ms = (0, $4ae0260a69729f1d$exports.toAbsolute)(res, dateTime.timeZone, disambiguation);
return (0, $4ae0260a69729f1d$exports.toCalendar)((0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, dateTime.timeZone), dateTime.calendar);
}
//# sourceMappingURL=manipulation.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,344 @@
import {epochFromDate as $11d87f3f76e88657$export$bd4fb2bc8bb06fb, fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484} from "./conversion.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $735220c2d4774dd3$var$ONE_HOUR = 3600000;
function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
let mutableDate = date.copy();
let days = 'hour' in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
$735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
mutableDate.month += duration.months || 0;
$735220c2d4774dd3$var$balanceYearMonth(mutableDate);
$735220c2d4774dd3$var$constrainMonthDay(mutableDate);
mutableDate.day += (duration.weeks || 0) * 7;
mutableDate.day += duration.days || 0;
mutableDate.day += days;
$735220c2d4774dd3$var$balanceDay(mutableDate);
if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
// Constrain in case adding ended up with a date outside the valid range for the calendar system.
// The behavior here is slightly different than when constraining in the `set` function in that
// we adjust smaller fields to their minimum/maximum values rather than constraining each field
// individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.
if (mutableDate.year < 1) {
mutableDate.year = 1;
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
if (mutableDate.year > maxYear) {
var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
mutableDate.year = maxYear;
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
}
if (mutableDate.month < 1) {
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
if (mutableDate.month > maxMonth) {
mutableDate.month = maxMonth;
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
}
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
return mutableDate;
}
function $735220c2d4774dd3$var$addYears(date, years) {
var _date_calendar_isInverseEra, _date_calendar;
if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
date.year += years;
}
function $735220c2d4774dd3$var$balanceYearMonth(date) {
while(date.month < 1){
$735220c2d4774dd3$var$addYears(date, -1);
date.month += date.calendar.getMonthsInYear(date);
}
let monthsInYear = 0;
while(date.month > (monthsInYear = date.calendar.getMonthsInYear(date))){
date.month -= monthsInYear;
$735220c2d4774dd3$var$addYears(date, 1);
}
}
function $735220c2d4774dd3$var$balanceDay(date) {
while(date.day < 1){
date.month--;
$735220c2d4774dd3$var$balanceYearMonth(date);
date.day += date.calendar.getDaysInMonth(date);
}
while(date.day > date.calendar.getDaysInMonth(date)){
date.day -= date.calendar.getDaysInMonth(date);
date.month++;
$735220c2d4774dd3$var$balanceYearMonth(date);
}
}
function $735220c2d4774dd3$var$constrainMonthDay(date) {
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
}
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
if (date.calendar.constrainDate) date.calendar.constrainDate(date);
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
$735220c2d4774dd3$var$constrainMonthDay(date);
}
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
let inverseDuration = {};
for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
return inverseDuration;
}
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
}
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
let mutableDate = date.copy();
if (fields.era != null) mutableDate.era = fields.era;
if (fields.year != null) mutableDate.year = fields.year;
if (fields.month != null) mutableDate.month = fields.month;
if (fields.day != null) mutableDate.day = fields.day;
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
return mutableDate;
}
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
let mutableValue = value.copy();
if (fields.hour != null) mutableValue.hour = fields.hour;
if (fields.minute != null) mutableValue.minute = fields.minute;
if (fields.second != null) mutableValue.second = fields.second;
if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
$735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
return mutableValue;
}
function $735220c2d4774dd3$var$balanceTime(time) {
time.second += Math.floor(time.millisecond / 1000);
time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1000);
time.minute += Math.floor(time.second / 60);
time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
time.hour += Math.floor(time.minute / 60);
time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
let days = Math.floor(time.hour / 24);
time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
return days;
}
function $735220c2d4774dd3$export$7555de1e070510cb(time) {
time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
time.second = Math.max(0, Math.min(time.second, 59));
time.minute = Math.max(0, Math.min(time.minute, 59));
time.hour = Math.max(0, Math.min(time.hour, 23));
}
function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
let result = a % b;
if (result < 0) result += b;
return result;
}
function $735220c2d4774dd3$var$addTimeFields(time, duration) {
time.hour += duration.hours || 0;
time.minute += duration.minutes || 0;
time.second += duration.seconds || 0;
time.millisecond += duration.milliseconds || 0;
return $735220c2d4774dd3$var$balanceTime(time);
}
function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
let res = time.copy();
$735220c2d4774dd3$var$addTimeFields(res, duration);
return res;
}
function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
}
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
let mutable = value.copy();
switch(field){
case 'era':
{
let eras = value.calendar.getEras();
let eraIndex = eras.indexOf(value.era);
if (eraIndex < 0) throw new Error('Invalid era: ' + value.era);
eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
mutable.era = eras[eraIndex];
// Constrain the year and other fields within the era, so the era doesn't change when we balance below.
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
break;
}
case 'year':
var _mutable_calendar_isInverseEra, _mutable_calendar;
if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
// The year field should not cycle within the era as that can cause weird behavior affecting other fields.
// We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back
// we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.
mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
if (mutable.year === -Infinity) mutable.year = 1;
if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
break;
case 'month':
mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
break;
case 'day':
mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
break;
default:
throw new Error('Unsupported field ' + field);
}
if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
return mutable;
}
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
let mutable = value.copy();
switch(field){
case 'hour':
{
let hours = value.hour;
let min = 0;
let max = 23;
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
let isPM = hours >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
break;
}
case 'minute':
mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
break;
case 'second':
mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
break;
case 'millisecond':
mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
break;
default:
throw new Error('Unsupported field ' + field);
}
return mutable;
}
function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
if (round) {
value += Math.sign(amount);
if (value < min) value = max;
let div = Math.abs(amount);
if (amount > 0) value = Math.ceil(value / div) * div;
else value = Math.floor(value / div) * div;
if (value > max) value = min;
} else {
value += amount;
if (value < min) value = max - (min - value - 1);
else if (value > max) value = min + (value - max - 1);
}
return value;
}
function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) {
let ms;
if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
let res = $735220c2d4774dd3$export$e16d8520af44a096((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), {
years: duration.years,
months: duration.months,
weeks: duration.weeks,
days: duration.days
});
// Changing the date may change the timezone offset, so we need to recompute
// using the 'compatible' disambiguation.
ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone);
} else // Otherwise, preserve the offset of the original date.
ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset;
// Perform time manipulation in milliseconds rather than on the original time fields to account for DST.
// For example, adding one hour during a DST transition may result in the hour field staying the same or
// skipping an hour. This results in the offset field changing value instead of the specified field.
ms += duration.milliseconds || 0;
ms += (duration.seconds || 0) * 1000;
ms += (duration.minutes || 0) * 60000;
ms += (duration.hours || 0) * 3600000;
let res = (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone);
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(res, dateTime.calendar);
}
function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) {
return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
}
function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
// For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.
// For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC
// offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.
switch(field){
case 'hour':
{
let min = 0;
let max = 23;
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
let isPM = dateTime.hour >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
// The minimum and maximum hour may be affected by daylight saving time.
// For example, it might jump forward at midnight, and skip 1am.
// Or it might end at midnight and repeat the 11pm hour. To handle this, we get
// the possible absolute times for the min and max, and find the maximum range
// that is within the current day.
let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime);
let minDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
hour: min
}), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
let minAbsolute = [
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, 'earlier'),
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, 'later')
].filter((ms)=>(0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone).day === minDate.day)[0];
let maxDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
hour: max
}), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
let maxAbsolute = [
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, 'earlier'),
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, 'later')
].filter((ms)=>(0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone).day === maxDate.day).pop();
// Since hours may repeat, we need to operate on the absolute time in milliseconds.
// This is done in hours from the Unix epoch so that cycleValue works correctly,
// and then converted back to milliseconds.
let ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset;
let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
// Now compute the new timezone offset, and convert the absolute time back to local time.
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
}
case 'minute':
case 'second':
case 'millisecond':
// @ts-ignore
return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
case 'era':
case 'year':
case 'month':
case 'day':
{
let res = $735220c2d4774dd3$export$d52ced6badfb9a4c((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), field, amount, options);
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone);
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
}
default:
throw new Error('Unsupported field ' + field);
}
}
function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
// Set the date/time fields, and recompute the UTC offset to account for DST changes.
// We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.
let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime);
let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
// If the resulting plain date time values are equal, return the original time.
// We don't want to change the offset when setting the time to the same value.
if (res.compare(plainDateTime) === 0) return dateTime;
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone, disambiguation);
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
}
export {$735220c2d4774dd3$export$e16d8520af44a096 as add, $735220c2d4774dd3$export$c4e2ecac49351ef2 as constrain, $735220c2d4774dd3$export$3e2544e88a25bff8 as invertDuration, $735220c2d4774dd3$export$4e2d2ead65e5f7e3 as subtract, $735220c2d4774dd3$export$adaa4cf7ef1b65be as set, $735220c2d4774dd3$export$e5d5e1c1822b6e56 as setTime, $735220c2d4774dd3$export$7555de1e070510cb as constrainTime, $735220c2d4774dd3$export$7ed87b6bc2506470 as addTime, $735220c2d4774dd3$export$fe34d3a381cd7501 as subtractTime, $735220c2d4774dd3$export$d52ced6badfb9a4c as cycleDate, $735220c2d4774dd3$export$dd02b3e0007dfe28 as cycleTime, $735220c2d4774dd3$export$96b1d28349274637 as addZoned, $735220c2d4774dd3$export$6814caac34ca03c7 as subtractZoned, $735220c2d4774dd3$export$9a297d111fc86b79 as cycleZoned, $735220c2d4774dd3$export$31b5430eb18be4f8 as setZoned};
//# sourceMappingURL=manipulation.module.js.map

View File

@@ -0,0 +1,344 @@
import {epochFromDate as $11d87f3f76e88657$export$bd4fb2bc8bb06fb, fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484} from "./conversion.module.js";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $735220c2d4774dd3$var$ONE_HOUR = 3600000;
function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
let mutableDate = date.copy();
let days = 'hour' in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
$735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
mutableDate.month += duration.months || 0;
$735220c2d4774dd3$var$balanceYearMonth(mutableDate);
$735220c2d4774dd3$var$constrainMonthDay(mutableDate);
mutableDate.day += (duration.weeks || 0) * 7;
mutableDate.day += duration.days || 0;
mutableDate.day += days;
$735220c2d4774dd3$var$balanceDay(mutableDate);
if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
// Constrain in case adding ended up with a date outside the valid range for the calendar system.
// The behavior here is slightly different than when constraining in the `set` function in that
// we adjust smaller fields to their minimum/maximum values rather than constraining each field
// individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.
if (mutableDate.year < 1) {
mutableDate.year = 1;
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
if (mutableDate.year > maxYear) {
var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
mutableDate.year = maxYear;
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
}
if (mutableDate.month < 1) {
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
if (mutableDate.month > maxMonth) {
mutableDate.month = maxMonth;
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
}
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
return mutableDate;
}
function $735220c2d4774dd3$var$addYears(date, years) {
var _date_calendar_isInverseEra, _date_calendar;
if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
date.year += years;
}
function $735220c2d4774dd3$var$balanceYearMonth(date) {
while(date.month < 1){
$735220c2d4774dd3$var$addYears(date, -1);
date.month += date.calendar.getMonthsInYear(date);
}
let monthsInYear = 0;
while(date.month > (monthsInYear = date.calendar.getMonthsInYear(date))){
date.month -= monthsInYear;
$735220c2d4774dd3$var$addYears(date, 1);
}
}
function $735220c2d4774dd3$var$balanceDay(date) {
while(date.day < 1){
date.month--;
$735220c2d4774dd3$var$balanceYearMonth(date);
date.day += date.calendar.getDaysInMonth(date);
}
while(date.day > date.calendar.getDaysInMonth(date)){
date.day -= date.calendar.getDaysInMonth(date);
date.month++;
$735220c2d4774dd3$var$balanceYearMonth(date);
}
}
function $735220c2d4774dd3$var$constrainMonthDay(date) {
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
}
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
if (date.calendar.constrainDate) date.calendar.constrainDate(date);
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
$735220c2d4774dd3$var$constrainMonthDay(date);
}
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
let inverseDuration = {};
for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
return inverseDuration;
}
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
}
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
let mutableDate = date.copy();
if (fields.era != null) mutableDate.era = fields.era;
if (fields.year != null) mutableDate.year = fields.year;
if (fields.month != null) mutableDate.month = fields.month;
if (fields.day != null) mutableDate.day = fields.day;
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
return mutableDate;
}
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
let mutableValue = value.copy();
if (fields.hour != null) mutableValue.hour = fields.hour;
if (fields.minute != null) mutableValue.minute = fields.minute;
if (fields.second != null) mutableValue.second = fields.second;
if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
$735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
return mutableValue;
}
function $735220c2d4774dd3$var$balanceTime(time) {
time.second += Math.floor(time.millisecond / 1000);
time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1000);
time.minute += Math.floor(time.second / 60);
time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
time.hour += Math.floor(time.minute / 60);
time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
let days = Math.floor(time.hour / 24);
time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
return days;
}
function $735220c2d4774dd3$export$7555de1e070510cb(time) {
time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
time.second = Math.max(0, Math.min(time.second, 59));
time.minute = Math.max(0, Math.min(time.minute, 59));
time.hour = Math.max(0, Math.min(time.hour, 23));
}
function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
let result = a % b;
if (result < 0) result += b;
return result;
}
function $735220c2d4774dd3$var$addTimeFields(time, duration) {
time.hour += duration.hours || 0;
time.minute += duration.minutes || 0;
time.second += duration.seconds || 0;
time.millisecond += duration.milliseconds || 0;
return $735220c2d4774dd3$var$balanceTime(time);
}
function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
let res = time.copy();
$735220c2d4774dd3$var$addTimeFields(res, duration);
return res;
}
function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
}
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
let mutable = value.copy();
switch(field){
case 'era':
{
let eras = value.calendar.getEras();
let eraIndex = eras.indexOf(value.era);
if (eraIndex < 0) throw new Error('Invalid era: ' + value.era);
eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
mutable.era = eras[eraIndex];
// Constrain the year and other fields within the era, so the era doesn't change when we balance below.
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
break;
}
case 'year':
var _mutable_calendar_isInverseEra, _mutable_calendar;
if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
// The year field should not cycle within the era as that can cause weird behavior affecting other fields.
// We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back
// we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.
mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
if (mutable.year === -Infinity) mutable.year = 1;
if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
break;
case 'month':
mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
break;
case 'day':
mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
break;
default:
throw new Error('Unsupported field ' + field);
}
if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
return mutable;
}
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
let mutable = value.copy();
switch(field){
case 'hour':
{
let hours = value.hour;
let min = 0;
let max = 23;
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
let isPM = hours >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
break;
}
case 'minute':
mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
break;
case 'second':
mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
break;
case 'millisecond':
mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
break;
default:
throw new Error('Unsupported field ' + field);
}
return mutable;
}
function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
if (round) {
value += Math.sign(amount);
if (value < min) value = max;
let div = Math.abs(amount);
if (amount > 0) value = Math.ceil(value / div) * div;
else value = Math.floor(value / div) * div;
if (value > max) value = min;
} else {
value += amount;
if (value < min) value = max - (min - value - 1);
else if (value > max) value = min + (value - max - 1);
}
return value;
}
function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) {
let ms;
if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
let res = $735220c2d4774dd3$export$e16d8520af44a096((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), {
years: duration.years,
months: duration.months,
weeks: duration.weeks,
days: duration.days
});
// Changing the date may change the timezone offset, so we need to recompute
// using the 'compatible' disambiguation.
ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone);
} else // Otherwise, preserve the offset of the original date.
ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset;
// Perform time manipulation in milliseconds rather than on the original time fields to account for DST.
// For example, adding one hour during a DST transition may result in the hour field staying the same or
// skipping an hour. This results in the offset field changing value instead of the specified field.
ms += duration.milliseconds || 0;
ms += (duration.seconds || 0) * 1000;
ms += (duration.minutes || 0) * 60000;
ms += (duration.hours || 0) * 3600000;
let res = (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone);
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(res, dateTime.calendar);
}
function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) {
return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
}
function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
// For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.
// For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC
// offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.
switch(field){
case 'hour':
{
let min = 0;
let max = 23;
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
let isPM = dateTime.hour >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
// The minimum and maximum hour may be affected by daylight saving time.
// For example, it might jump forward at midnight, and skip 1am.
// Or it might end at midnight and repeat the 11pm hour. To handle this, we get
// the possible absolute times for the min and max, and find the maximum range
// that is within the current day.
let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime);
let minDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
hour: min
}), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
let minAbsolute = [
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, 'earlier'),
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(minDate, dateTime.timeZone, 'later')
].filter((ms)=>(0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone).day === minDate.day)[0];
let maxDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
hour: max
}), new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
let maxAbsolute = [
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, 'earlier'),
(0, $11d87f3f76e88657$export$5107c82f94518f5c)(maxDate, dateTime.timeZone, 'later')
].filter((ms)=>(0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone).day === maxDate.day).pop();
// Since hours may repeat, we need to operate on the absolute time in milliseconds.
// This is done in hours from the Unix epoch so that cycleValue works correctly,
// and then converted back to milliseconds.
let ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(dateTime) - dateTime.offset;
let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
// Now compute the new timezone offset, and convert the absolute time back to local time.
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
}
case 'minute':
case 'second':
case 'millisecond':
// @ts-ignore
return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
case 'era':
case 'year':
case 'month':
case 'day':
{
let res = $735220c2d4774dd3$export$d52ced6badfb9a4c((0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime), field, amount, options);
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone);
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
}
default:
throw new Error('Unsupported field ' + field);
}
}
function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
// Set the date/time fields, and recompute the UTC offset to account for DST changes.
// We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.
let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(dateTime);
let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
// If the resulting plain date time values are equal, return the original time.
// We don't want to change the offset when setting the time to the same value.
if (res.compare(plainDateTime) === 0) return dateTime;
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(res, dateTime.timeZone, disambiguation);
return (0, $11d87f3f76e88657$export$b4a036af3fc0b032)((0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, dateTime.timeZone), dateTime.calendar);
}
export {$735220c2d4774dd3$export$e16d8520af44a096 as add, $735220c2d4774dd3$export$c4e2ecac49351ef2 as constrain, $735220c2d4774dd3$export$3e2544e88a25bff8 as invertDuration, $735220c2d4774dd3$export$4e2d2ead65e5f7e3 as subtract, $735220c2d4774dd3$export$adaa4cf7ef1b65be as set, $735220c2d4774dd3$export$e5d5e1c1822b6e56 as setTime, $735220c2d4774dd3$export$7555de1e070510cb as constrainTime, $735220c2d4774dd3$export$7ed87b6bc2506470 as addTime, $735220c2d4774dd3$export$fe34d3a381cd7501 as subtractTime, $735220c2d4774dd3$export$d52ced6badfb9a4c as cycleDate, $735220c2d4774dd3$export$dd02b3e0007dfe28 as cycleTime, $735220c2d4774dd3$export$96b1d28349274637 as addZoned, $735220c2d4774dd3$export$6814caac34ca03c7 as subtractZoned, $735220c2d4774dd3$export$9a297d111fc86b79 as cycleZoned, $735220c2d4774dd3$export$31b5430eb18be4f8 as setZoned};
//# sourceMappingURL=manipulation.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.module.js";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
import {JapaneseCalendar as $62225008020f0a13$export$b746ab2b60cdffbf} from "./JapaneseCalendar.module.js";
import {BuddhistCalendar as $8d73d47422ca7302$export$42d20a78301dee44} from "./BuddhistCalendar.module.js";
import {TaiwanCalendar as $5f31bd6f0c8940b2$export$65e01080afcb0799} from "./TaiwanCalendar.module.js";
import {PersianCalendar as $f3ed2e4472ae7e25$export$37fccdbfd14c5939} from "./PersianCalendar.module.js";
import {IndianCalendar as $82c358003bdda0a8$export$39f31c639fa15726} from "./IndianCalendar.module.js";
import {IslamicCivilCalendar as $f2f3e0e3a817edbd$export$2066795aadd37bfc, IslamicTabularCalendar as $f2f3e0e3a817edbd$export$37f0887f2f9d22f7, IslamicUmalquraCalendar as $f2f3e0e3a817edbd$export$5baab4758c231076} from "./IslamicCalendar.module.js";
import {HebrewCalendar as $7c5f6fbf42389787$export$ca405048b8fb5af} from "./HebrewCalendar.module.js";
import {CopticCalendar as $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1, EthiopicAmeteAlemCalendar as $b956b2d7a6cf451f$export$d72e0c37005a4914, EthiopicCalendar as $b956b2d7a6cf451f$export$26ba6eab5e20cd7d} from "./EthiopicCalendar.module.js";
import {createCalendar as $64244302c3013299$export$dd0bbc9b26defe37} from "./createCalendar.module.js";
import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, fromDate as $11d87f3f76e88657$export$e57ff100d91bd4b9, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toLocalTimeZone as $11d87f3f76e88657$export$d9b67bc93c097491, toTime as $11d87f3f76e88657$export$d33f79e3ffc3dc83, toTimeZone as $11d87f3f76e88657$export$538b00033cc11c75, toZoned as $11d87f3f76e88657$export$84c95a83c799e074} from "./conversion.module.js";
import {endOfMonth as $14e0f24ef4ac5c92$export$a2258d9c4118825c, endOfWeek as $14e0f24ef4ac5c92$export$ef8b6d9133084f4e, endOfYear as $14e0f24ef4ac5c92$export$8b7aa55c66d5569e, getDayOfWeek as $14e0f24ef4ac5c92$export$2061056d06d7cdf7, getHoursInDay as $14e0f24ef4ac5c92$export$126c91c941de7e, getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2, getMinimumDayInMonth as $14e0f24ef4ac5c92$export$b2f4953d301981d5, getMinimumMonthInYear as $14e0f24ef4ac5c92$export$5412ac11713b72ad, getWeeksInMonth as $14e0f24ef4ac5c92$export$ccc1b2479e7dd654, isEqualDay as $14e0f24ef4ac5c92$export$91b62ebf2ba703ee, isEqualMonth as $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2, isEqualYear as $14e0f24ef4ac5c92$export$ea840f5a6dda8147, isSameDay as $14e0f24ef4ac5c92$export$ea39ec197993aef0, isSameMonth as $14e0f24ef4ac5c92$export$a18c89cbd24170ff, isSameYear as $14e0f24ef4ac5c92$export$5841f9eb9773f25f, isToday as $14e0f24ef4ac5c92$export$629b0a497aa65267, isWeekday as $14e0f24ef4ac5c92$export$ee9d87258e1d19ed, isWeekend as $14e0f24ef4ac5c92$export$618d60ea299da42, maxDate as $14e0f24ef4ac5c92$export$a75f2bff57811055, minDate as $14e0f24ef4ac5c92$export$5c333a116e949cdd, now as $14e0f24ef4ac5c92$export$461939dd4422153, startOfMonth as $14e0f24ef4ac5c92$export$a5a3b454ada2268e, startOfWeek as $14e0f24ef4ac5c92$export$42c81a444fbfb5d4, startOfYear as $14e0f24ef4ac5c92$export$f91e89d3d0406102, today as $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3} from "./queries.module.js";
import {parseAbsolute as $fae977aafc393c5c$export$5adfdab05168c219, parseAbsoluteToLocal as $fae977aafc393c5c$export$8e384432362ed0f0, parseDate as $fae977aafc393c5c$export$6b862160d295c8e, parseDateTime as $fae977aafc393c5c$export$588937bcd60ade55, parseDuration as $fae977aafc393c5c$export$ecae829bb3747ea6, parseTime as $fae977aafc393c5c$export$c9698ec7f05a07e1, parseZonedDateTime as $fae977aafc393c5c$export$fd7893f06e92a6a4} from "./string.module.js";
import {DateFormatter as $fb18d541ea1ad717$export$ad991b66133851cf} from "./DateFormatter.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$35ea8db9cb2ccb90$export$99faa760c7908e4f as CalendarDate, $35ea8db9cb2ccb90$export$ca871e8dbb80966f as CalendarDateTime, $35ea8db9cb2ccb90$export$680ea196effce5f as Time, $35ea8db9cb2ccb90$export$d3b7288e7994edea as ZonedDateTime, $3b62074eb05584b2$export$80ee6245ec4f29ec as GregorianCalendar, $62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar, $8d73d47422ca7302$export$42d20a78301dee44 as BuddhistCalendar, $5f31bd6f0c8940b2$export$65e01080afcb0799 as TaiwanCalendar, $f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar, $82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar, $f2f3e0e3a817edbd$export$2066795aadd37bfc as IslamicCivilCalendar, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $f2f3e0e3a817edbd$export$5baab4758c231076 as IslamicUmalquraCalendar, $7c5f6fbf42389787$export$ca405048b8fb5af as HebrewCalendar, $b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar, $64244302c3013299$export$dd0bbc9b26defe37 as createCalendar, $11d87f3f76e88657$export$93522d1a439f3617 as toCalendarDate, $11d87f3f76e88657$export$b21e0b124e224484 as toCalendarDateTime, $11d87f3f76e88657$export$d33f79e3ffc3dc83 as toTime, $11d87f3f76e88657$export$b4a036af3fc0b032 as toCalendar, $11d87f3f76e88657$export$84c95a83c799e074 as toZoned, $11d87f3f76e88657$export$538b00033cc11c75 as toTimeZone, $11d87f3f76e88657$export$d9b67bc93c097491 as toLocalTimeZone, $11d87f3f76e88657$export$e57ff100d91bd4b9 as fromDate, $11d87f3f76e88657$export$1b96692a1ba042ac as fromAbsolute, $14e0f24ef4ac5c92$export$ea39ec197993aef0 as isSameDay, $14e0f24ef4ac5c92$export$a18c89cbd24170ff as isSameMonth, $14e0f24ef4ac5c92$export$5841f9eb9773f25f as isSameYear, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee as isEqualDay, $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2 as isEqualMonth, $14e0f24ef4ac5c92$export$ea840f5a6dda8147 as isEqualYear, $14e0f24ef4ac5c92$export$629b0a497aa65267 as isToday, $14e0f24ef4ac5c92$export$2061056d06d7cdf7 as getDayOfWeek, $14e0f24ef4ac5c92$export$461939dd4422153 as now, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3 as today, $14e0f24ef4ac5c92$export$126c91c941de7e as getHoursInDay, $14e0f24ef4ac5c92$export$aa8b41735afcabd2 as getLocalTimeZone, $14e0f24ef4ac5c92$export$a5a3b454ada2268e as startOfMonth, $14e0f24ef4ac5c92$export$42c81a444fbfb5d4 as startOfWeek, $14e0f24ef4ac5c92$export$f91e89d3d0406102 as startOfYear, $14e0f24ef4ac5c92$export$a2258d9c4118825c as endOfMonth, $14e0f24ef4ac5c92$export$ef8b6d9133084f4e as endOfWeek, $14e0f24ef4ac5c92$export$8b7aa55c66d5569e as endOfYear, $14e0f24ef4ac5c92$export$5412ac11713b72ad as getMinimumMonthInYear, $14e0f24ef4ac5c92$export$b2f4953d301981d5 as getMinimumDayInMonth, $14e0f24ef4ac5c92$export$ccc1b2479e7dd654 as getWeeksInMonth, $14e0f24ef4ac5c92$export$5c333a116e949cdd as minDate, $14e0f24ef4ac5c92$export$a75f2bff57811055 as maxDate, $14e0f24ef4ac5c92$export$618d60ea299da42 as isWeekend, $14e0f24ef4ac5c92$export$ee9d87258e1d19ed as isWeekday, $fae977aafc393c5c$export$6b862160d295c8e as parseDate, $fae977aafc393c5c$export$588937bcd60ade55 as parseDateTime, $fae977aafc393c5c$export$c9698ec7f05a07e1 as parseTime, $fae977aafc393c5c$export$5adfdab05168c219 as parseAbsolute, $fae977aafc393c5c$export$8e384432362ed0f0 as parseAbsoluteToLocal, $fae977aafc393c5c$export$fd7893f06e92a6a4 as parseZonedDateTime, $fae977aafc393c5c$export$ecae829bb3747ea6 as parseDuration, $fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
//# sourceMappingURL=module.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@internationalized/date/src/index.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\nexport type {\n AnyCalendarDate,\n AnyTime,\n AnyDateTime,\n Calendar,\n DateDuration,\n TimeDuration,\n DateTimeDuration,\n DateFields,\n TimeFields,\n DateField,\n TimeField,\n Disambiguation,\n CycleOptions,\n CycleTimeOptions\n} from './types';\n\nexport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nexport {GregorianCalendar} from './calendars/GregorianCalendar';\nexport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nexport {BuddhistCalendar} from './calendars/BuddhistCalendar';\nexport {TaiwanCalendar} from './calendars/TaiwanCalendar';\nexport {PersianCalendar} from './calendars/PersianCalendar';\nexport {IndianCalendar} from './calendars/IndianCalendar';\nexport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nexport {HebrewCalendar} from './calendars/HebrewCalendar';\nexport {EthiopicCalendar, EthiopicAmeteAlemCalendar, CopticCalendar} from './calendars/EthiopicCalendar';\nexport {createCalendar} from './createCalendar';\nexport {\n toCalendarDate,\n toCalendarDateTime,\n toTime,\n toCalendar,\n toZoned,\n toTimeZone,\n toLocalTimeZone,\n fromDate,\n fromAbsolute\n} from './conversion';\nexport {\n isSameDay,\n isSameMonth,\n isSameYear,\n isEqualDay,\n isEqualMonth,\n isEqualYear,\n isToday,\n getDayOfWeek,\n now,\n today,\n getHoursInDay,\n getLocalTimeZone,\n startOfMonth,\n startOfWeek,\n startOfYear,\n endOfMonth,\n endOfWeek,\n endOfYear,\n getMinimumMonthInYear,\n getMinimumDayInMonth,\n getWeeksInMonth,\n minDate,\n maxDate,\n isWeekend,\n isWeekday\n} from './queries';\nexport {\n parseDate,\n parseDateTime,\n parseTime,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseZonedDateTime,\n parseDuration\n} from './string';\nexport {DateFormatter} from './DateFormatter';\n"],"names":[],"version":3,"file":"module.js.map"}

View File

@@ -0,0 +1,287 @@
var $4ae0260a69729f1d$exports = require("./conversion.main.js");
var $4d88eff242b38a9e$exports = require("./weekStartData.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "isSameDay", () => $1f0f7ebf1ae6c530$export$ea39ec197993aef0);
$parcel$export(module.exports, "isSameMonth", () => $1f0f7ebf1ae6c530$export$a18c89cbd24170ff);
$parcel$export(module.exports, "startOfMonth", () => $1f0f7ebf1ae6c530$export$a5a3b454ada2268e);
$parcel$export(module.exports, "isSameYear", () => $1f0f7ebf1ae6c530$export$5841f9eb9773f25f);
$parcel$export(module.exports, "startOfYear", () => $1f0f7ebf1ae6c530$export$f91e89d3d0406102);
$parcel$export(module.exports, "isEqualDay", () => $1f0f7ebf1ae6c530$export$91b62ebf2ba703ee);
$parcel$export(module.exports, "isEqualMonth", () => $1f0f7ebf1ae6c530$export$5a8da0c44a3afdf2);
$parcel$export(module.exports, "isEqualYear", () => $1f0f7ebf1ae6c530$export$ea840f5a6dda8147);
$parcel$export(module.exports, "isToday", () => $1f0f7ebf1ae6c530$export$629b0a497aa65267);
$parcel$export(module.exports, "today", () => $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3);
$parcel$export(module.exports, "getDayOfWeek", () => $1f0f7ebf1ae6c530$export$2061056d06d7cdf7);
$parcel$export(module.exports, "now", () => $1f0f7ebf1ae6c530$export$461939dd4422153);
$parcel$export(module.exports, "compareDate", () => $1f0f7ebf1ae6c530$export$68781ddf31c0090f);
$parcel$export(module.exports, "compareTime", () => $1f0f7ebf1ae6c530$export$c19a80a9721b80f6);
$parcel$export(module.exports, "getHoursInDay", () => $1f0f7ebf1ae6c530$export$126c91c941de7e);
$parcel$export(module.exports, "getLocalTimeZone", () => $1f0f7ebf1ae6c530$export$aa8b41735afcabd2);
$parcel$export(module.exports, "endOfMonth", () => $1f0f7ebf1ae6c530$export$a2258d9c4118825c);
$parcel$export(module.exports, "endOfYear", () => $1f0f7ebf1ae6c530$export$8b7aa55c66d5569e);
$parcel$export(module.exports, "getMinimumMonthInYear", () => $1f0f7ebf1ae6c530$export$5412ac11713b72ad);
$parcel$export(module.exports, "getMinimumDayInMonth", () => $1f0f7ebf1ae6c530$export$b2f4953d301981d5);
$parcel$export(module.exports, "startOfWeek", () => $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4);
$parcel$export(module.exports, "endOfWeek", () => $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e);
$parcel$export(module.exports, "getWeeksInMonth", () => $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654);
$parcel$export(module.exports, "minDate", () => $1f0f7ebf1ae6c530$export$5c333a116e949cdd);
$parcel$export(module.exports, "maxDate", () => $1f0f7ebf1ae6c530$export$a75f2bff57811055);
$parcel$export(module.exports, "isWeekend", () => $1f0f7ebf1ae6c530$export$618d60ea299da42);
$parcel$export(module.exports, "isWeekday", () => $1f0f7ebf1ae6c530$export$ee9d87258e1d19ed);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $1f0f7ebf1ae6c530$export$ea39ec197993aef0(a, b) {
b = (0, $4ae0260a69729f1d$exports.toCalendar)(b, a.calendar);
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $1f0f7ebf1ae6c530$export$a18c89cbd24170ff(a, b) {
b = (0, $4ae0260a69729f1d$exports.toCalendar)(b, a.calendar);
// In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.
a = $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(a);
b = $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(b);
return a.era === b.era && a.year === b.year && a.month === b.month;
}
function $1f0f7ebf1ae6c530$export$5841f9eb9773f25f(a, b) {
b = (0, $4ae0260a69729f1d$exports.toCalendar)(b, a.calendar);
a = $1f0f7ebf1ae6c530$export$f91e89d3d0406102(a);
b = $1f0f7ebf1ae6c530$export$f91e89d3d0406102(b);
return a.era === b.era && a.year === b.year;
}
function $1f0f7ebf1ae6c530$export$91b62ebf2ba703ee(a, b) {
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $1f0f7ebf1ae6c530$export$5a8da0c44a3afdf2(a, b) {
a = $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(a);
b = $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(b);
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;
}
function $1f0f7ebf1ae6c530$export$ea840f5a6dda8147(a, b) {
a = $1f0f7ebf1ae6c530$export$f91e89d3d0406102(a);
b = $1f0f7ebf1ae6c530$export$f91e89d3d0406102(b);
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;
}
function $1f0f7ebf1ae6c530$export$629b0a497aa65267(date, timeZone) {
return $1f0f7ebf1ae6c530$export$ea39ec197993aef0(date, $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3(timeZone));
}
function $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1 - $1f0f7ebf1ae6c530$var$getWeekStart(locale)) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
return dayOfWeek;
}
function $1f0f7ebf1ae6c530$export$461939dd4422153(timeZone) {
return (0, $4ae0260a69729f1d$exports.fromAbsolute)(Date.now(), timeZone);
}
function $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3(timeZone) {
return (0, $4ae0260a69729f1d$exports.toCalendarDate)($1f0f7ebf1ae6c530$export$461939dd4422153(timeZone));
}
function $1f0f7ebf1ae6c530$export$68781ddf31c0090f(a, b) {
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
}
function $1f0f7ebf1ae6c530$export$c19a80a9721b80f6(a, b) {
return $1f0f7ebf1ae6c530$var$timeToMs(a) - $1f0f7ebf1ae6c530$var$timeToMs(b);
}
function $1f0f7ebf1ae6c530$var$timeToMs(a) {
return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
}
function $1f0f7ebf1ae6c530$export$126c91c941de7e(a, timeZone) {
let ms = (0, $4ae0260a69729f1d$exports.toAbsolute)(a, timeZone);
let tomorrow = a.add({
days: 1
});
let tomorrowMs = (0, $4ae0260a69729f1d$exports.toAbsolute)(tomorrow, timeZone);
return (tomorrowMs - ms) / 3600000;
}
let $1f0f7ebf1ae6c530$var$localTimeZone = null;
function $1f0f7ebf1ae6c530$export$aa8b41735afcabd2() {
// TODO: invalidate this somehow?
if ($1f0f7ebf1ae6c530$var$localTimeZone == null) $1f0f7ebf1ae6c530$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
return $1f0f7ebf1ae6c530$var$localTimeZone;
}
function $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date) {
// Use `subtract` instead of `set` so we don't get constrained in an era.
return date.subtract({
days: date.day - 1
});
}
function $1f0f7ebf1ae6c530$export$a2258d9c4118825c(date) {
return date.add({
days: date.calendar.getDaysInMonth(date) - date.day
});
}
function $1f0f7ebf1ae6c530$export$f91e89d3d0406102(date) {
return $1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date.subtract({
months: date.month - 1
}));
}
function $1f0f7ebf1ae6c530$export$8b7aa55c66d5569e(date) {
return $1f0f7ebf1ae6c530$export$a2258d9c4118825c(date.add({
months: date.calendar.getMonthsInYear(date) - date.month
}));
}
function $1f0f7ebf1ae6c530$export$5412ac11713b72ad(date) {
if (date.calendar.getMinimumMonthInYear) return date.calendar.getMinimumMonthInYear(date);
return 1;
}
function $1f0f7ebf1ae6c530$export$b2f4953d301981d5(date) {
if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
return 1;
}
function $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale) {
let dayOfWeek = $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale);
return date.subtract({
days: dayOfWeek
});
}
function $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e(date, locale) {
return $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale).add({
days: 6
});
}
const $1f0f7ebf1ae6c530$var$cachedRegions = new Map();
function $1f0f7ebf1ae6c530$var$getRegion(locale) {
// If the Intl.Locale API is available, use it to get the region for the locale.
// @ts-ignore
if (Intl.Locale) {
// Constructing an Intl.Locale is expensive, so cache the result.
let region = $1f0f7ebf1ae6c530$var$cachedRegions.get(locale);
if (!region) {
// @ts-ignore
region = new Intl.Locale(locale).maximize().region;
if (region) $1f0f7ebf1ae6c530$var$cachedRegions.set(locale, region);
}
return region;
}
// If not, just try splitting the string.
// If the second part of the locale string is 'u',
// then this is a unicode extension, so ignore it.
// Otherwise, it should be the region.
let part = locale.split('-')[1];
return part === 'u' ? undefined : part;
}
function $1f0f7ebf1ae6c530$var$getWeekStart(locale) {
// TODO: use Intl.Locale for this once browsers support the weekInfo property
// https://github.com/tc39/proposal-intl-locale-info
let region = $1f0f7ebf1ae6c530$var$getRegion(locale);
return region ? (0, $4d88eff242b38a9e$exports.weekStartData)[region] || 0 : 0;
}
function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale) {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil(($1f0f7ebf1ae6c530$export$2061056d06d7cdf7($1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date), locale) + days) / 7);
}
function $1f0f7ebf1ae6c530$export$5c333a116e949cdd(a, b) {
if (a && b) return a.compare(b) <= 0 ? a : b;
return a || b;
}
function $1f0f7ebf1ae6c530$export$a75f2bff57811055(a, b) {
if (a && b) return a.compare(b) >= 0 ? a : b;
return a || b;
}
const $1f0f7ebf1ae6c530$var$WEEKEND_DATA = {
AF: [
4,
5
],
AE: [
5,
6
],
BH: [
5,
6
],
DZ: [
5,
6
],
EG: [
5,
6
],
IL: [
5,
6
],
IQ: [
5,
6
],
IR: [
5,
5
],
JO: [
5,
6
],
KW: [
5,
6
],
LY: [
5,
6
],
OM: [
5,
6
],
QA: [
5,
6
],
SA: [
5,
6
],
SD: [
5,
6
],
SY: [
5,
6
],
YE: [
5,
6
]
};
function $1f0f7ebf1ae6c530$export$618d60ea299da42(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
let region = $1f0f7ebf1ae6c530$var$getRegion(locale);
// Use Intl.Locale for this once weekInfo is supported.
// https://github.com/tc39/proposal-intl-locale-info
let [start, end] = $1f0f7ebf1ae6c530$var$WEEKEND_DATA[region] || [
6,
0
];
return dayOfWeek === start || dayOfWeek === end;
}
function $1f0f7ebf1ae6c530$export$ee9d87258e1d19ed(date, locale) {
return !$1f0f7ebf1ae6c530$export$618d60ea299da42(date, locale);
}
//# sourceMappingURL=queries.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,256 @@
import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617} from "./conversion.mjs";
import {weekStartData as $2fe286d2fb449abb$export$7a5acbd77d414bd9} from "./weekStartData.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
// In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.
a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
return a.era === b.era && a.year === b.year && a.month === b.month;
}
function $14e0f24ef4ac5c92$export$5841f9eb9773f25f(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
a = $14e0f24ef4ac5c92$export$f91e89d3d0406102(a);
b = $14e0f24ef4ac5c92$export$f91e89d3d0406102(b);
return a.era === b.era && a.year === b.year;
}
function $14e0f24ef4ac5c92$export$91b62ebf2ba703ee(a, b) {
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2(a, b) {
a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;
}
function $14e0f24ef4ac5c92$export$ea840f5a6dda8147(a, b) {
a = $14e0f24ef4ac5c92$export$f91e89d3d0406102(a);
b = $14e0f24ef4ac5c92$export$f91e89d3d0406102(b);
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;
}
function $14e0f24ef4ac5c92$export$629b0a497aa65267(date, timeZone) {
return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
}
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1 - $14e0f24ef4ac5c92$var$getWeekStart(locale)) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
return dayOfWeek;
}
function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(Date.now(), timeZone);
}
function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
return (0, $11d87f3f76e88657$export$93522d1a439f3617)($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
}
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
}
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
}
function $14e0f24ef4ac5c92$var$timeToMs(a) {
return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
}
function $14e0f24ef4ac5c92$export$126c91c941de7e(a, timeZone) {
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(a, timeZone);
let tomorrow = a.add({
days: 1
});
let tomorrowMs = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(tomorrow, timeZone);
return (tomorrowMs - ms) / 3600000;
}
let $14e0f24ef4ac5c92$var$localTimeZone = null;
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
// TODO: invalidate this somehow?
if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
return $14e0f24ef4ac5c92$var$localTimeZone;
}
function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date) {
// Use `subtract` instead of `set` so we don't get constrained in an era.
return date.subtract({
days: date.day - 1
});
}
function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date) {
return date.add({
days: date.calendar.getDaysInMonth(date) - date.day
});
}
function $14e0f24ef4ac5c92$export$f91e89d3d0406102(date) {
return $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date.subtract({
months: date.month - 1
}));
}
function $14e0f24ef4ac5c92$export$8b7aa55c66d5569e(date) {
return $14e0f24ef4ac5c92$export$a2258d9c4118825c(date.add({
months: date.calendar.getMonthsInYear(date) - date.month
}));
}
function $14e0f24ef4ac5c92$export$5412ac11713b72ad(date) {
if (date.calendar.getMinimumMonthInYear) return date.calendar.getMinimumMonthInYear(date);
return 1;
}
function $14e0f24ef4ac5c92$export$b2f4953d301981d5(date) {
if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
return 1;
}
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale) {
let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale);
return date.subtract({
days: dayOfWeek
});
}
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date, locale) {
return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale).add({
days: 6
});
}
const $14e0f24ef4ac5c92$var$cachedRegions = new Map();
function $14e0f24ef4ac5c92$var$getRegion(locale) {
// If the Intl.Locale API is available, use it to get the region for the locale.
// @ts-ignore
if (Intl.Locale) {
// Constructing an Intl.Locale is expensive, so cache the result.
let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale);
if (!region) {
// @ts-ignore
region = new Intl.Locale(locale).maximize().region;
if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
}
return region;
}
// If not, just try splitting the string.
// If the second part of the locale string is 'u',
// then this is a unicode extension, so ignore it.
// Otherwise, it should be the region.
let part = locale.split('-')[1];
return part === 'u' ? undefined : part;
}
function $14e0f24ef4ac5c92$var$getWeekStart(locale) {
// TODO: use Intl.Locale for this once browsers support the weekInfo property
// https://github.com/tc39/proposal-intl-locale-info
let region = $14e0f24ef4ac5c92$var$getRegion(locale);
return region ? (0, $2fe286d2fb449abb$export$7a5acbd77d414bd9)[region] || 0 : 0;
}
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date, locale) {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date), locale) + days) / 7);
}
function $14e0f24ef4ac5c92$export$5c333a116e949cdd(a, b) {
if (a && b) return a.compare(b) <= 0 ? a : b;
return a || b;
}
function $14e0f24ef4ac5c92$export$a75f2bff57811055(a, b) {
if (a && b) return a.compare(b) >= 0 ? a : b;
return a || b;
}
const $14e0f24ef4ac5c92$var$WEEKEND_DATA = {
AF: [
4,
5
],
AE: [
5,
6
],
BH: [
5,
6
],
DZ: [
5,
6
],
EG: [
5,
6
],
IL: [
5,
6
],
IQ: [
5,
6
],
IR: [
5,
5
],
JO: [
5,
6
],
KW: [
5,
6
],
LY: [
5,
6
],
OM: [
5,
6
],
QA: [
5,
6
],
SA: [
5,
6
],
SD: [
5,
6
],
SY: [
5,
6
],
YE: [
5,
6
]
};
function $14e0f24ef4ac5c92$export$618d60ea299da42(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
let region = $14e0f24ef4ac5c92$var$getRegion(locale);
// Use Intl.Locale for this once weekInfo is supported.
// https://github.com/tc39/proposal-intl-locale-info
let [start, end] = $14e0f24ef4ac5c92$var$WEEKEND_DATA[region] || [
6,
0
];
return dayOfWeek === start || dayOfWeek === end;
}
function $14e0f24ef4ac5c92$export$ee9d87258e1d19ed(date, locale) {
return !$14e0f24ef4ac5c92$export$618d60ea299da42(date, locale);
}
export {$14e0f24ef4ac5c92$export$ea39ec197993aef0 as isSameDay, $14e0f24ef4ac5c92$export$a18c89cbd24170ff as isSameMonth, $14e0f24ef4ac5c92$export$a5a3b454ada2268e as startOfMonth, $14e0f24ef4ac5c92$export$5841f9eb9773f25f as isSameYear, $14e0f24ef4ac5c92$export$f91e89d3d0406102 as startOfYear, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee as isEqualDay, $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2 as isEqualMonth, $14e0f24ef4ac5c92$export$ea840f5a6dda8147 as isEqualYear, $14e0f24ef4ac5c92$export$629b0a497aa65267 as isToday, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3 as today, $14e0f24ef4ac5c92$export$2061056d06d7cdf7 as getDayOfWeek, $14e0f24ef4ac5c92$export$461939dd4422153 as now, $14e0f24ef4ac5c92$export$68781ddf31c0090f as compareDate, $14e0f24ef4ac5c92$export$c19a80a9721b80f6 as compareTime, $14e0f24ef4ac5c92$export$126c91c941de7e as getHoursInDay, $14e0f24ef4ac5c92$export$aa8b41735afcabd2 as getLocalTimeZone, $14e0f24ef4ac5c92$export$a2258d9c4118825c as endOfMonth, $14e0f24ef4ac5c92$export$8b7aa55c66d5569e as endOfYear, $14e0f24ef4ac5c92$export$5412ac11713b72ad as getMinimumMonthInYear, $14e0f24ef4ac5c92$export$b2f4953d301981d5 as getMinimumDayInMonth, $14e0f24ef4ac5c92$export$42c81a444fbfb5d4 as startOfWeek, $14e0f24ef4ac5c92$export$ef8b6d9133084f4e as endOfWeek, $14e0f24ef4ac5c92$export$ccc1b2479e7dd654 as getWeeksInMonth, $14e0f24ef4ac5c92$export$5c333a116e949cdd as minDate, $14e0f24ef4ac5c92$export$a75f2bff57811055 as maxDate, $14e0f24ef4ac5c92$export$618d60ea299da42 as isWeekend, $14e0f24ef4ac5c92$export$ee9d87258e1d19ed as isWeekday};
//# sourceMappingURL=queries.module.js.map

View File

@@ -0,0 +1,256 @@
import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617} from "./conversion.module.js";
import {weekStartData as $2fe286d2fb449abb$export$7a5acbd77d414bd9} from "./weekStartData.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
// In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.
a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
return a.era === b.era && a.year === b.year && a.month === b.month;
}
function $14e0f24ef4ac5c92$export$5841f9eb9773f25f(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
a = $14e0f24ef4ac5c92$export$f91e89d3d0406102(a);
b = $14e0f24ef4ac5c92$export$f91e89d3d0406102(b);
return a.era === b.era && a.year === b.year;
}
function $14e0f24ef4ac5c92$export$91b62ebf2ba703ee(a, b) {
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2(a, b) {
a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;
}
function $14e0f24ef4ac5c92$export$ea840f5a6dda8147(a, b) {
a = $14e0f24ef4ac5c92$export$f91e89d3d0406102(a);
b = $14e0f24ef4ac5c92$export$f91e89d3d0406102(b);
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;
}
function $14e0f24ef4ac5c92$export$629b0a497aa65267(date, timeZone) {
return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
}
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1 - $14e0f24ef4ac5c92$var$getWeekStart(locale)) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
return dayOfWeek;
}
function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(Date.now(), timeZone);
}
function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
return (0, $11d87f3f76e88657$export$93522d1a439f3617)($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
}
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
}
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
}
function $14e0f24ef4ac5c92$var$timeToMs(a) {
return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
}
function $14e0f24ef4ac5c92$export$126c91c941de7e(a, timeZone) {
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(a, timeZone);
let tomorrow = a.add({
days: 1
});
let tomorrowMs = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(tomorrow, timeZone);
return (tomorrowMs - ms) / 3600000;
}
let $14e0f24ef4ac5c92$var$localTimeZone = null;
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
// TODO: invalidate this somehow?
if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
return $14e0f24ef4ac5c92$var$localTimeZone;
}
function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date) {
// Use `subtract` instead of `set` so we don't get constrained in an era.
return date.subtract({
days: date.day - 1
});
}
function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date) {
return date.add({
days: date.calendar.getDaysInMonth(date) - date.day
});
}
function $14e0f24ef4ac5c92$export$f91e89d3d0406102(date) {
return $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date.subtract({
months: date.month - 1
}));
}
function $14e0f24ef4ac5c92$export$8b7aa55c66d5569e(date) {
return $14e0f24ef4ac5c92$export$a2258d9c4118825c(date.add({
months: date.calendar.getMonthsInYear(date) - date.month
}));
}
function $14e0f24ef4ac5c92$export$5412ac11713b72ad(date) {
if (date.calendar.getMinimumMonthInYear) return date.calendar.getMinimumMonthInYear(date);
return 1;
}
function $14e0f24ef4ac5c92$export$b2f4953d301981d5(date) {
if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
return 1;
}
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale) {
let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale);
return date.subtract({
days: dayOfWeek
});
}
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date, locale) {
return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale).add({
days: 6
});
}
const $14e0f24ef4ac5c92$var$cachedRegions = new Map();
function $14e0f24ef4ac5c92$var$getRegion(locale) {
// If the Intl.Locale API is available, use it to get the region for the locale.
// @ts-ignore
if (Intl.Locale) {
// Constructing an Intl.Locale is expensive, so cache the result.
let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale);
if (!region) {
// @ts-ignore
region = new Intl.Locale(locale).maximize().region;
if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
}
return region;
}
// If not, just try splitting the string.
// If the second part of the locale string is 'u',
// then this is a unicode extension, so ignore it.
// Otherwise, it should be the region.
let part = locale.split('-')[1];
return part === 'u' ? undefined : part;
}
function $14e0f24ef4ac5c92$var$getWeekStart(locale) {
// TODO: use Intl.Locale for this once browsers support the weekInfo property
// https://github.com/tc39/proposal-intl-locale-info
let region = $14e0f24ef4ac5c92$var$getRegion(locale);
return region ? (0, $2fe286d2fb449abb$export$7a5acbd77d414bd9)[region] || 0 : 0;
}
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date, locale) {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date), locale) + days) / 7);
}
function $14e0f24ef4ac5c92$export$5c333a116e949cdd(a, b) {
if (a && b) return a.compare(b) <= 0 ? a : b;
return a || b;
}
function $14e0f24ef4ac5c92$export$a75f2bff57811055(a, b) {
if (a && b) return a.compare(b) >= 0 ? a : b;
return a || b;
}
const $14e0f24ef4ac5c92$var$WEEKEND_DATA = {
AF: [
4,
5
],
AE: [
5,
6
],
BH: [
5,
6
],
DZ: [
5,
6
],
EG: [
5,
6
],
IL: [
5,
6
],
IQ: [
5,
6
],
IR: [
5,
5
],
JO: [
5,
6
],
KW: [
5,
6
],
LY: [
5,
6
],
OM: [
5,
6
],
QA: [
5,
6
],
SA: [
5,
6
],
SD: [
5,
6
],
SY: [
5,
6
],
YE: [
5,
6
]
};
function $14e0f24ef4ac5c92$export$618d60ea299da42(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
let region = $14e0f24ef4ac5c92$var$getRegion(locale);
// Use Intl.Locale for this once weekInfo is supported.
// https://github.com/tc39/proposal-intl-locale-info
let [start, end] = $14e0f24ef4ac5c92$var$WEEKEND_DATA[region] || [
6,
0
];
return dayOfWeek === start || dayOfWeek === end;
}
function $14e0f24ef4ac5c92$export$ee9d87258e1d19ed(date, locale) {
return !$14e0f24ef4ac5c92$export$618d60ea299da42(date, locale);
}
export {$14e0f24ef4ac5c92$export$ea39ec197993aef0 as isSameDay, $14e0f24ef4ac5c92$export$a18c89cbd24170ff as isSameMonth, $14e0f24ef4ac5c92$export$a5a3b454ada2268e as startOfMonth, $14e0f24ef4ac5c92$export$5841f9eb9773f25f as isSameYear, $14e0f24ef4ac5c92$export$f91e89d3d0406102 as startOfYear, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee as isEqualDay, $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2 as isEqualMonth, $14e0f24ef4ac5c92$export$ea840f5a6dda8147 as isEqualYear, $14e0f24ef4ac5c92$export$629b0a497aa65267 as isToday, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3 as today, $14e0f24ef4ac5c92$export$2061056d06d7cdf7 as getDayOfWeek, $14e0f24ef4ac5c92$export$461939dd4422153 as now, $14e0f24ef4ac5c92$export$68781ddf31c0090f as compareDate, $14e0f24ef4ac5c92$export$c19a80a9721b80f6 as compareTime, $14e0f24ef4ac5c92$export$126c91c941de7e as getHoursInDay, $14e0f24ef4ac5c92$export$aa8b41735afcabd2 as getLocalTimeZone, $14e0f24ef4ac5c92$export$a2258d9c4118825c as endOfMonth, $14e0f24ef4ac5c92$export$8b7aa55c66d5569e as endOfYear, $14e0f24ef4ac5c92$export$5412ac11713b72ad as getMinimumMonthInYear, $14e0f24ef4ac5c92$export$b2f4953d301981d5 as getMinimumDayInMonth, $14e0f24ef4ac5c92$export$42c81a444fbfb5d4 as startOfWeek, $14e0f24ef4ac5c92$export$ef8b6d9133084f4e as endOfWeek, $14e0f24ef4ac5c92$export$ccc1b2479e7dd654 as getWeeksInMonth, $14e0f24ef4ac5c92$export$5c333a116e949cdd as minDate, $14e0f24ef4ac5c92$export$a75f2bff57811055 as maxDate, $14e0f24ef4ac5c92$export$618d60ea299da42 as isWeekend, $14e0f24ef4ac5c92$export$ee9d87258e1d19ed as isWeekday};
//# sourceMappingURL=queries.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,171 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $4ae0260a69729f1d$exports = require("./conversion.main.js");
var $1f0f7ebf1ae6c530$exports = require("./queries.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "parseTime", () => $4c32e2d98e5a5134$export$c9698ec7f05a07e1);
$parcel$export(module.exports, "parseDate", () => $4c32e2d98e5a5134$export$6b862160d295c8e);
$parcel$export(module.exports, "parseDateTime", () => $4c32e2d98e5a5134$export$588937bcd60ade55);
$parcel$export(module.exports, "parseZonedDateTime", () => $4c32e2d98e5a5134$export$fd7893f06e92a6a4);
$parcel$export(module.exports, "dateTimeToString", () => $4c32e2d98e5a5134$export$4223de14708adc63);
$parcel$export(module.exports, "parseAbsolute", () => $4c32e2d98e5a5134$export$5adfdab05168c219);
$parcel$export(module.exports, "parseAbsoluteToLocal", () => $4c32e2d98e5a5134$export$8e384432362ed0f0);
$parcel$export(module.exports, "timeToString", () => $4c32e2d98e5a5134$export$f59dee82248f5ad4);
$parcel$export(module.exports, "dateToString", () => $4c32e2d98e5a5134$export$60dfd74aa96791bd);
$parcel$export(module.exports, "zonedDateTimeToString", () => $4c32e2d98e5a5134$export$bf79f1ebf4b18792);
$parcel$export(module.exports, "parseDuration", () => $4c32e2d98e5a5134$export$ecae829bb3747ea6);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $4c32e2d98e5a5134$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $4c32e2d98e5a5134$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
const $4c32e2d98e5a5134$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $4c32e2d98e5a5134$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $4c32e2d98e5a5134$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $4c32e2d98e5a5134$var$DATE_TIME_DURATION_RE = /^((?<negative>-)|\+)?P((?<years>\d*)Y)?((?<months>\d*)M)?((?<weeks>\d*)W)?((?<days>\d*)D)?((?<time>T)((?<hours>\d*[.,]?\d{1,9})H)?((?<minutes>\d*[.,]?\d{1,9})M)?((?<seconds>\d*[.,]?\d{1,9})S)?)?$/;
const $4c32e2d98e5a5134$var$requiredDurationTimeGroups = [
'hours',
'minutes',
'seconds'
];
const $4c32e2d98e5a5134$var$requiredDurationGroups = [
'years',
'months',
'weeks',
'days',
...$4c32e2d98e5a5134$var$requiredDurationTimeGroups
];
function $4c32e2d98e5a5134$export$c9698ec7f05a07e1(value) {
let m = value.match($4c32e2d98e5a5134$var$TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 time string: ' + value);
return new (0, $625ad1e1f4c43bc1$exports.Time)($4c32e2d98e5a5134$var$parseNumber(m[1], 0, 23), m[2] ? $4c32e2d98e5a5134$var$parseNumber(m[2], 0, 59) : 0, m[3] ? $4c32e2d98e5a5134$var$parseNumber(m[3], 0, 59) : 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, Infinity) * 1000 : 0);
}
function $4c32e2d98e5a5134$export$6b862160d295c8e(value) {
let m = value.match($4c32e2d98e5a5134$var$DATE_RE);
if (!m) throw new Error('Invalid ISO 8601 date string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.CalendarDate)($4c32e2d98e5a5134$var$parseNumber(m[1], 0, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
return date;
}
function $4c32e2d98e5a5134$export$588937bcd60ade55(value) {
let m = value.match($4c32e2d98e5a5134$var$DATE_TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.CalendarDateTime)($4c32e2d98e5a5134$var$parseNumber(m[1], 1, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
return date;
}
function $4c32e2d98e5a5134$export$fd7893f06e92a6a4(value, disambiguation) {
let m = value.match($4c32e2d98e5a5134$var$ZONED_DATE_TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)($4c32e2d98e5a5134$var$parseNumber(m[1], 1, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
let plainDateTime = (0, $4ae0260a69729f1d$exports.toCalendarDateTime)(date);
let ms;
if (m[8]) {
var _m_;
date.offset = $4c32e2d98e5a5134$var$parseNumber(m[8], -23, 23) * 3600000 + $4c32e2d98e5a5134$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : '0', 0, 59) * 60000;
ms = (0, $4ae0260a69729f1d$exports.epochFromDate)(date) - date.offset;
// Validate offset against parsed date.
let absolutes = (0, $4ae0260a69729f1d$exports.possibleAbsolutes)(plainDateTime, date.timeZone);
if (!absolutes.includes(ms)) throw new Error(`Offset ${$4c32e2d98e5a5134$var$offsetToString(date.offset)} is invalid for ${$4c32e2d98e5a5134$export$4223de14708adc63(date)} in ${date.timeZone}`);
} else // Convert to absolute and back to fix invalid times due to DST.
ms = (0, $4ae0260a69729f1d$exports.toAbsolute)((0, $4ae0260a69729f1d$exports.toCalendarDateTime)(plainDateTime), date.timeZone, disambiguation);
return (0, $4ae0260a69729f1d$exports.fromAbsolute)(ms, date.timeZone);
}
function $4c32e2d98e5a5134$export$5adfdab05168c219(value, timeZone) {
let m = value.match($4c32e2d98e5a5134$var$ABSOLUTE_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)($4c32e2d98e5a5134$var$parseNumber(m[1], 1, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
var _m_;
if (m[8]) date.offset = $4c32e2d98e5a5134$var$parseNumber(m[8], -23, 23) * 3600000 + $4c32e2d98e5a5134$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : '0', 0, 59) * 60000;
return (0, $4ae0260a69729f1d$exports.toTimeZone)(date, timeZone);
}
function $4c32e2d98e5a5134$export$8e384432362ed0f0(value) {
return $4c32e2d98e5a5134$export$5adfdab05168c219(value, (0, $1f0f7ebf1ae6c530$exports.getLocalTimeZone)());
}
function $4c32e2d98e5a5134$var$parseNumber(value, min, max) {
let val = Number(value);
if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
return val;
}
function $4c32e2d98e5a5134$export$f59dee82248f5ad4(time) {
return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
}
function $4c32e2d98e5a5134$export$60dfd74aa96791bd(date) {
let gregorianDate = (0, $4ae0260a69729f1d$exports.toCalendar)(date, new (0, $af14c9812fdceb33$exports.GregorianCalendar)());
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
}
function $4c32e2d98e5a5134$export$4223de14708adc63(date) {
// @ts-ignore
return `${$4c32e2d98e5a5134$export$60dfd74aa96791bd(date)}T${$4c32e2d98e5a5134$export$f59dee82248f5ad4(date)}`;
}
function $4c32e2d98e5a5134$var$offsetToString(offset) {
let sign = Math.sign(offset) < 0 ? '-' : '+';
offset = Math.abs(offset);
let offsetHours = Math.floor(offset / 3600000);
let offsetMinutes = offset % 3600000 / 60000;
return `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;
}
function $4c32e2d98e5a5134$export$bf79f1ebf4b18792(date) {
return `${$4c32e2d98e5a5134$export$4223de14708adc63(date)}${$4c32e2d98e5a5134$var$offsetToString(date.offset)}[${date.timeZone}]`;
}
function $4c32e2d98e5a5134$export$ecae829bb3747ea6(value) {
var _match_groups, _match_groups1, _match_groups2, _match_groups3, _match_groups4, _match_groups5, _match_groups6, _match_groups7, _match_groups8;
const match = value.match($4c32e2d98e5a5134$var$DATE_TIME_DURATION_RE);
if (!match) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const parseDurationGroup = (group, isNegative, min, max)=>{
if (!group) return 0;
try {
const sign = isNegative ? -1 : 1;
return sign * $4c32e2d98e5a5134$var$parseNumber(group.replace(',', '.'), min, max);
} catch {
throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
}
};
const isNegative = !!((_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups.negative);
const hasRequiredGroups = $4c32e2d98e5a5134$var$requiredDurationGroups.some((group)=>{
var _match_groups;
return (_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[group];
});
if (!hasRequiredGroups) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const durationStringIncludesTime = (_match_groups1 = match.groups) === null || _match_groups1 === void 0 ? void 0 : _match_groups1.time;
if (durationStringIncludesTime) {
const hasRequiredDurationTimeGroups = $4c32e2d98e5a5134$var$requiredDurationTimeGroups.some((group)=>{
var _match_groups;
return (_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[group];
});
if (!hasRequiredDurationTimeGroups) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
}
const duration = {
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative, 0, 9999),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative, 0, 12),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative, 0, Infinity),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative, 0, 31),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative, 0, 23),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
};
if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
if (duration.minutes !== undefined && duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
return duration;
}
//# sourceMappingURL=string.main.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,156 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.mjs";
import {epochFromDate as $11d87f3f76e88657$export$bd4fb2bc8bb06fb, fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, possibleAbsolutes as $11d87f3f76e88657$export$136f38efe7caf549, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toTimeZone as $11d87f3f76e88657$export$538b00033cc11c75} from "./conversion.mjs";
import {getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2} from "./queries.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $fae977aafc393c5c$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
const $fae977aafc393c5c$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $fae977aafc393c5c$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $fae977aafc393c5c$var$DATE_TIME_DURATION_RE = /^((?<negative>-)|\+)?P((?<years>\d*)Y)?((?<months>\d*)M)?((?<weeks>\d*)W)?((?<days>\d*)D)?((?<time>T)((?<hours>\d*[.,]?\d{1,9})H)?((?<minutes>\d*[.,]?\d{1,9})M)?((?<seconds>\d*[.,]?\d{1,9})S)?)?$/;
const $fae977aafc393c5c$var$requiredDurationTimeGroups = [
'hours',
'minutes',
'seconds'
];
const $fae977aafc393c5c$var$requiredDurationGroups = [
'years',
'months',
'weeks',
'days',
...$fae977aafc393c5c$var$requiredDurationTimeGroups
];
function $fae977aafc393c5c$export$c9698ec7f05a07e1(value) {
let m = value.match($fae977aafc393c5c$var$TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 time string: ' + value);
return new (0, $35ea8db9cb2ccb90$export$680ea196effce5f)($fae977aafc393c5c$var$parseNumber(m[1], 0, 23), m[2] ? $fae977aafc393c5c$var$parseNumber(m[2], 0, 59) : 0, m[3] ? $fae977aafc393c5c$var$parseNumber(m[3], 0, 59) : 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, Infinity) * 1000 : 0);
}
function $fae977aafc393c5c$export$6b862160d295c8e(value) {
let m = value.match($fae977aafc393c5c$var$DATE_RE);
if (!m) throw new Error('Invalid ISO 8601 date string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)($fae977aafc393c5c$var$parseNumber(m[1], 0, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
return date;
}
function $fae977aafc393c5c$export$588937bcd60ade55(value) {
let m = value.match($fae977aafc393c5c$var$DATE_TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
return date;
}
function $fae977aafc393c5c$export$fd7893f06e92a6a4(value, disambiguation) {
let m = value.match($fae977aafc393c5c$var$ZONED_DATE_TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(date);
let ms;
if (m[8]) {
var _m_;
date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 3600000 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : '0', 0, 59) * 60000;
ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(date) - date.offset;
// Validate offset against parsed date.
let absolutes = (0, $11d87f3f76e88657$export$136f38efe7caf549)(plainDateTime, date.timeZone);
if (!absolutes.includes(ms)) throw new Error(`Offset ${$fae977aafc393c5c$var$offsetToString(date.offset)} is invalid for ${$fae977aafc393c5c$export$4223de14708adc63(date)} in ${date.timeZone}`);
} else // Convert to absolute and back to fix invalid times due to DST.
ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)((0, $11d87f3f76e88657$export$b21e0b124e224484)(plainDateTime), date.timeZone, disambiguation);
return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, date.timeZone);
}
function $fae977aafc393c5c$export$5adfdab05168c219(value, timeZone) {
let m = value.match($fae977aafc393c5c$var$ABSOLUTE_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
var _m_;
if (m[8]) date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 3600000 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : '0', 0, 59) * 60000;
return (0, $11d87f3f76e88657$export$538b00033cc11c75)(date, timeZone);
}
function $fae977aafc393c5c$export$8e384432362ed0f0(value) {
return $fae977aafc393c5c$export$5adfdab05168c219(value, (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)());
}
function $fae977aafc393c5c$var$parseNumber(value, min, max) {
let val = Number(value);
if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
return val;
}
function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
}
function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
let gregorianDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
}
function $fae977aafc393c5c$export$4223de14708adc63(date) {
// @ts-ignore
return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
}
function $fae977aafc393c5c$var$offsetToString(offset) {
let sign = Math.sign(offset) < 0 ? '-' : '+';
offset = Math.abs(offset);
let offsetHours = Math.floor(offset / 3600000);
let offsetMinutes = offset % 3600000 / 60000;
return `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;
}
function $fae977aafc393c5c$export$bf79f1ebf4b18792(date) {
return `${$fae977aafc393c5c$export$4223de14708adc63(date)}${$fae977aafc393c5c$var$offsetToString(date.offset)}[${date.timeZone}]`;
}
function $fae977aafc393c5c$export$ecae829bb3747ea6(value) {
var _match_groups, _match_groups1, _match_groups2, _match_groups3, _match_groups4, _match_groups5, _match_groups6, _match_groups7, _match_groups8;
const match = value.match($fae977aafc393c5c$var$DATE_TIME_DURATION_RE);
if (!match) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const parseDurationGroup = (group, isNegative, min, max)=>{
if (!group) return 0;
try {
const sign = isNegative ? -1 : 1;
return sign * $fae977aafc393c5c$var$parseNumber(group.replace(',', '.'), min, max);
} catch {
throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
}
};
const isNegative = !!((_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups.negative);
const hasRequiredGroups = $fae977aafc393c5c$var$requiredDurationGroups.some((group)=>{
var _match_groups;
return (_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[group];
});
if (!hasRequiredGroups) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const durationStringIncludesTime = (_match_groups1 = match.groups) === null || _match_groups1 === void 0 ? void 0 : _match_groups1.time;
if (durationStringIncludesTime) {
const hasRequiredDurationTimeGroups = $fae977aafc393c5c$var$requiredDurationTimeGroups.some((group)=>{
var _match_groups;
return (_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[group];
});
if (!hasRequiredDurationTimeGroups) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
}
const duration = {
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative, 0, 9999),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative, 0, 12),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative, 0, Infinity),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative, 0, 31),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative, 0, 23),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
};
if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
if (duration.minutes !== undefined && duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
return duration;
}
export {$fae977aafc393c5c$export$c9698ec7f05a07e1 as parseTime, $fae977aafc393c5c$export$6b862160d295c8e as parseDate, $fae977aafc393c5c$export$588937bcd60ade55 as parseDateTime, $fae977aafc393c5c$export$fd7893f06e92a6a4 as parseZonedDateTime, $fae977aafc393c5c$export$4223de14708adc63 as dateTimeToString, $fae977aafc393c5c$export$5adfdab05168c219 as parseAbsolute, $fae977aafc393c5c$export$8e384432362ed0f0 as parseAbsoluteToLocal, $fae977aafc393c5c$export$f59dee82248f5ad4 as timeToString, $fae977aafc393c5c$export$60dfd74aa96791bd as dateToString, $fae977aafc393c5c$export$bf79f1ebf4b18792 as zonedDateTimeToString, $fae977aafc393c5c$export$ecae829bb3747ea6 as parseDuration};
//# sourceMappingURL=string.module.js.map

View File

@@ -0,0 +1,156 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.module.js";
import {epochFromDate as $11d87f3f76e88657$export$bd4fb2bc8bb06fb, fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, possibleAbsolutes as $11d87f3f76e88657$export$136f38efe7caf549, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toTimeZone as $11d87f3f76e88657$export$538b00033cc11c75} from "./conversion.module.js";
import {getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2} from "./queries.module.js";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $fae977aafc393c5c$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
const $fae977aafc393c5c$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $fae977aafc393c5c$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $fae977aafc393c5c$var$DATE_TIME_DURATION_RE = /^((?<negative>-)|\+)?P((?<years>\d*)Y)?((?<months>\d*)M)?((?<weeks>\d*)W)?((?<days>\d*)D)?((?<time>T)((?<hours>\d*[.,]?\d{1,9})H)?((?<minutes>\d*[.,]?\d{1,9})M)?((?<seconds>\d*[.,]?\d{1,9})S)?)?$/;
const $fae977aafc393c5c$var$requiredDurationTimeGroups = [
'hours',
'minutes',
'seconds'
];
const $fae977aafc393c5c$var$requiredDurationGroups = [
'years',
'months',
'weeks',
'days',
...$fae977aafc393c5c$var$requiredDurationTimeGroups
];
function $fae977aafc393c5c$export$c9698ec7f05a07e1(value) {
let m = value.match($fae977aafc393c5c$var$TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 time string: ' + value);
return new (0, $35ea8db9cb2ccb90$export$680ea196effce5f)($fae977aafc393c5c$var$parseNumber(m[1], 0, 23), m[2] ? $fae977aafc393c5c$var$parseNumber(m[2], 0, 59) : 0, m[3] ? $fae977aafc393c5c$var$parseNumber(m[3], 0, 59) : 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, Infinity) * 1000 : 0);
}
function $fae977aafc393c5c$export$6b862160d295c8e(value) {
let m = value.match($fae977aafc393c5c$var$DATE_RE);
if (!m) throw new Error('Invalid ISO 8601 date string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)($fae977aafc393c5c$var$parseNumber(m[1], 0, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
return date;
}
function $fae977aafc393c5c$export$588937bcd60ade55(value) {
let m = value.match($fae977aafc393c5c$var$DATE_TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
return date;
}
function $fae977aafc393c5c$export$fd7893f06e92a6a4(value, disambiguation) {
let m = value.match($fae977aafc393c5c$var$ZONED_DATE_TIME_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(date);
let ms;
if (m[8]) {
var _m_;
date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 3600000 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : '0', 0, 59) * 60000;
ms = (0, $11d87f3f76e88657$export$bd4fb2bc8bb06fb)(date) - date.offset;
// Validate offset against parsed date.
let absolutes = (0, $11d87f3f76e88657$export$136f38efe7caf549)(plainDateTime, date.timeZone);
if (!absolutes.includes(ms)) throw new Error(`Offset ${$fae977aafc393c5c$var$offsetToString(date.offset)} is invalid for ${$fae977aafc393c5c$export$4223de14708adc63(date)} in ${date.timeZone}`);
} else // Convert to absolute and back to fix invalid times due to DST.
ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)((0, $11d87f3f76e88657$export$b21e0b124e224484)(plainDateTime), date.timeZone, disambiguation);
return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(ms, date.timeZone);
}
function $fae977aafc393c5c$export$5adfdab05168c219(value, timeZone) {
let m = value.match($fae977aafc393c5c$var$ABSOLUTE_RE);
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
var _m_;
if (m[8]) date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 3600000 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : '0', 0, 59) * 60000;
return (0, $11d87f3f76e88657$export$538b00033cc11c75)(date, timeZone);
}
function $fae977aafc393c5c$export$8e384432362ed0f0(value) {
return $fae977aafc393c5c$export$5adfdab05168c219(value, (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)());
}
function $fae977aafc393c5c$var$parseNumber(value, min, max) {
let val = Number(value);
if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
return val;
}
function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
}
function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
let gregorianDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
}
function $fae977aafc393c5c$export$4223de14708adc63(date) {
// @ts-ignore
return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
}
function $fae977aafc393c5c$var$offsetToString(offset) {
let sign = Math.sign(offset) < 0 ? '-' : '+';
offset = Math.abs(offset);
let offsetHours = Math.floor(offset / 3600000);
let offsetMinutes = offset % 3600000 / 60000;
return `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;
}
function $fae977aafc393c5c$export$bf79f1ebf4b18792(date) {
return `${$fae977aafc393c5c$export$4223de14708adc63(date)}${$fae977aafc393c5c$var$offsetToString(date.offset)}[${date.timeZone}]`;
}
function $fae977aafc393c5c$export$ecae829bb3747ea6(value) {
var _match_groups, _match_groups1, _match_groups2, _match_groups3, _match_groups4, _match_groups5, _match_groups6, _match_groups7, _match_groups8;
const match = value.match($fae977aafc393c5c$var$DATE_TIME_DURATION_RE);
if (!match) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const parseDurationGroup = (group, isNegative, min, max)=>{
if (!group) return 0;
try {
const sign = isNegative ? -1 : 1;
return sign * $fae977aafc393c5c$var$parseNumber(group.replace(',', '.'), min, max);
} catch {
throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
}
};
const isNegative = !!((_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups.negative);
const hasRequiredGroups = $fae977aafc393c5c$var$requiredDurationGroups.some((group)=>{
var _match_groups;
return (_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[group];
});
if (!hasRequiredGroups) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const durationStringIncludesTime = (_match_groups1 = match.groups) === null || _match_groups1 === void 0 ? void 0 : _match_groups1.time;
if (durationStringIncludesTime) {
const hasRequiredDurationTimeGroups = $fae977aafc393c5c$var$requiredDurationTimeGroups.some((group)=>{
var _match_groups;
return (_match_groups = match.groups) === null || _match_groups === void 0 ? void 0 : _match_groups[group];
});
if (!hasRequiredDurationTimeGroups) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
}
const duration = {
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative, 0, 9999),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative, 0, 12),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative, 0, Infinity),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative, 0, 31),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative, 0, 23),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
};
if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
if (duration.minutes !== undefined && duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
return duration;
}
export {$fae977aafc393c5c$export$c9698ec7f05a07e1 as parseTime, $fae977aafc393c5c$export$6b862160d295c8e as parseDate, $fae977aafc393c5c$export$588937bcd60ade55 as parseDateTime, $fae977aafc393c5c$export$fd7893f06e92a6a4 as parseZonedDateTime, $fae977aafc393c5c$export$4223de14708adc63 as dateTimeToString, $fae977aafc393c5c$export$5adfdab05168c219 as parseAbsolute, $fae977aafc393c5c$export$8e384432362ed0f0 as parseAbsoluteToLocal, $fae977aafc393c5c$export$f59dee82248f5ad4 as timeToString, $fae977aafc393c5c$export$60dfd74aa96791bd as dateToString, $fae977aafc393c5c$export$bf79f1ebf4b18792 as zonedDateTimeToString, $fae977aafc393c5c$export$ecae829bb3747ea6 as parseDuration};
//# sourceMappingURL=string.module.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,636 @@
type Mutable<T> = {
-readonly [P in keyof T]: T[P];
};
/**
* The Gregorian calendar is the most commonly used calendar system in the world. It supports two eras: BC, and AD.
* Years always contain 12 months, and 365 or 366 days depending on whether it is a leap year.
*/
export class GregorianCalendar implements Calendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getMonthsInYear(date: AnyCalendarDate): number;
getDaysInYear(date: AnyCalendarDate): number;
getYearsInEra(date: AnyCalendarDate): number;
getEras(): string[];
isInverseEra(date: AnyCalendarDate): boolean;
balanceDate(date: Mutable<AnyCalendarDate>): void;
}
type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
/** Returns whether the given dates occur on the same day, regardless of the time or calendar system. */
export function isSameDay(a: DateValue, b: DateValue): boolean;
/** Returns whether the given dates occur in the same month, using the calendar system of the first date. */
export function isSameMonth(a: DateValue, b: DateValue): boolean;
/** Returns whether the given dates occur in the same year, using the calendar system of the first date. */
export function isSameYear(a: DateValue, b: DateValue): boolean;
/** Returns whether the given dates occur on the same day, and are of the same calendar system. */
export function isEqualDay(a: DateValue, b: DateValue): boolean;
/** Returns whether the given dates occur in the same month, and are of the same calendar system. */
export function isEqualMonth(a: DateValue, b: DateValue): boolean;
/** Returns whether the given dates occur in the same year, and are of the same calendar system. */
export function isEqualYear(a: DateValue, b: DateValue): boolean;
/** Returns whether the date is today in the given time zone. */
export function isToday(date: DateValue, timeZone: string): boolean;
/**
* Returns the day of week for the given date and locale. Days are numbered from zero to six,
* where zero is the first day of the week in the given locale. For example, in the United States,
* the first day of the week is Sunday, but in France it is Monday.
*/
export function getDayOfWeek(date: DateValue, locale: string): number;
/** Returns the current time in the given time zone. */
export function now(timeZone: string): ZonedDateTime;
/** Returns today's date in the given time zone. */
export function today(timeZone: string): CalendarDate;
/**
* Returns the number of hours in the given date and time zone.
* Usually this is 24, but it could be 23 or 25 if the date is on a daylight saving transition.
*/
export function getHoursInDay(a: CalendarDate, timeZone: string): number;
/** Returns the time zone identifier for the current user. */
export function getLocalTimeZone(): string;
/** Returns the first date of the month for the given date. */
export function startOfMonth(date: ZonedDateTime): ZonedDateTime;
export function startOfMonth(date: CalendarDateTime): CalendarDateTime;
export function startOfMonth(date: CalendarDate): CalendarDate;
export function startOfMonth(date: DateValue): DateValue;
/** Returns the last date of the month for the given date. */
export function endOfMonth(date: ZonedDateTime): ZonedDateTime;
export function endOfMonth(date: CalendarDateTime): CalendarDateTime;
export function endOfMonth(date: CalendarDate): CalendarDate;
export function endOfMonth(date: DateValue): DateValue;
/** Returns the first day of the year for the given date. */
export function startOfYear(date: ZonedDateTime): ZonedDateTime;
export function startOfYear(date: CalendarDateTime): CalendarDateTime;
export function startOfYear(date: CalendarDate): CalendarDate;
export function startOfYear(date: DateValue): DateValue;
/** Returns the last day of the year for the given date. */
export function endOfYear(date: ZonedDateTime): ZonedDateTime;
export function endOfYear(date: CalendarDateTime): CalendarDateTime;
export function endOfYear(date: CalendarDate): CalendarDate;
export function endOfYear(date: DateValue): DateValue;
export function getMinimumMonthInYear(date: AnyCalendarDate): number;
export function getMinimumDayInMonth(date: AnyCalendarDate): number;
/** Returns the first date of the week for the given date and locale. */
export function startOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;
export function startOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;
export function startOfWeek(date: CalendarDate, locale: string): CalendarDate;
export function startOfWeek(date: DateValue, locale: string): DateValue;
/** Returns the last date of the week for the given date and locale. */
export function endOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;
export function endOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;
export function endOfWeek(date: CalendarDate, locale: string): CalendarDate;
/** Returns the number of weeks in the given month and locale. */
export function getWeeksInMonth(date: DateValue, locale: string): number;
/** Returns the lesser of the two provider dates. */
export function minDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B;
/** Returns the greater of the two provider dates. */
export function maxDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B;
/** Returns whether the given date is on a weekend in the given locale. */
export function isWeekend(date: DateValue, locale: string): boolean;
/** Returns whether the given date is on a weekday in the given locale. */
export function isWeekday(date: DateValue, locale: string): boolean;
/**
* Takes a Unix epoch (milliseconds since 1970) and converts it to the provided time zone.
*/
export function fromAbsolute(ms: number, timeZone: string): ZonedDateTime;
/**
* Takes a `Date` object and converts it to the provided time zone.
*/
export function fromDate(date: Date, timeZone: string): ZonedDateTime;
/** Converts a value with date components such as a `CalendarDateTime` or `ZonedDateTime` into a `CalendarDate`. */
export function toCalendarDate(dateTime: AnyCalendarDate): CalendarDate;
/**
* Converts a date value to a `CalendarDateTime`. An optional `Time` value can be passed to set the time
* of the resulting value, otherwise it will default to midnight.
*/
export function toCalendarDateTime(date: CalendarDate | CalendarDateTime | ZonedDateTime, time?: AnyTime): CalendarDateTime;
/** Extracts the time components from a value containing a date and time. */
export function toTime(dateTime: CalendarDateTime | ZonedDateTime): Time;
/** Converts a date from one calendar system to another. */
export function toCalendar<T extends AnyCalendarDate>(date: T, calendar: Calendar): T;
/**
* Converts a date value to a `ZonedDateTime` in the provided time zone. The `disambiguation` option can be set
* to control how values that fall on daylight saving time changes are interpreted.
*/
export function toZoned(date: CalendarDate | CalendarDateTime | ZonedDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime;
/** Converts a `ZonedDateTime` from one time zone to another. */
export function toTimeZone(date: ZonedDateTime, timeZone: string): ZonedDateTime;
/** Converts the given `ZonedDateTime` into the user's local time zone. */
export function toLocalTimeZone(date: ZonedDateTime): ZonedDateTime;
/** Parses an ISO 8601 time string. */
export function parseTime(value: string): Time;
/** Parses an ISO 8601 date string, with no time components. */
export function parseDate(value: string): CalendarDate;
/** Parses an ISO 8601 date and time string, with no time zone. */
export function parseDateTime(value: string): CalendarDateTime;
/**
* Parses an ISO 8601 date and time string with a time zone extension and optional UTC offset
* (e.g. "2021-11-07T00:45[America/Los_Angeles]" or "2021-11-07T00:45-07:00[America/Los_Angeles]").
* Ambiguous times due to daylight saving time transitions are resolved according to the `disambiguation`
* parameter.
*/
export function parseZonedDateTime(value: string, disambiguation?: Disambiguation): ZonedDateTime;
/**
* Parses an ISO 8601 date and time string with a UTC offset (e.g. "2021-11-07T07:45:00Z"
* or "2021-11-07T07:45:00-07:00"). The result is converted to the provided time zone.
*/
export function parseAbsolute(value: string, timeZone: string): ZonedDateTime;
/**
* Parses an ISO 8601 date and time string with a UTC offset (e.g. "2021-11-07T07:45:00Z"
* or "2021-11-07T07:45:00-07:00"). The result is converted to the user's local time zone.
*/
export function parseAbsoluteToLocal(value: string): ZonedDateTime;
/**
* Parses an ISO 8601 duration string (e.g. "P3Y6M6W4DT12H30M5S").
* @param value An ISO 8601 duration string.
* @returns A DateTimeDuration object.
*/
export function parseDuration(value: string): Required<DateTimeDuration>;
/** A CalendarDate represents a date without any time components in a specific calendar system. */
export class CalendarDate {
#private;
/** The calendar system associated with this date, e.g. Gregorian. */
readonly calendar: Calendar;
/** The calendar era for this date, e.g. "BC" or "AD". */
readonly era: string;
/** The year of this date within the era. */
readonly year: number;
/**
* The month number within the year. Note that some calendar systems such as Hebrew
* may have a variable number of months per year. Therefore, month numbers may not
* always correspond to the same month names in different years.
*/
readonly month: number;
/** The day number within the month. */
readonly day: number;
constructor(year: number, month: number, day: number);
constructor(era: string, year: number, month: number, day: number);
constructor(calendar: Calendar, year: number, month: number, day: number);
constructor(calendar: Calendar, era: string, year: number, month: number, day: number);
/** Returns a copy of this date. */
copy(): CalendarDate;
/** Returns a new `CalendarDate` with the given duration added to it. */
add(duration: DateDuration): CalendarDate;
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
subtract(duration: DateDuration): CalendarDate;
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
set(fields: DateFields): CalendarDate;
/**
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/
cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate;
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
toDate(timeZone: string): Date;
/** Converts the date to an ISO 8601 formatted string. */
toString(): string;
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
compare(b: AnyCalendarDate): number;
}
/** A Time represents a clock time without any date components. */
export class Time {
#private;
/** The hour, numbered from 0 to 23. */
readonly hour: number;
/** The minute in the hour. */
readonly minute: number;
/** The second in the minute. */
readonly second: number;
/** The millisecond in the second. */
readonly millisecond: number;
constructor(hour?: number, minute?: number, second?: number, millisecond?: number);
/** Returns a copy of this time. */
copy(): Time;
/** Returns a new `Time` with the given duration added to it. */
add(duration: TimeDuration): Time;
/** Returns a new `Time` with the given duration subtracted from it. */
subtract(duration: TimeDuration): Time;
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
set(fields: TimeFields): Time;
/**
* Returns a new `Time` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/
cycle(field: TimeField, amount: number, options?: CycleTimeOptions): Time;
/** Converts the time to an ISO 8601 formatted string. */
toString(): string;
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
compare(b: AnyTime): number;
}
/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */
export class CalendarDateTime {
#private;
/** The calendar system associated with this date, e.g. Gregorian. */
readonly calendar: Calendar;
/** The calendar era for this date, e.g. "BC" or "AD". */
readonly era: string;
/** The year of this date within the era. */
readonly year: number;
/**
* The month number within the year. Note that some calendar systems such as Hebrew
* may have a variable number of months per year. Therefore, month numbers may not
* always correspond to the same month names in different years.
*/
readonly month: number;
/** The day number within the month. */
readonly day: number;
/** The hour in the day, numbered from 0 to 23. */
readonly hour: number;
/** The minute in the hour. */
readonly minute: number;
/** The second in the minute. */
readonly second: number;
/** The millisecond in the second. */
readonly millisecond: number;
constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
constructor(era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
constructor(calendar: Calendar, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
constructor(calendar: Calendar, era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);
/** Returns a copy of this date. */
copy(): CalendarDateTime;
/** Returns a new `CalendarDateTime` with the given duration added to it. */
add(duration: DateTimeDuration): CalendarDateTime;
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
subtract(duration: DateTimeDuration): CalendarDateTime;
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
set(fields: DateFields & TimeFields): CalendarDateTime;
/**
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/
cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime;
/** Converts the date to a native JavaScript Date object in the given time zone. */
toDate(timeZone: string, disambiguation?: Disambiguation): Date;
/** Converts the date to an ISO 8601 formatted string. */
toString(): string;
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number;
}
/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */
export class ZonedDateTime {
#private;
/** The calendar system associated with this date, e.g. Gregorian. */
readonly calendar: Calendar;
/** The calendar era for this date, e.g. "BC" or "AD". */
readonly era: string;
/** The year of this date within the era. */
readonly year: number;
/**
* The month number within the year. Note that some calendar systems such as Hebrew
* may have a variable number of months per year. Therefore, month numbers may not
* always correspond to the same month names in different years.
*/
readonly month: number;
/** The day number within the month. */
readonly day: number;
/** The hour in the day, numbered from 0 to 23. */
readonly hour: number;
/** The minute in the hour. */
readonly minute: number;
/** The second in the minute. */
readonly second: number;
/** The millisecond in the second. */
readonly millisecond: number;
/** The IANA time zone identifier that this date and time is represented in. */
readonly timeZone: string;
/** The UTC offset for this time, in milliseconds. */
readonly offset: number;
constructor(year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
constructor(era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
constructor(calendar: Calendar, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
constructor(calendar: Calendar, era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);
/** Returns a copy of this date. */
copy(): ZonedDateTime;
/** Returns a new `ZonedDateTime` with the given duration added to it. */
add(duration: DateTimeDuration): ZonedDateTime;
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
subtract(duration: DateTimeDuration): ZonedDateTime;
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
set(fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime;
/**
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
* When the resulting value reaches the limits of the field, it wraps around.
*/
cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime;
/** Converts the date to a native JavaScript Date object. */
toDate(): Date;
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
toString(): string;
/** Converts the date to an ISO 8601 formatted string in UTC. */
toAbsoluteString(): string;
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number;
}
/** An interface that is compatible with any object with date fields. */
export interface AnyCalendarDate {
readonly calendar: Calendar;
readonly era: string;
readonly year: number;
readonly month: number;
readonly day: number;
copy(): this;
}
/** An interface that is compatible with any object with time fields. */
export interface AnyTime {
readonly hour: number;
readonly minute: number;
readonly second: number;
readonly millisecond: number;
copy(): this;
}
/** An interface that is compatible with any object with both date and time fields. */
export interface AnyDateTime extends AnyCalendarDate, AnyTime {
}
/**
* The Calendar interface represents a calendar system, including information
* about how days, months, years, and eras are organized, and methods to perform
* arithmetic on dates.
*/
export interface Calendar {
/** A string identifier for the calendar, as defined by Unicode CLDR. */
identifier: string;
/** Creates a CalendarDate in this calendar from the given Julian day number. */
fromJulianDay(jd: number): CalendarDate;
/** Converts a date in this calendar to a Julian day number. */
toJulianDay(date: AnyCalendarDate): number;
/** Returns the number of days in the month of the given date. */
getDaysInMonth(date: AnyCalendarDate): number;
/** Returns the number of months in the year of the given date. */
getMonthsInYear(date: AnyCalendarDate): number;
/** Returns the number of years in the era of the given date. */
getYearsInEra(date: AnyCalendarDate): number;
/** Returns a list of era identifiers for the calendar. */
getEras(): string[];
/**
* Returns the minimum month number of the given date's year.
* Normally, this is 1, but in some calendars such as the Japanese,
* eras may begin in the middle of a year.
*/
getMinimumMonthInYear?(date: AnyCalendarDate): number;
/**
* Returns the minimum day number of the given date's month.
* Normally, this is 1, but in some calendars such as the Japanese,
* eras may begin in the middle of a month.
*/
getMinimumDayInMonth?(date: AnyCalendarDate): number;
/** @private */
balanceDate?(date: AnyCalendarDate): void;
/** @private */
balanceYearMonth?(date: AnyCalendarDate, previousDate: AnyCalendarDate): void;
/** @private */
constrainDate?(date: AnyCalendarDate): void;
/** @private */
isInverseEra?(date: AnyCalendarDate): boolean;
}
/** Represents an amount of time in calendar-specific units, for use when performing arithmetic. */
export interface DateDuration {
/** The number of years to add or subtract. */
years?: number;
/** The number of months to add or subtract. */
months?: number;
/** The number of weeks to add or subtract. */
weeks?: number;
/** The number of days to add or subtract. */
days?: number;
}
/** Represents an amount of time, for use whe performing arithmetic. */
export interface TimeDuration {
/** The number of hours to add or subtract. */
hours?: number;
/** The number of minutes to add or subtract. */
minutes?: number;
/** The number of seconds to add or subtract. */
seconds?: number;
/** The number of milliseconds to add or subtract. */
milliseconds?: number;
}
/** Represents an amount of time with both date and time components, for use when performing arithmetic. */
export interface DateTimeDuration extends DateDuration, TimeDuration {
}
export interface DateFields {
era?: string;
year?: number;
month?: number;
day?: number;
}
export interface TimeFields {
hour?: number;
minute?: number;
second?: number;
millisecond?: number;
}
export type DateField = keyof DateFields;
export type TimeField = keyof TimeFields;
export type Disambiguation = 'compatible' | 'earlier' | 'later' | 'reject';
export interface CycleOptions {
/** Whether to round the field value to the nearest interval of the amount. */
round?: boolean;
}
export interface CycleTimeOptions extends CycleOptions {
/**
* Whether to use 12 or 24 hour time. If 12 hour time is chosen, the resulting value
* will remain in the same day period as the original value (e.g. if the value is AM,
* the resulting value also be AM).
* @default 24
*/
hourCycle?: 12 | 24;
}
/**
* The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.
* Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.
* Note that eras before 1868 (Gregorian) are not currently supported by this implementation.
*/
export class JapaneseCalendar extends GregorianCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
balanceDate(date: Mutable<AnyCalendarDate>): void;
constrainDate(date: Mutable<AnyCalendarDate>): void;
getEras(): string[];
getYearsInEra(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getMinimumMonthInYear(date: AnyCalendarDate): number;
getMinimumDayInMonth(date: AnyCalendarDate): number;
}
/**
* The Buddhist calendar is the same as the Gregorian calendar, but counts years
* starting from the birth of Buddha in 543 BC (Gregorian). It supports only one
* era, identified as 'BE'.
*/
export class BuddhistCalendar extends GregorianCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getEras(): string[];
getDaysInMonth(date: AnyCalendarDate): number;
balanceDate(): void;
}
/**
* The Taiwanese calendar is the same as the Gregorian calendar, but years
* are numbered starting from 1912 (Gregorian). Two eras are supported:
* 'before_minguo' and 'minguo'.
*/
export class TaiwanCalendar extends GregorianCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getEras(): string[];
balanceDate(date: Mutable<AnyCalendarDate>): void;
isInverseEra(date: AnyCalendarDate): boolean;
getDaysInMonth(date: AnyCalendarDate): number;
getYearsInEra(date: AnyCalendarDate): number;
}
/**
* The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months
* in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month
* has either 29 or 30 days depending on whether it is a leap year. The Persian year starts
* around the March equinox.
*/
export class PersianCalendar implements Calendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getMonthsInYear(): number;
getDaysInMonth(date: AnyCalendarDate): number;
getEras(): string[];
getYearsInEra(): number;
}
/**
* The Indian National Calendar is similar to the Gregorian calendar, but with
* years numbered since the Saka era in 78 AD (Gregorian). There are 12 months
* in each year, with either 30 or 31 days. Only one era identifier is supported: 'saka'.
*/
export class IndianCalendar extends GregorianCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getYearsInEra(): number;
getEras(): string[];
balanceDate(): void;
}
/**
* The Islamic calendar, also known as the "Hijri" calendar, is used throughout much of the Arab world.
* The civil variant uses simple arithmetic rules rather than astronomical calculations to approximate
* the traditional calendar, which is based on sighting of the crescent moon. It uses Friday, July 16 622 CE (Julian) as the epoch.
* Each year has 12 months, with either 354 or 355 days depending on whether it is a leap year.
* Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).
*/
export class IslamicCivilCalendar implements Calendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getMonthsInYear(): number;
getDaysInYear(date: AnyCalendarDate): number;
getYearsInEra(): number;
getEras(): string[];
}
/**
* The Islamic calendar, also known as the "Hijri" calendar, is used throughout much of the Arab world.
* The tabular variant uses simple arithmetic rules rather than astronomical calculations to approximate
* the traditional calendar, which is based on sighting of the crescent moon. It uses Thursday, July 15 622 CE (Julian) as the epoch.
* Each year has 12 months, with either 354 or 355 days depending on whether it is a leap year.
* Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).
*/
export class IslamicTabularCalendar extends IslamicCivilCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
}
/**
* The Islamic calendar, also known as the "Hijri" calendar, is used throughout much of the Arab world.
* The Umalqura variant is primarily used in Saudi Arabia. It is a lunar calendar, based on astronomical
* calculations that predict the sighting of a crescent moon. Month and year lengths vary between years
* depending on these calculations.
* Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).
*/
export class IslamicUmalquraCalendar extends IslamicCivilCalendar {
identifier: string;
constructor();
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getDaysInYear(date: AnyCalendarDate): number;
}
/**
* The Hebrew calendar is used in Israel and around the world by the Jewish faith.
* Years include either 12 or 13 months depending on whether it is a leap year.
* In leap years, an extra month is inserted at month 6.
*/
export class HebrewCalendar implements Calendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getMonthsInYear(date: AnyCalendarDate): number;
getDaysInYear(date: AnyCalendarDate): number;
getYearsInEra(): number;
getEras(): string[];
balanceYearMonth(date: Mutable<AnyCalendarDate>, previousDate: AnyCalendarDate): void;
}
/**
* The Ethiopic calendar system is the official calendar used in Ethiopia.
* It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending
* on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.
*/
export class EthiopicCalendar implements Calendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
getMonthsInYear(): number;
getDaysInYear(date: AnyCalendarDate): number;
getYearsInEra(date: AnyCalendarDate): number;
getEras(): string[];
}
/**
* The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,
* except years were measured from a different epoch. Only one era is supported: 'AA'.
*/
export class EthiopicAmeteAlemCalendar extends EthiopicCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
getEras(): string[];
getYearsInEra(): number;
}
/**
* The Coptic calendar is similar to the Ethiopic calendar.
* It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending
* on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.
*/
export class CopticCalendar extends EthiopicCalendar {
identifier: string;
fromJulianDay(jd: number): CalendarDate;
toJulianDay(date: AnyCalendarDate): number;
getDaysInMonth(date: AnyCalendarDate): number;
isInverseEra(date: AnyCalendarDate): boolean;
balanceDate(date: Mutable<AnyCalendarDate>): void;
getEras(): string[];
getYearsInEra(date: AnyCalendarDate): number;
}
/** Creates a `Calendar` instance from a Unicode calendar identifier string. */
export function createCalendar(name: string): Calendar;
interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {
hourCycle?: Intl.DateTimeFormatOptions['hourCycle'];
}
interface DateRangeFormatPart extends Intl.DateTimeFormatPart {
source: 'startRange' | 'endRange' | 'shared';
}
/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */
export class DateFormatter implements Intl.DateTimeFormat {
constructor(locale: string, options?: Intl.DateTimeFormatOptions);
/** Formats a date as a string according to the locale and format options passed to the constructor. */
format(value: Date): string;
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
formatToParts(value: Date): Intl.DateTimeFormatPart[];
/** Formats a date range as a string. */
formatRange(start: Date, end: Date): string;
/** Formats a date range as an array of parts. */
formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[];
/** Returns the resolved formatting options based on the values passed to the constructor. */
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
//# sourceMappingURL=types.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,33 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "mod", () => $a5090d6430502238$export$842a2cf37af977e1);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $a5090d6430502238$export$842a2cf37af977e1(amount, numerator) {
return amount - numerator * Math.floor(amount / numerator);
}
function $a5090d6430502238$export$784d13d8ee351f07(date) {
if (date.era) return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(date.calendar, date.era, date.year, date.month, date.day);
else return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(date.calendar, date.year, date.month, date.day);
}
function $a5090d6430502238$export$27fa0172ae2644b3(date) {
if (date.era) return new (0, $625ad1e1f4c43bc1$exports.CalendarDateTime)(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
else return new (0, $625ad1e1f4c43bc1$exports.CalendarDateTime)(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);
}
//# sourceMappingURL=utils.main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAQM,SAAS,0CAAI,MAAc,EAAE,SAAiB;IACnD,OAAO,SAAS,YAAY,KAAK,KAAK,CAAC,SAAS;AAClD;AAEO,SAAS,0CAAK,IAAkB;IACrC,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;SAEhF,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;AAE1E;AAEO,SAAS,0CAAa,IAAsB;IACjD,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,0CAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW;SAE3I,OAAO,IAAI,CAAA,GAAA,0CAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM;AAEnH","sources":["packages/@internationalized/date/src/utils.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 {CalendarDate, CalendarDateTime} from './CalendarDate';\n\nexport type Mutable<T> = {\n -readonly[P in keyof T]: T[P]\n};\n\nexport function mod(amount: number, numerator: number): number {\n return amount - numerator * Math.floor(amount / numerator);\n}\n\nexport function copy(date: CalendarDate): Mutable<CalendarDate> {\n if (date.era) {\n return new CalendarDate(date.calendar, date.era, date.year, date.month, date.day);\n } else {\n return new CalendarDate(date.calendar, date.year, date.month, date.day);\n }\n}\n\nexport function copyDateTime(date: CalendarDateTime): Mutable<CalendarDateTime> {\n if (date.era) {\n return new CalendarDateTime(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n } else {\n return new CalendarDateTime(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);\n }\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}

View File

@@ -0,0 +1,28 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f} from "./CalendarDate.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
return amount - numerator * Math.floor(amount / numerator);
}
function $2b4dce13dd5a17fa$export$784d13d8ee351f07(date) {
if (date.era) return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.calendar, date.era, date.year, date.month, date.day);
else return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.calendar, date.year, date.month, date.day);
}
function $2b4dce13dd5a17fa$export$27fa0172ae2644b3(date) {
if (date.era) return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
else return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);
}
export {$2b4dce13dd5a17fa$export$842a2cf37af977e1 as mod, $2b4dce13dd5a17fa$export$784d13d8ee351f07 as copy, $2b4dce13dd5a17fa$export$27fa0172ae2644b3 as copyDateTime};
//# sourceMappingURL=utils.module.js.map

View File

@@ -0,0 +1,28 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f} from "./CalendarDate.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
return amount - numerator * Math.floor(amount / numerator);
}
function $2b4dce13dd5a17fa$export$784d13d8ee351f07(date) {
if (date.era) return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.calendar, date.era, date.year, date.month, date.day);
else return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(date.calendar, date.year, date.month, date.day);
}
function $2b4dce13dd5a17fa$export$27fa0172ae2644b3(date) {
if (date.era) return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
else return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);
}
export {$2b4dce13dd5a17fa$export$842a2cf37af977e1 as mod, $2b4dce13dd5a17fa$export$784d13d8ee351f07 as copy, $2b4dce13dd5a17fa$export$27fa0172ae2644b3 as copyDateTime};
//# sourceMappingURL=utils.module.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAQM,SAAS,0CAAI,MAAc,EAAE,SAAiB;IACnD,OAAO,SAAS,YAAY,KAAK,KAAK,CAAC,SAAS;AAClD;AAEO,SAAS,0CAAK,IAAkB;IACrC,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;SAEhF,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;AAE1E;AAEO,SAAS,0CAAa,IAAsB;IACjD,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,yCAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW;SAE3I,OAAO,IAAI,CAAA,GAAA,yCAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM;AAEnH","sources":["packages/@internationalized/date/src/utils.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 {CalendarDate, CalendarDateTime} from './CalendarDate';\n\nexport type Mutable<T> = {\n -readonly[P in keyof T]: T[P]\n};\n\nexport function mod(amount: number, numerator: number): number {\n return amount - numerator * Math.floor(amount / numerator);\n}\n\nexport function copy(date: CalendarDate): Mutable<CalendarDate> {\n if (date.era) {\n return new CalendarDate(date.calendar, date.era, date.year, date.month, date.day);\n } else {\n return new CalendarDate(date.calendar, date.year, date.month, date.day);\n }\n}\n\nexport function copyDateTime(date: CalendarDateTime): Mutable<CalendarDateTime> {\n if (date.era) {\n return new CalendarDateTime(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n } else {\n return new CalendarDateTime(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);\n }\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}

View File

@@ -0,0 +1,118 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "weekStartData", () => $4d88eff242b38a9e$export$7a5acbd77d414bd9);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json
// Locales starting on Sunday have been removed for compression.
const $4d88eff242b38a9e$export$7a5acbd77d414bd9 = {
'001': 1,
AD: 1,
AE: 6,
AF: 6,
AI: 1,
AL: 1,
AM: 1,
AN: 1,
AR: 1,
AT: 1,
AU: 1,
AX: 1,
AZ: 1,
BA: 1,
BE: 1,
BG: 1,
BH: 6,
BM: 1,
BN: 1,
BY: 1,
CH: 1,
CL: 1,
CM: 1,
CN: 1,
CR: 1,
CY: 1,
CZ: 1,
DE: 1,
DJ: 6,
DK: 1,
DZ: 6,
EC: 1,
EE: 1,
EG: 6,
ES: 1,
FI: 1,
FJ: 1,
FO: 1,
FR: 1,
GB: 1,
GE: 1,
GF: 1,
GP: 1,
GR: 1,
HR: 1,
HU: 1,
IE: 1,
IQ: 6,
IR: 6,
IS: 1,
IT: 1,
JO: 6,
KG: 1,
KW: 6,
KZ: 1,
LB: 1,
LI: 1,
LK: 1,
LT: 1,
LU: 1,
LV: 1,
LY: 6,
MC: 1,
MD: 1,
ME: 1,
MK: 1,
MN: 1,
MQ: 1,
MV: 5,
MY: 1,
NL: 1,
NO: 1,
NZ: 1,
OM: 6,
PL: 1,
QA: 6,
RE: 1,
RO: 1,
RS: 1,
RU: 1,
SD: 6,
SE: 1,
SI: 1,
SK: 1,
SM: 1,
SY: 6,
TJ: 1,
TM: 1,
TR: 1,
UA: 1,
UY: 1,
UZ: 1,
VA: 1,
VN: 1,
XK: 1
};
//# sourceMappingURL=weekStartData.main.js.map

View File

@@ -0,0 +1 @@
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,6FAA6F;AAC7F,gEAAgE;AACzD,MAAM,4CAAgB;IAC3B,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;AACN","sources":["packages/@internationalized/date/src/weekStartData.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\n// Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json\n// Locales starting on Sunday have been removed for compression.\nexport const weekStartData = {\n '001': 1,\n AD: 1,\n AE: 6,\n AF: 6,\n AI: 1,\n AL: 1,\n AM: 1,\n AN: 1,\n AR: 1,\n AT: 1,\n AU: 1,\n AX: 1,\n AZ: 1,\n BA: 1,\n BE: 1,\n BG: 1,\n BH: 6,\n BM: 1,\n BN: 1,\n BY: 1,\n CH: 1,\n CL: 1,\n CM: 1,\n CN: 1,\n CR: 1,\n CY: 1,\n CZ: 1,\n DE: 1,\n DJ: 6,\n DK: 1,\n DZ: 6,\n EC: 1,\n EE: 1,\n EG: 6,\n ES: 1,\n FI: 1,\n FJ: 1,\n FO: 1,\n FR: 1,\n GB: 1,\n GE: 1,\n GF: 1,\n GP: 1,\n GR: 1,\n HR: 1,\n HU: 1,\n IE: 1,\n IQ: 6,\n IR: 6,\n IS: 1,\n IT: 1,\n JO: 6,\n KG: 1,\n KW: 6,\n KZ: 1,\n LB: 1,\n LI: 1,\n LK: 1,\n LT: 1,\n LU: 1,\n LV: 1,\n LY: 6,\n MC: 1,\n MD: 1,\n ME: 1,\n MK: 1,\n MN: 1,\n MQ: 1,\n MV: 5,\n MY: 1,\n NL: 1,\n NO: 1,\n NZ: 1,\n OM: 6,\n PL: 1,\n QA: 6,\n RE: 1,\n RO: 1,\n RS: 1,\n RU: 1,\n SD: 6,\n SE: 1,\n SI: 1,\n SK: 1,\n SM: 1,\n SY: 6,\n TJ: 1,\n TM: 1,\n TR: 1,\n UA: 1,\n UY: 1,\n UZ: 1,\n VA: 1,\n VN: 1,\n XK: 1\n};\n"],"names":[],"version":3,"file":"weekStartData.main.js.map"}

View File

@@ -0,0 +1,113 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json
// Locales starting on Sunday have been removed for compression.
const $2fe286d2fb449abb$export$7a5acbd77d414bd9 = {
'001': 1,
AD: 1,
AE: 6,
AF: 6,
AI: 1,
AL: 1,
AM: 1,
AN: 1,
AR: 1,
AT: 1,
AU: 1,
AX: 1,
AZ: 1,
BA: 1,
BE: 1,
BG: 1,
BH: 6,
BM: 1,
BN: 1,
BY: 1,
CH: 1,
CL: 1,
CM: 1,
CN: 1,
CR: 1,
CY: 1,
CZ: 1,
DE: 1,
DJ: 6,
DK: 1,
DZ: 6,
EC: 1,
EE: 1,
EG: 6,
ES: 1,
FI: 1,
FJ: 1,
FO: 1,
FR: 1,
GB: 1,
GE: 1,
GF: 1,
GP: 1,
GR: 1,
HR: 1,
HU: 1,
IE: 1,
IQ: 6,
IR: 6,
IS: 1,
IT: 1,
JO: 6,
KG: 1,
KW: 6,
KZ: 1,
LB: 1,
LI: 1,
LK: 1,
LT: 1,
LU: 1,
LV: 1,
LY: 6,
MC: 1,
MD: 1,
ME: 1,
MK: 1,
MN: 1,
MQ: 1,
MV: 5,
MY: 1,
NL: 1,
NO: 1,
NZ: 1,
OM: 6,
PL: 1,
QA: 6,
RE: 1,
RO: 1,
RS: 1,
RU: 1,
SD: 6,
SE: 1,
SI: 1,
SK: 1,
SM: 1,
SY: 6,
TJ: 1,
TM: 1,
TR: 1,
UA: 1,
UY: 1,
UZ: 1,
VA: 1,
VN: 1,
XK: 1
};
export {$2fe286d2fb449abb$export$7a5acbd77d414bd9 as weekStartData};
//# sourceMappingURL=weekStartData.module.js.map

View File

@@ -0,0 +1,113 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json
// Locales starting on Sunday have been removed for compression.
const $2fe286d2fb449abb$export$7a5acbd77d414bd9 = {
'001': 1,
AD: 1,
AE: 6,
AF: 6,
AI: 1,
AL: 1,
AM: 1,
AN: 1,
AR: 1,
AT: 1,
AU: 1,
AX: 1,
AZ: 1,
BA: 1,
BE: 1,
BG: 1,
BH: 6,
BM: 1,
BN: 1,
BY: 1,
CH: 1,
CL: 1,
CM: 1,
CN: 1,
CR: 1,
CY: 1,
CZ: 1,
DE: 1,
DJ: 6,
DK: 1,
DZ: 6,
EC: 1,
EE: 1,
EG: 6,
ES: 1,
FI: 1,
FJ: 1,
FO: 1,
FR: 1,
GB: 1,
GE: 1,
GF: 1,
GP: 1,
GR: 1,
HR: 1,
HU: 1,
IE: 1,
IQ: 6,
IR: 6,
IS: 1,
IT: 1,
JO: 6,
KG: 1,
KW: 6,
KZ: 1,
LB: 1,
LI: 1,
LK: 1,
LT: 1,
LU: 1,
LV: 1,
LY: 6,
MC: 1,
MD: 1,
ME: 1,
MK: 1,
MN: 1,
MQ: 1,
MV: 5,
MY: 1,
NL: 1,
NO: 1,
NZ: 1,
OM: 6,
PL: 1,
QA: 6,
RE: 1,
RO: 1,
RS: 1,
RU: 1,
SD: 6,
SE: 1,
SI: 1,
SK: 1,
SM: 1,
SY: 6,
TJ: 1,
TM: 1,
TR: 1,
UA: 1,
UY: 1,
UZ: 1,
VA: 1,
VN: 1,
XK: 1
};
export {$2fe286d2fb449abb$export$7a5acbd77d414bd9 as weekStartData};
//# sourceMappingURL=weekStartData.module.js.map

View File

@@ -0,0 +1 @@
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,6FAA6F;AAC7F,gEAAgE;AACzD,MAAM,4CAAgB;IAC3B,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;AACN","sources":["packages/@internationalized/date/src/weekStartData.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\n// Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json\n// Locales starting on Sunday have been removed for compression.\nexport const weekStartData = {\n '001': 1,\n AD: 1,\n AE: 6,\n AF: 6,\n AI: 1,\n AL: 1,\n AM: 1,\n AN: 1,\n AR: 1,\n AT: 1,\n AU: 1,\n AX: 1,\n AZ: 1,\n BA: 1,\n BE: 1,\n BG: 1,\n BH: 6,\n BM: 1,\n BN: 1,\n BY: 1,\n CH: 1,\n CL: 1,\n CM: 1,\n CN: 1,\n CR: 1,\n CY: 1,\n CZ: 1,\n DE: 1,\n DJ: 6,\n DK: 1,\n DZ: 6,\n EC: 1,\n EE: 1,\n EG: 6,\n ES: 1,\n FI: 1,\n FJ: 1,\n FO: 1,\n FR: 1,\n GB: 1,\n GE: 1,\n GF: 1,\n GP: 1,\n GR: 1,\n HR: 1,\n HU: 1,\n IE: 1,\n IQ: 6,\n IR: 6,\n IS: 1,\n IT: 1,\n JO: 6,\n KG: 1,\n KW: 6,\n KZ: 1,\n LB: 1,\n LI: 1,\n LK: 1,\n LT: 1,\n LU: 1,\n LV: 1,\n LY: 6,\n MC: 1,\n MD: 1,\n ME: 1,\n MK: 1,\n MN: 1,\n MQ: 1,\n MV: 5,\n MY: 1,\n NL: 1,\n NO: 1,\n NZ: 1,\n OM: 6,\n PL: 1,\n QA: 6,\n RE: 1,\n RO: 1,\n RS: 1,\n RU: 1,\n SD: 6,\n SE: 1,\n SI: 1,\n SK: 1,\n SM: 1,\n SY: 6,\n TJ: 1,\n TM: 1,\n TR: 1,\n UA: 1,\n UY: 1,\n UZ: 1,\n VA: 1,\n VN: 1,\n XK: 1\n};\n"],"names":[],"version":3,"file":"weekStartData.module.js.map"}