feat: Phase 1 — extract the client (web SPA + desktop) to dtoro/oikos-web
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

Problem: the hexagonal refactor churns the backend tree for nine more
phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper,
compose/web image) must move to its own repo first so doc/layout
rewrites land once on a backend-only tree.

Change:
- New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/
  (updateURL repointed to oikos-web releases), compose/, own CI (web +
  desktop jobs), own deploy script (CI-green gate, TOCTOU guard,
  version-tagged images, prune-to-3), own webhook receiver on :9798 +
  launchd unit, own compose project publishing the same 8091:80.
- Cutover executed on mac-mini in order: oikos stack's web service
  stopped+removed, oikos-web project brought up on 8091; outer Caddy
  untouched (targets the published port) — serving + Authentik flow +
  /wails 404 quirk verified post-cutover.
- Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI
  workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install
  targets, the compose web service, oikos-web from deploy.sh's fallback
  prune list; wails + go-keyring dropped from go.mod, vendor synced.
- README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now
  point at the new repo; mbse + mascot design docs carry a path note.

Risk: production SPA serving depends on the new pipeline now; rollback
is versioned-image re-up of the old web service from a pre-split
checkout (port 8091). Desktop builds installed before the split still
check dtoro/oikos releases — one manual reinstall, noted in the
oikos-web release notes.

Verification: go vet, make test (race), make generate-check, golangci
(no new findings; baseline down 400→365); post-cutover curls —
localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
This commit is contained in:
2026-08-15 22:27:52 +02:00
parent e074f04bdf
commit d4d99a7473
18854 changed files with 2615729 additions and 173735 deletions

View File

@@ -0,0 +1,53 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $05031860ba2f881f$exports = require("./GregorianCalendar.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "BuddhistCalendar", function () { return $0ce473f03e925476$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 $0ce473f03e925476$var$BUDDHIST_ERA_START = -543;
class $0ce473f03e925476$export$42d20a78301dee44 extends (0, $05031860ba2f881f$exports.GregorianCalendar) {
fromJulianDay(jd) {
let gregorianDate = super.fromJulianDay(jd);
let year = (0, $05031860ba2f881f$exports.getExtendedYear)(gregorianDate.era, gregorianDate.year);
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, year - $0ce473f03e925476$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
}
toJulianDay(date) {
return super.toJulianDay($0ce473f03e925476$var$toGregorian(date));
}
getEras() {
return [
'BE'
];
}
getDaysInMonth(date) {
return super.getDaysInMonth($0ce473f03e925476$var$toGregorian(date));
}
balanceDate() {}
constructor(...args){
super(...args), this.identifier = 'buddhist';
}
}
function $0ce473f03e925476$var$toGregorian(date) {
let [era, year] = (0, $05031860ba2f881f$exports.fromExtendedYear)(date.year + $0ce473f03e925476$var$BUDDHIST_ERA_START);
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(era, year, date.month, date.day);
}
//# sourceMappingURL=BuddhistCalendar.cjs.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,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAoB,CAAC;;QA1BhB,qBACL,aAAiC;;AA0BnC;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate(): void {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.cjs.map"}

View File

@@ -0,0 +1,48 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {fromExtendedYear as $f25df78da1f6b40f$export$4475b7e617eb123c, getExtendedYear as $f25df78da1f6b40f$export$c36e0ecb2d4fa69d, GregorianCalendar as $f25df78da1f6b40f$export$80ee6245ec4f29ec} from "./GregorianCalendar.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 $6f54c4fe66fc5ed5$var$BUDDHIST_ERA_START = -543;
class $6f54c4fe66fc5ed5$export$42d20a78301dee44 extends (0, $f25df78da1f6b40f$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let gregorianDate = super.fromJulianDay(jd);
let year = (0, $f25df78da1f6b40f$export$c36e0ecb2d4fa69d)(gregorianDate.era, gregorianDate.year);
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, year - $6f54c4fe66fc5ed5$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
}
toJulianDay(date) {
return super.toJulianDay($6f54c4fe66fc5ed5$var$toGregorian(date));
}
getEras() {
return [
'BE'
];
}
getDaysInMonth(date) {
return super.getDaysInMonth($6f54c4fe66fc5ed5$var$toGregorian(date));
}
balanceDate() {}
constructor(...args){
super(...args), this.identifier = 'buddhist';
}
}
function $6f54c4fe66fc5ed5$var$toGregorian(date) {
let [era, year] = (0, $f25df78da1f6b40f$export$4475b7e617eb123c)(date.year + $6f54c4fe66fc5ed5$var$BUDDHIST_ERA_START);
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$6f54c4fe66fc5ed5$export$42d20a78301dee44 as BuddhistCalendar};
//# sourceMappingURL=BuddhistCalendar.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,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAoB,CAAC;;QA1BhB,qBACL,aAAiC;;AA0BnC;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate(): void {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.js.map"}

View File

@@ -0,0 +1,48 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {fromExtendedYear as $93635573935797de$export$4475b7e617eb123c, getExtendedYear as $93635573935797de$export$c36e0ecb2d4fa69d, GregorianCalendar as $93635573935797de$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 $63d4eafd4d826996$var$BUDDHIST_ERA_START = -543;
class $63d4eafd4d826996$export$42d20a78301dee44 extends (0, $93635573935797de$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let gregorianDate = super.fromJulianDay(jd);
let year = (0, $93635573935797de$export$c36e0ecb2d4fa69d)(gregorianDate.era, gregorianDate.year);
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, year - $63d4eafd4d826996$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
}
toJulianDay(date) {
return super.toJulianDay($63d4eafd4d826996$var$toGregorian(date));
}
getEras() {
return [
'BE'
];
}
getDaysInMonth(date) {
return super.getDaysInMonth($63d4eafd4d826996$var$toGregorian(date));
}
balanceDate() {}
constructor(...args){
super(...args), this.identifier = 'buddhist';
}
}
function $63d4eafd4d826996$var$toGregorian(date) {
let [era, year] = (0, $93635573935797de$export$4475b7e617eb123c)(date.year + $63d4eafd4d826996$var$BUDDHIST_ERA_START);
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$63d4eafd4d826996$export$42d20a78301dee44 as BuddhistCalendar};
//# sourceMappingURL=BuddhistCalendar.mjs.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,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAoB,CAAC;;QA1BhB,qBACL,aAAiC;;AA0BnC;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","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, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate(): void {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.mjs.map"}

View File

@@ -0,0 +1,174 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "EthiopicCalendar", function () { return $b6b43214f5cff964$export$26ba6eab5e20cd7d; });
$parcel$export(module.exports, "EthiopicAmeteAlemCalendar", function () { return $b6b43214f5cff964$export$d72e0c37005a4914; });
$parcel$export(module.exports, "CopticCalendar", function () { return $b6b43214f5cff964$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 $b6b43214f5cff964$var$ETHIOPIC_EPOCH = 1723856;
const $b6b43214f5cff964$var$COPTIC_EPOCH = 1824665;
// The delta between Amete Alem 1 and Amete Mihret 1
// AA 5501 = AM 1
const $b6b43214f5cff964$var$AMETE_MIHRET_DELTA = 5500;
function $b6b43214f5cff964$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 $b6b43214f5cff964$var$julianDayToCE(epoch, jd) {
let year = Math.floor(4 * (jd - epoch) / 1461);
let month = 1 + Math.floor((jd - $b6b43214f5cff964$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
let day = jd + 1 - $b6b43214f5cff964$var$ceToJulianDay(epoch, year, month, 1);
return [
year,
month,
day
];
}
function $b6b43214f5cff964$var$getLeapDay(year) {
return Math.floor(year % 4 / 3);
}
function $b6b43214f5cff964$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 $b6b43214f5cff964$var$getLeapDay(year) + 5;
}
class $b6b43214f5cff964$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b6b43214f5cff964$var$julianDayToCE($b6b43214f5cff964$var$ETHIOPIC_EPOCH, jd);
let era = 'AM';
if (year <= 0) {
era = 'AA';
year += $b6b43214f5cff964$var$AMETE_MIHRET_DELTA;
}
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'AA') year -= $b6b43214f5cff964$var$AMETE_MIHRET_DELTA;
return $b6b43214f5cff964$var$ceToJulianDay($b6b43214f5cff964$var$ETHIOPIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
return $b6b43214f5cff964$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear() {
return 13;
}
getDaysInYear(date) {
return 365 + $b6b43214f5cff964$var$getLeapDay(date.year);
}
getMaximumMonthsInYear() {
return 13;
}
getMaximumDaysInMonth() {
return 30;
}
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 $b6b43214f5cff964$export$d72e0c37005a4914 extends $b6b43214f5cff964$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b6b43214f5cff964$var$julianDayToCE($b6b43214f5cff964$var$ETHIOPIC_EPOCH, jd);
year += $b6b43214f5cff964$var$AMETE_MIHRET_DELTA;
return new (0, $c51b7e0106f45dea$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 $b6b43214f5cff964$export$fe6243cbe1a4b7c1 extends $b6b43214f5cff964$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $b6b43214f5cff964$var$julianDayToCE($b6b43214f5cff964$var$COPTIC_EPOCH, jd);
let era = 'CE';
if (year <= 0) {
era = 'BCE';
year = 1 - year;
}
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $b6b43214f5cff964$var$ceToJulianDay($b6b43214f5cff964$var$COPTIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $b6b43214f5cff964$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.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,167 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.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 $ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH = 1723856;
const $ca8f5bca40aaf2d4$var$COPTIC_EPOCH = 1824665;
// The delta between Amete Alem 1 and Amete Mihret 1
// AA 5501 = AM 1
const $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA = 5500;
function $ca8f5bca40aaf2d4$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 $ca8f5bca40aaf2d4$var$julianDayToCE(epoch, jd) {
let year = Math.floor(4 * (jd - epoch) / 1461);
let month = 1 + Math.floor((jd - $ca8f5bca40aaf2d4$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
let day = jd + 1 - $ca8f5bca40aaf2d4$var$ceToJulianDay(epoch, year, month, 1);
return [
year,
month,
day
];
}
function $ca8f5bca40aaf2d4$var$getLeapDay(year) {
return Math.floor(year % 4 / 3);
}
function $ca8f5bca40aaf2d4$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 $ca8f5bca40aaf2d4$var$getLeapDay(year) + 5;
}
class $ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $ca8f5bca40aaf2d4$var$julianDayToCE($ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH, jd);
let era = 'AM';
if (year <= 0) {
era = 'AA';
year += $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA;
}
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'AA') year -= $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA;
return $ca8f5bca40aaf2d4$var$ceToJulianDay($ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
return $ca8f5bca40aaf2d4$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear() {
return 13;
}
getDaysInYear(date) {
return 365 + $ca8f5bca40aaf2d4$var$getLeapDay(date.year);
}
getMaximumMonthsInYear() {
return 13;
}
getMaximumDaysInMonth() {
return 30;
}
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 $ca8f5bca40aaf2d4$export$d72e0c37005a4914 extends $ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $ca8f5bca40aaf2d4$var$julianDayToCE($ca8f5bca40aaf2d4$var$ETHIOPIC_EPOCH, jd);
year += $ca8f5bca40aaf2d4$var$AMETE_MIHRET_DELTA;
return new (0, $9a4e222e1bd2b190$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 $ca8f5bca40aaf2d4$export$fe6243cbe1a4b7c1 extends $ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $ca8f5bca40aaf2d4$var$julianDayToCE($ca8f5bca40aaf2d4$var$COPTIC_EPOCH, jd);
let era = 'CE';
if (year <= 0) {
era = 'BCE';
year = 1 - year;
}
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $ca8f5bca40aaf2d4$var$ceToJulianDay($ca8f5bca40aaf2d4$var$COPTIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $ca8f5bca40aaf2d4$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 {$ca8f5bca40aaf2d4$export$26ba6eab5e20cd7d as EthiopicCalendar, $ca8f5bca40aaf2d4$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $ca8f5bca40aaf2d4$export$fe6243cbe1a4b7c1 as CopticCalendar};
//# sourceMappingURL=EthiopicCalendar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,167 @@
import {CalendarDate as $2aaf608024c21ca1$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 $97cfca9efd59523d$var$ETHIOPIC_EPOCH = 1723856;
const $97cfca9efd59523d$var$COPTIC_EPOCH = 1824665;
// The delta between Amete Alem 1 and Amete Mihret 1
// AA 5501 = AM 1
const $97cfca9efd59523d$var$AMETE_MIHRET_DELTA = 5500;
function $97cfca9efd59523d$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 $97cfca9efd59523d$var$julianDayToCE(epoch, jd) {
let year = Math.floor(4 * (jd - epoch) / 1461);
let month = 1 + Math.floor((jd - $97cfca9efd59523d$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
let day = jd + 1 - $97cfca9efd59523d$var$ceToJulianDay(epoch, year, month, 1);
return [
year,
month,
day
];
}
function $97cfca9efd59523d$var$getLeapDay(year) {
return Math.floor(year % 4 / 3);
}
function $97cfca9efd59523d$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 $97cfca9efd59523d$var$getLeapDay(year) + 5;
}
class $97cfca9efd59523d$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $97cfca9efd59523d$var$julianDayToCE($97cfca9efd59523d$var$ETHIOPIC_EPOCH, jd);
let era = 'AM';
if (year <= 0) {
era = 'AA';
year += $97cfca9efd59523d$var$AMETE_MIHRET_DELTA;
}
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'AA') year -= $97cfca9efd59523d$var$AMETE_MIHRET_DELTA;
return $97cfca9efd59523d$var$ceToJulianDay($97cfca9efd59523d$var$ETHIOPIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
return $97cfca9efd59523d$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear() {
return 13;
}
getDaysInYear(date) {
return 365 + $97cfca9efd59523d$var$getLeapDay(date.year);
}
getMaximumMonthsInYear() {
return 13;
}
getMaximumDaysInMonth() {
return 30;
}
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 $97cfca9efd59523d$export$d72e0c37005a4914 extends $97cfca9efd59523d$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $97cfca9efd59523d$var$julianDayToCE($97cfca9efd59523d$var$ETHIOPIC_EPOCH, jd);
year += $97cfca9efd59523d$var$AMETE_MIHRET_DELTA;
return new (0, $2aaf608024c21ca1$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 $97cfca9efd59523d$export$fe6243cbe1a4b7c1 extends $97cfca9efd59523d$export$26ba6eab5e20cd7d {
fromJulianDay(jd) {
let [year, month, day] = $97cfca9efd59523d$var$julianDayToCE($97cfca9efd59523d$var$COPTIC_EPOCH, jd);
let era = 'CE';
if (year <= 0) {
era = 'BCE';
year = 1 - year;
}
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, era, year, month, day);
}
toJulianDay(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $97cfca9efd59523d$var$ceToJulianDay($97cfca9efd59523d$var$COPTIC_EPOCH, year, date.month, date.day);
}
getDaysInMonth(date) {
let year = date.year;
if (date.era === 'BCE') year = 1 - year;
return $97cfca9efd59523d$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 {$97cfca9efd59523d$export$26ba6eab5e20cd7d as EthiopicCalendar, $97cfca9efd59523d$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $97cfca9efd59523d$export$fe6243cbe1a4b7c1 as CopticCalendar};
//# sourceMappingURL=EthiopicCalendar.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,149 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $09f945753a699862$exports = require("../utils.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "gregorianToJulianDay", function () { return $05031860ba2f881f$export$f297eb839006d339; });
$parcel$export(module.exports, "getExtendedYear", function () { return $05031860ba2f881f$export$c36e0ecb2d4fa69d; });
$parcel$export(module.exports, "isLeapYear", function () { return $05031860ba2f881f$export$553d7fa8e3805fc0; });
$parcel$export(module.exports, "fromExtendedYear", function () { return $05031860ba2f881f$export$4475b7e617eb123c; });
$parcel$export(module.exports, "GregorianCalendar", function () { return $05031860ba2f881f$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 $05031860ba2f881f$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
function $05031860ba2f881f$export$f297eb839006d339(era, year, month, day) {
year = $05031860ba2f881f$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($05031860ba2f881f$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $05031860ba2f881f$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 $05031860ba2f881f$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $05031860ba2f881f$export$c36e0ecb2d4fa69d(era, year) {
return era === 'BC' ? 1 - year : year;
}
function $05031860ba2f881f$export$4475b7e617eb123c(year) {
let era = 'AD';
if (year <= 0) {
era = 'BC';
year = 1 - year;
}
return [
era,
year
];
}
const $05031860ba2f881f$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 $05031860ba2f881f$export$80ee6245ec4f29ec {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $05031860ba2f881f$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = (0, $09f945753a699862$exports.mod)(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = (0, $09f945753a699862$exports.mod)(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = (0, $09f945753a699862$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] = $05031860ba2f881f$export$4475b7e617eb123c(extendedYear);
let yearDay = jd0 - $05031860ba2f881f$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $05031860ba2f881f$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($05031860ba2f881f$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
let day = jd0 - $05031860ba2f881f$export$f297eb839006d339(era, year, month, 1) + 1;
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(era, year, month, day);
}
toJulianDay(date) {
return $05031860ba2f881f$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $05031860ba2f881f$var$daysInMonth[$05031860ba2f881f$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 $05031860ba2f881f$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
// 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.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,140 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {mod as $1797f75f9a4d3bd4$export$842a2cf37af977e1} from "../utils.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 $f25df78da1f6b40f$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
function $f25df78da1f6b40f$export$f297eb839006d339(era, year, month, day) {
year = $f25df78da1f6b40f$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($f25df78da1f6b40f$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $f25df78da1f6b40f$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 $f25df78da1f6b40f$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $f25df78da1f6b40f$export$c36e0ecb2d4fa69d(era, year) {
return era === 'BC' ? 1 - year : year;
}
function $f25df78da1f6b40f$export$4475b7e617eb123c(year) {
let era = 'AD';
if (year <= 0) {
era = 'BC';
year = 1 - year;
}
return [
era,
year
];
}
const $f25df78da1f6b40f$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 $f25df78da1f6b40f$export$80ee6245ec4f29ec {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $f25df78da1f6b40f$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = (0, $1797f75f9a4d3bd4$export$842a2cf37af977e1)(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = (0, $1797f75f9a4d3bd4$export$842a2cf37af977e1)(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = (0, $1797f75f9a4d3bd4$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] = $f25df78da1f6b40f$export$4475b7e617eb123c(extendedYear);
let yearDay = jd0 - $f25df78da1f6b40f$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $f25df78da1f6b40f$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($f25df78da1f6b40f$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
let day = jd0 - $f25df78da1f6b40f$export$f297eb839006d339(era, year, month, 1) + 1;
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(era, year, month, day);
}
toJulianDay(date) {
return $f25df78da1f6b40f$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $f25df78da1f6b40f$var$daysInMonth[$f25df78da1f6b40f$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 $f25df78da1f6b40f$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
// 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 {$f25df78da1f6b40f$export$f297eb839006d339 as gregorianToJulianDay, $f25df78da1f6b40f$export$c36e0ecb2d4fa69d as getExtendedYear, $f25df78da1f6b40f$export$553d7fa8e3805fc0 as isLeapYear, $f25df78da1f6b40f$export$4475b7e617eb123c as fromExtendedYear, $f25df78da1f6b40f$export$80ee6245ec4f29ec as GregorianCalendar};
//# sourceMappingURL=GregorianCalendar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,140 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {mod as $09ec6a572d60460f$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 $93635573935797de$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
function $93635573935797de$export$f297eb839006d339(era, year, month, day) {
year = $93635573935797de$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($93635573935797de$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $93635573935797de$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 $93635573935797de$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $93635573935797de$export$c36e0ecb2d4fa69d(era, year) {
return era === 'BC' ? 1 - year : year;
}
function $93635573935797de$export$4475b7e617eb123c(year) {
let era = 'AD';
if (year <= 0) {
era = 'BC';
year = 1 - year;
}
return [
era,
year
];
}
const $93635573935797de$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 $93635573935797de$export$80ee6245ec4f29ec {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $93635573935797de$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = (0, $09ec6a572d60460f$export$842a2cf37af977e1)(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = (0, $09ec6a572d60460f$export$842a2cf37af977e1)(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = (0, $09ec6a572d60460f$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] = $93635573935797de$export$4475b7e617eb123c(extendedYear);
let yearDay = jd0 - $93635573935797de$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $93635573935797de$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($93635573935797de$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
let day = jd0 - $93635573935797de$export$f297eb839006d339(era, year, month, 1) + 1;
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(era, year, month, day);
}
toJulianDay(date) {
return $93635573935797de$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $93635573935797de$var$daysInMonth[$93635573935797de$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 $93635573935797de$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
// 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 {$93635573935797de$export$f297eb839006d339 as gregorianToJulianDay, $93635573935797de$export$c36e0ecb2d4fa69d as getExtendedYear, $93635573935797de$export$553d7fa8e3805fc0 as isLeapYear, $93635573935797de$export$4475b7e617eb123c as fromExtendedYear, $93635573935797de$export$80ee6245ec4f29ec as GregorianCalendar};
//# sourceMappingURL=GregorianCalendar.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,155 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $09f945753a699862$exports = require("../utils.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "HebrewCalendar", function () { return $1aa25867248bd474$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 $1aa25867248bd474$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 $1aa25867248bd474$var$HOUR_PARTS = 1080;
const $1aa25867248bd474$var$DAY_PARTS = 24 * $1aa25867248bd474$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 $1aa25867248bd474$var$MONTH_DAYS = 29;
const $1aa25867248bd474$var$MONTH_FRACT = 12 * $1aa25867248bd474$var$HOUR_PARTS + 793;
const $1aa25867248bd474$var$MONTH_PARTS = $1aa25867248bd474$var$MONTH_DAYS * $1aa25867248bd474$var$DAY_PARTS + $1aa25867248bd474$var$MONTH_FRACT;
function $1aa25867248bd474$var$isLeapYear(year) {
return (0, $09f945753a699862$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 $1aa25867248bd474$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, $09f945753a699862$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 $1aa25867248bd474$var$hebrewDelay2(year) {
let last = $1aa25867248bd474$var$hebrewDelay1(year - 1);
let present = $1aa25867248bd474$var$hebrewDelay1(year);
let next = $1aa25867248bd474$var$hebrewDelay1(year + 1);
if (next - present === 356) return 2;
if (present - last === 382) return 1;
return 0;
}
function $1aa25867248bd474$var$startOfYear(year) {
return $1aa25867248bd474$var$hebrewDelay1(year) + $1aa25867248bd474$var$hebrewDelay2(year);
}
function $1aa25867248bd474$var$getDaysInYear(year) {
return $1aa25867248bd474$var$startOfYear(year + 1) - $1aa25867248bd474$var$startOfYear(year);
}
function $1aa25867248bd474$var$getYearType(year) {
let yearLength = $1aa25867248bd474$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 $1aa25867248bd474$var$getDaysInMonth(year, month) {
// Normalize month numbers from 1 - 13, even on non-leap years
if (month >= 6 && !$1aa25867248bd474$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 = $1aa25867248bd474$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 $1aa25867248bd474$var$isLeapYear(year) ? 30 : 0;
return 30;
}
class $1aa25867248bd474$export$ca405048b8fb5af {
fromJulianDay(jd) {
let d = jd - $1aa25867248bd474$var$HEBREW_EPOCH;
let m = d * $1aa25867248bd474$var$DAY_PARTS / $1aa25867248bd474$var$MONTH_PARTS; // Months (approx)
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
let ys = $1aa25867248bd474$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 = $1aa25867248bd474$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 += $1aa25867248bd474$var$getDaysInMonth(year, month);
month++;
}
month--;
monthStart -= $1aa25867248bd474$var$getDaysInMonth(year, month);
let day = dayOfYear - monthStart;
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, year, month, day);
}
toJulianDay(date) {
let jd = $1aa25867248bd474$var$startOfYear(date.year);
for(let month = 1; month < date.month; month++)jd += $1aa25867248bd474$var$getDaysInMonth(date.year, month);
return jd + date.day + $1aa25867248bd474$var$HEBREW_EPOCH;
}
getDaysInMonth(date) {
return $1aa25867248bd474$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear(date) {
return $1aa25867248bd474$var$isLeapYear(date.year) ? 13 : 12;
}
getDaysInYear(date) {
return $1aa25867248bd474$var$getDaysInYear(date.year);
}
getMaximumMonthsInYear() {
return 13;
}
getMaximumDaysInMonth() {
return 30;
}
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 ($1aa25867248bd474$var$isLeapYear(previousDate.year) && !$1aa25867248bd474$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
else if (!$1aa25867248bd474$var$isLeapYear(previousDate.year) && $1aa25867248bd474$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
}
}
constructor(){
this.identifier = 'hebrew';
}
}
//# sourceMappingURL=HebrewCalendar.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,150 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {mod as $1797f75f9a4d3bd4$export$842a2cf37af977e1} from "../utils.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 $f6eb69e87cd1adc1$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 $f6eb69e87cd1adc1$var$HOUR_PARTS = 1080;
const $f6eb69e87cd1adc1$var$DAY_PARTS = 24 * $f6eb69e87cd1adc1$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 $f6eb69e87cd1adc1$var$MONTH_DAYS = 29;
const $f6eb69e87cd1adc1$var$MONTH_FRACT = 12 * $f6eb69e87cd1adc1$var$HOUR_PARTS + 793;
const $f6eb69e87cd1adc1$var$MONTH_PARTS = $f6eb69e87cd1adc1$var$MONTH_DAYS * $f6eb69e87cd1adc1$var$DAY_PARTS + $f6eb69e87cd1adc1$var$MONTH_FRACT;
function $f6eb69e87cd1adc1$var$isLeapYear(year) {
return (0, $1797f75f9a4d3bd4$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 $f6eb69e87cd1adc1$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, $1797f75f9a4d3bd4$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 $f6eb69e87cd1adc1$var$hebrewDelay2(year) {
let last = $f6eb69e87cd1adc1$var$hebrewDelay1(year - 1);
let present = $f6eb69e87cd1adc1$var$hebrewDelay1(year);
let next = $f6eb69e87cd1adc1$var$hebrewDelay1(year + 1);
if (next - present === 356) return 2;
if (present - last === 382) return 1;
return 0;
}
function $f6eb69e87cd1adc1$var$startOfYear(year) {
return $f6eb69e87cd1adc1$var$hebrewDelay1(year) + $f6eb69e87cd1adc1$var$hebrewDelay2(year);
}
function $f6eb69e87cd1adc1$var$getDaysInYear(year) {
return $f6eb69e87cd1adc1$var$startOfYear(year + 1) - $f6eb69e87cd1adc1$var$startOfYear(year);
}
function $f6eb69e87cd1adc1$var$getYearType(year) {
let yearLength = $f6eb69e87cd1adc1$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 $f6eb69e87cd1adc1$var$getDaysInMonth(year, month) {
// Normalize month numbers from 1 - 13, even on non-leap years
if (month >= 6 && !$f6eb69e87cd1adc1$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 = $f6eb69e87cd1adc1$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 $f6eb69e87cd1adc1$var$isLeapYear(year) ? 30 : 0;
return 30;
}
class $f6eb69e87cd1adc1$export$ca405048b8fb5af {
fromJulianDay(jd) {
let d = jd - $f6eb69e87cd1adc1$var$HEBREW_EPOCH;
let m = d * $f6eb69e87cd1adc1$var$DAY_PARTS / $f6eb69e87cd1adc1$var$MONTH_PARTS; // Months (approx)
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
let ys = $f6eb69e87cd1adc1$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 = $f6eb69e87cd1adc1$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 += $f6eb69e87cd1adc1$var$getDaysInMonth(year, month);
month++;
}
month--;
monthStart -= $f6eb69e87cd1adc1$var$getDaysInMonth(year, month);
let day = dayOfYear - monthStart;
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, year, month, day);
}
toJulianDay(date) {
let jd = $f6eb69e87cd1adc1$var$startOfYear(date.year);
for(let month = 1; month < date.month; month++)jd += $f6eb69e87cd1adc1$var$getDaysInMonth(date.year, month);
return jd + date.day + $f6eb69e87cd1adc1$var$HEBREW_EPOCH;
}
getDaysInMonth(date) {
return $f6eb69e87cd1adc1$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear(date) {
return $f6eb69e87cd1adc1$var$isLeapYear(date.year) ? 13 : 12;
}
getDaysInYear(date) {
return $f6eb69e87cd1adc1$var$getDaysInYear(date.year);
}
getMaximumMonthsInYear() {
return 13;
}
getMaximumDaysInMonth() {
return 30;
}
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 ($f6eb69e87cd1adc1$var$isLeapYear(previousDate.year) && !$f6eb69e87cd1adc1$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
else if (!$f6eb69e87cd1adc1$var$isLeapYear(previousDate.year) && $f6eb69e87cd1adc1$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
}
}
constructor(){
this.identifier = 'hebrew';
}
}
export {$f6eb69e87cd1adc1$export$ca405048b8fb5af as HebrewCalendar};
//# sourceMappingURL=HebrewCalendar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,150 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {mod as $09ec6a572d60460f$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 $f39495b96f9dbac6$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 $f39495b96f9dbac6$var$HOUR_PARTS = 1080;
const $f39495b96f9dbac6$var$DAY_PARTS = 24 * $f39495b96f9dbac6$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 $f39495b96f9dbac6$var$MONTH_DAYS = 29;
const $f39495b96f9dbac6$var$MONTH_FRACT = 12 * $f39495b96f9dbac6$var$HOUR_PARTS + 793;
const $f39495b96f9dbac6$var$MONTH_PARTS = $f39495b96f9dbac6$var$MONTH_DAYS * $f39495b96f9dbac6$var$DAY_PARTS + $f39495b96f9dbac6$var$MONTH_FRACT;
function $f39495b96f9dbac6$var$isLeapYear(year) {
return (0, $09ec6a572d60460f$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 $f39495b96f9dbac6$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, $09ec6a572d60460f$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 $f39495b96f9dbac6$var$hebrewDelay2(year) {
let last = $f39495b96f9dbac6$var$hebrewDelay1(year - 1);
let present = $f39495b96f9dbac6$var$hebrewDelay1(year);
let next = $f39495b96f9dbac6$var$hebrewDelay1(year + 1);
if (next - present === 356) return 2;
if (present - last === 382) return 1;
return 0;
}
function $f39495b96f9dbac6$var$startOfYear(year) {
return $f39495b96f9dbac6$var$hebrewDelay1(year) + $f39495b96f9dbac6$var$hebrewDelay2(year);
}
function $f39495b96f9dbac6$var$getDaysInYear(year) {
return $f39495b96f9dbac6$var$startOfYear(year + 1) - $f39495b96f9dbac6$var$startOfYear(year);
}
function $f39495b96f9dbac6$var$getYearType(year) {
let yearLength = $f39495b96f9dbac6$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 $f39495b96f9dbac6$var$getDaysInMonth(year, month) {
// Normalize month numbers from 1 - 13, even on non-leap years
if (month >= 6 && !$f39495b96f9dbac6$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 = $f39495b96f9dbac6$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 $f39495b96f9dbac6$var$isLeapYear(year) ? 30 : 0;
return 30;
}
class $f39495b96f9dbac6$export$ca405048b8fb5af {
fromJulianDay(jd) {
let d = jd - $f39495b96f9dbac6$var$HEBREW_EPOCH;
let m = d * $f39495b96f9dbac6$var$DAY_PARTS / $f39495b96f9dbac6$var$MONTH_PARTS; // Months (approx)
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
let ys = $f39495b96f9dbac6$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 = $f39495b96f9dbac6$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 += $f39495b96f9dbac6$var$getDaysInMonth(year, month);
month++;
}
month--;
monthStart -= $f39495b96f9dbac6$var$getDaysInMonth(year, month);
let day = dayOfYear - monthStart;
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, year, month, day);
}
toJulianDay(date) {
let jd = $f39495b96f9dbac6$var$startOfYear(date.year);
for(let month = 1; month < date.month; month++)jd += $f39495b96f9dbac6$var$getDaysInMonth(date.year, month);
return jd + date.day + $f39495b96f9dbac6$var$HEBREW_EPOCH;
}
getDaysInMonth(date) {
return $f39495b96f9dbac6$var$getDaysInMonth(date.year, date.month);
}
getMonthsInYear(date) {
return $f39495b96f9dbac6$var$isLeapYear(date.year) ? 13 : 12;
}
getDaysInYear(date) {
return $f39495b96f9dbac6$var$getDaysInYear(date.year);
}
getMaximumMonthsInYear() {
return 13;
}
getMaximumDaysInMonth() {
return 30;
}
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 ($f39495b96f9dbac6$var$isLeapYear(previousDate.year) && !$f39495b96f9dbac6$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
else if (!$f39495b96f9dbac6$var$isLeapYear(previousDate.year) && $f39495b96f9dbac6$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
}
}
constructor(){
this.identifier = 'hebrew';
}
}
export {$f39495b96f9dbac6$export$ca405048b8fb5af as HebrewCalendar};
//# sourceMappingURL=HebrewCalendar.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,106 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $05031860ba2f881f$exports = require("./GregorianCalendar.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "IndianCalendar", function () { return $9dc8610ad30fbfe5$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 $9dc8610ad30fbfe5$var$INDIAN_ERA_START = 78;
// The Indian year starts 80 days later than the Gregorian year.
const $9dc8610ad30fbfe5$var$INDIAN_YEAR_START = 80;
class $9dc8610ad30fbfe5$export$39f31c639fa15726 extends (0, $05031860ba2f881f$exports.GregorianCalendar) {
fromJulianDay(jd) {
// Gregorian date for Julian day
let date = super.fromJulianDay(jd);
// Year in Saka era
let indianYear = date.year - $9dc8610ad30fbfe5$var$INDIAN_ERA_START;
// Day number in Gregorian year (starting from 0)
let yDay = jd - (0, $05031860ba2f881f$exports.gregorianToJulianDay)(date.era, date.year, 1, 1);
let leapMonth;
if (yDay < $9dc8610ad30fbfe5$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, $05031860ba2f881f$exports.isLeapYear)(date.year - 1) ? 31 : 30;
yDay += leapMonth + 155 + 90 + 10;
} else {
// Days in leapMonth this year
leapMonth = (0, $05031860ba2f881f$exports.isLeapYear)(date.year) ? 31 : 30;
yDay -= $9dc8610ad30fbfe5$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, $c51b7e0106f45dea$exports.CalendarDate)(this, indianYear, indianMonth, indianDay);
}
toJulianDay(date) {
let extendedYear = date.year + $9dc8610ad30fbfe5$var$INDIAN_ERA_START;
let [era, year] = (0, $05031860ba2f881f$exports.fromExtendedYear)(extendedYear);
let leapMonth;
let jd;
if ((0, $05031860ba2f881f$exports.isLeapYear)(year)) {
leapMonth = 31;
jd = (0, $05031860ba2f881f$exports.gregorianToJulianDay)(era, year, 3, 21);
} else {
leapMonth = 30;
jd = (0, $05031860ba2f881f$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, $05031860ba2f881f$exports.isLeapYear)(date.year + $9dc8610ad30fbfe5$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.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,101 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {fromExtendedYear as $f25df78da1f6b40f$export$4475b7e617eb123c, GregorianCalendar as $f25df78da1f6b40f$export$80ee6245ec4f29ec, gregorianToJulianDay as $f25df78da1f6b40f$export$f297eb839006d339, isLeapYear as $f25df78da1f6b40f$export$553d7fa8e3805fc0} from "./GregorianCalendar.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 $a07127433beb6bf1$var$INDIAN_ERA_START = 78;
// The Indian year starts 80 days later than the Gregorian year.
const $a07127433beb6bf1$var$INDIAN_YEAR_START = 80;
class $a07127433beb6bf1$export$39f31c639fa15726 extends (0, $f25df78da1f6b40f$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
// Gregorian date for Julian day
let date = super.fromJulianDay(jd);
// Year in Saka era
let indianYear = date.year - $a07127433beb6bf1$var$INDIAN_ERA_START;
// Day number in Gregorian year (starting from 0)
let yDay = jd - (0, $f25df78da1f6b40f$export$f297eb839006d339)(date.era, date.year, 1, 1);
let leapMonth;
if (yDay < $a07127433beb6bf1$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, $f25df78da1f6b40f$export$553d7fa8e3805fc0)(date.year - 1) ? 31 : 30;
yDay += leapMonth + 155 + 90 + 10;
} else {
// Days in leapMonth this year
leapMonth = (0, $f25df78da1f6b40f$export$553d7fa8e3805fc0)(date.year) ? 31 : 30;
yDay -= $a07127433beb6bf1$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, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, indianYear, indianMonth, indianDay);
}
toJulianDay(date) {
let extendedYear = date.year + $a07127433beb6bf1$var$INDIAN_ERA_START;
let [era, year] = (0, $f25df78da1f6b40f$export$4475b7e617eb123c)(extendedYear);
let leapMonth;
let jd;
if ((0, $f25df78da1f6b40f$export$553d7fa8e3805fc0)(year)) {
leapMonth = 31;
jd = (0, $f25df78da1f6b40f$export$f297eb839006d339)(era, year, 3, 21);
} else {
leapMonth = 30;
jd = (0, $f25df78da1f6b40f$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, $f25df78da1f6b40f$export$553d7fa8e3805fc0)(date.year + $a07127433beb6bf1$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 {$a07127433beb6bf1$export$39f31c639fa15726 as IndianCalendar};
//# sourceMappingURL=IndianCalendar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,101 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {fromExtendedYear as $93635573935797de$export$4475b7e617eb123c, GregorianCalendar as $93635573935797de$export$80ee6245ec4f29ec, gregorianToJulianDay as $93635573935797de$export$f297eb839006d339, isLeapYear as $93635573935797de$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 $11fa67a177e45470$var$INDIAN_ERA_START = 78;
// The Indian year starts 80 days later than the Gregorian year.
const $11fa67a177e45470$var$INDIAN_YEAR_START = 80;
class $11fa67a177e45470$export$39f31c639fa15726 extends (0, $93635573935797de$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
// Gregorian date for Julian day
let date = super.fromJulianDay(jd);
// Year in Saka era
let indianYear = date.year - $11fa67a177e45470$var$INDIAN_ERA_START;
// Day number in Gregorian year (starting from 0)
let yDay = jd - (0, $93635573935797de$export$f297eb839006d339)(date.era, date.year, 1, 1);
let leapMonth;
if (yDay < $11fa67a177e45470$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, $93635573935797de$export$553d7fa8e3805fc0)(date.year - 1) ? 31 : 30;
yDay += leapMonth + 155 + 90 + 10;
} else {
// Days in leapMonth this year
leapMonth = (0, $93635573935797de$export$553d7fa8e3805fc0)(date.year) ? 31 : 30;
yDay -= $11fa67a177e45470$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, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, indianYear, indianMonth, indianDay);
}
toJulianDay(date) {
let extendedYear = date.year + $11fa67a177e45470$var$INDIAN_ERA_START;
let [era, year] = (0, $93635573935797de$export$4475b7e617eb123c)(extendedYear);
let leapMonth;
let jd;
if ((0, $93635573935797de$export$553d7fa8e3805fc0)(year)) {
leapMonth = 31;
jd = (0, $93635573935797de$export$f297eb839006d339)(era, year, 3, 21);
} else {
leapMonth = 30;
jd = (0, $93635573935797de$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, $93635573935797de$export$553d7fa8e3805fc0)(date.year + $11fa67a177e45470$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 {$11fa67a177e45470$export$39f31c639fa15726 as IndianCalendar};
//# sourceMappingURL=IndianCalendar.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,168 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "IslamicCivilCalendar", function () { return $fbcc6aba7cd7f47c$export$2066795aadd37bfc; });
$parcel$export(module.exports, "IslamicTabularCalendar", function () { return $fbcc6aba7cd7f47c$export$37f0887f2f9d22f7; });
$parcel$export(module.exports, "IslamicUmalquraCalendar", function () { return $fbcc6aba7cd7f47c$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 $fbcc6aba7cd7f47c$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
const $fbcc6aba7cd7f47c$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
const $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START = 1300;
const $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END = 1600;
const $fbcc6aba7cd7f47c$var$UMALQURA_START_DAYS = 460322;
function $fbcc6aba7cd7f47c$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 $fbcc6aba7cd7f47c$var$julianDayToIslamic(calendar, epoch, jd) {
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
let month = Math.min(12, Math.ceil((jd - (29 + $fbcc6aba7cd7f47c$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
let day = jd - $fbcc6aba7cd7f47c$var$islamicToJulianDay(epoch, year, month, 1) + 1;
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(calendar, year, month, day);
}
function $fbcc6aba7cd7f47c$var$isLeapYear(year) {
return (14 + 11 * year) % 30 < 11;
}
class $fbcc6aba7cd7f47c$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $fbcc6aba7cd7f47c$var$julianDayToIslamic(this, $fbcc6aba7cd7f47c$var$CIVIL_EPOC, jd);
}
toJulianDay(date) {
return $fbcc6aba7cd7f47c$var$islamicToJulianDay($fbcc6aba7cd7f47c$var$CIVIL_EPOC, date.year, date.month, date.day);
}
getDaysInMonth(date) {
let length = 29 + date.month % 2;
if (date.month === 12 && $fbcc6aba7cd7f47c$var$isLeapYear(date.year)) length++;
return length;
}
getMonthsInYear() {
return 12;
}
getDaysInYear(date) {
return $fbcc6aba7cd7f47c$var$isLeapYear(date.year) ? 355 : 354;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 30;
}
getYearsInEra() {
// 9999 gregorian
return 9665;
}
getEras() {
return [
'AH'
];
}
constructor(){
this.identifier = 'islamic-civil';
}
}
class $fbcc6aba7cd7f47c$export$37f0887f2f9d22f7 extends $fbcc6aba7cd7f47c$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $fbcc6aba7cd7f47c$var$julianDayToIslamic(this, $fbcc6aba7cd7f47c$var$ASTRONOMICAL_EPOC, jd);
}
toJulianDay(date) {
return $fbcc6aba7cd7f47c$var$islamicToJulianDay($fbcc6aba7cd7f47c$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
}
constructor(...args){
super(...args), this.identifier = 'islamic-tbla';
}
}
// Generated by scripts/generate-umalqura.js
const $fbcc6aba7cd7f47c$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
let $fbcc6aba7cd7f47c$var$UMALQURA_MONTHLENGTH;
let $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE;
function $fbcc6aba7cd7f47c$var$umalquraYearStart(year) {
return $fbcc6aba7cd7f47c$var$UMALQURA_START_DAYS + $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE[year - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START];
}
function $fbcc6aba7cd7f47c$var$umalquraMonthLength(year, month) {
let idx = year - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START;
let mask = 0x01 << 11 - (month - 1);
if (($fbcc6aba7cd7f47c$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
else return 30;
}
function $fbcc6aba7cd7f47c$var$umalquraMonthStart(year, month) {
let day = $fbcc6aba7cd7f47c$var$umalquraYearStart(year);
for(let i = 1; i < month; i++)day += $fbcc6aba7cd7f47c$var$umalquraMonthLength(year, i);
return day;
}
function $fbcc6aba7cd7f47c$var$umalquraYearLength(year) {
return $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE[year + 1 - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START] - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE[year - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START];
}
class $fbcc6aba7cd7f47c$export$5baab4758c231076 extends $fbcc6aba7cd7f47c$export$2066795aadd37bfc {
constructor(){
super(), this.identifier = 'islamic-umalqura';
if (!$fbcc6aba7cd7f47c$var$UMALQURA_MONTHLENGTH) $fbcc6aba7cd7f47c$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($fbcc6aba7cd7f47c$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
if (!$fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE) {
$fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START + 1);
let yearStart = 0;
for(let year = $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START; year <= $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END; year++){
$fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START_TABLE[year - $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START] = yearStart;
for(let i = 1; i <= 12; i++)yearStart += $fbcc6aba7cd7f47c$var$umalquraMonthLength(year, i);
}
}
}
fromJulianDay(jd) {
let days = jd - $fbcc6aba7cd7f47c$var$CIVIL_EPOC;
let startDays = $fbcc6aba7cd7f47c$var$umalquraYearStart($fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START);
let endDays = $fbcc6aba7cd7f47c$var$umalquraYearStart($fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END);
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
else {
let y = $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START - 1;
let m = 1;
let d = 1;
while(d > 0){
y++;
d = days - $fbcc6aba7cd7f47c$var$umalquraYearStart(y) + 1;
let yearLength = $fbcc6aba7cd7f47c$var$umalquraYearLength(y);
if (d === yearLength) {
m = 12;
break;
} else if (d < yearLength) {
let monthLength = $fbcc6aba7cd7f47c$var$umalquraMonthLength(y, m);
m = 1;
while(d > monthLength){
d -= monthLength;
m++;
monthLength = $fbcc6aba7cd7f47c$var$umalquraMonthLength(y, m);
}
break;
}
}
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, y, m, days - $fbcc6aba7cd7f47c$var$umalquraMonthStart(y, m) + 1);
}
}
toJulianDay(date) {
if (date.year < $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START || date.year > $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
return $fbcc6aba7cd7f47c$var$CIVIL_EPOC + $fbcc6aba7cd7f47c$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
}
getDaysInMonth(date) {
if (date.year < $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START || date.year > $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
return $fbcc6aba7cd7f47c$var$umalquraMonthLength(date.year, date.month);
}
getDaysInYear(date) {
if (date.year < $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_START || date.year > $fbcc6aba7cd7f47c$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
return $fbcc6aba7cd7f47c$var$umalquraYearLength(date.year);
}
}
//# sourceMappingURL=IslamicCalendar.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,161 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.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 $a938ddf4fc940323$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
const $a938ddf4fc940323$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
const $a938ddf4fc940323$var$UMALQURA_YEAR_START = 1300;
const $a938ddf4fc940323$var$UMALQURA_YEAR_END = 1600;
const $a938ddf4fc940323$var$UMALQURA_START_DAYS = 460322;
function $a938ddf4fc940323$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 $a938ddf4fc940323$var$julianDayToIslamic(calendar, epoch, jd) {
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
let month = Math.min(12, Math.ceil((jd - (29 + $a938ddf4fc940323$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
let day = jd - $a938ddf4fc940323$var$islamicToJulianDay(epoch, year, month, 1) + 1;
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(calendar, year, month, day);
}
function $a938ddf4fc940323$var$isLeapYear(year) {
return (14 + 11 * year) % 30 < 11;
}
class $a938ddf4fc940323$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $a938ddf4fc940323$var$julianDayToIslamic(this, $a938ddf4fc940323$var$CIVIL_EPOC, jd);
}
toJulianDay(date) {
return $a938ddf4fc940323$var$islamicToJulianDay($a938ddf4fc940323$var$CIVIL_EPOC, date.year, date.month, date.day);
}
getDaysInMonth(date) {
let length = 29 + date.month % 2;
if (date.month === 12 && $a938ddf4fc940323$var$isLeapYear(date.year)) length++;
return length;
}
getMonthsInYear() {
return 12;
}
getDaysInYear(date) {
return $a938ddf4fc940323$var$isLeapYear(date.year) ? 355 : 354;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 30;
}
getYearsInEra() {
// 9999 gregorian
return 9665;
}
getEras() {
return [
'AH'
];
}
constructor(){
this.identifier = 'islamic-civil';
}
}
class $a938ddf4fc940323$export$37f0887f2f9d22f7 extends $a938ddf4fc940323$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $a938ddf4fc940323$var$julianDayToIslamic(this, $a938ddf4fc940323$var$ASTRONOMICAL_EPOC, jd);
}
toJulianDay(date) {
return $a938ddf4fc940323$var$islamicToJulianDay($a938ddf4fc940323$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
}
constructor(...args){
super(...args), this.identifier = 'islamic-tbla';
}
}
// Generated by scripts/generate-umalqura.js
const $a938ddf4fc940323$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
let $a938ddf4fc940323$var$UMALQURA_MONTHLENGTH;
let $a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE;
function $a938ddf4fc940323$var$umalquraYearStart(year) {
return $a938ddf4fc940323$var$UMALQURA_START_DAYS + $a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE[year - $a938ddf4fc940323$var$UMALQURA_YEAR_START];
}
function $a938ddf4fc940323$var$umalquraMonthLength(year, month) {
let idx = year - $a938ddf4fc940323$var$UMALQURA_YEAR_START;
let mask = 0x01 << 11 - (month - 1);
if (($a938ddf4fc940323$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
else return 30;
}
function $a938ddf4fc940323$var$umalquraMonthStart(year, month) {
let day = $a938ddf4fc940323$var$umalquraYearStart(year);
for(let i = 1; i < month; i++)day += $a938ddf4fc940323$var$umalquraMonthLength(year, i);
return day;
}
function $a938ddf4fc940323$var$umalquraYearLength(year) {
return $a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE[year + 1 - $a938ddf4fc940323$var$UMALQURA_YEAR_START] - $a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE[year - $a938ddf4fc940323$var$UMALQURA_YEAR_START];
}
class $a938ddf4fc940323$export$5baab4758c231076 extends $a938ddf4fc940323$export$2066795aadd37bfc {
fromJulianDay(jd) {
let days = jd - $a938ddf4fc940323$var$CIVIL_EPOC;
let startDays = $a938ddf4fc940323$var$umalquraYearStart($a938ddf4fc940323$var$UMALQURA_YEAR_START);
let endDays = $a938ddf4fc940323$var$umalquraYearStart($a938ddf4fc940323$var$UMALQURA_YEAR_END);
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
else {
let y = $a938ddf4fc940323$var$UMALQURA_YEAR_START - 1;
let m = 1;
let d = 1;
while(d > 0){
y++;
d = days - $a938ddf4fc940323$var$umalquraYearStart(y) + 1;
let yearLength = $a938ddf4fc940323$var$umalquraYearLength(y);
if (d === yearLength) {
m = 12;
break;
} else if (d < yearLength) {
let monthLength = $a938ddf4fc940323$var$umalquraMonthLength(y, m);
m = 1;
while(d > monthLength){
d -= monthLength;
m++;
monthLength = $a938ddf4fc940323$var$umalquraMonthLength(y, m);
}
break;
}
}
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, y, m, days - $a938ddf4fc940323$var$umalquraMonthStart(y, m) + 1);
}
}
toJulianDay(date) {
if (date.year < $a938ddf4fc940323$var$UMALQURA_YEAR_START || date.year > $a938ddf4fc940323$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
return $a938ddf4fc940323$var$CIVIL_EPOC + $a938ddf4fc940323$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
}
getDaysInMonth(date) {
if (date.year < $a938ddf4fc940323$var$UMALQURA_YEAR_START || date.year > $a938ddf4fc940323$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
return $a938ddf4fc940323$var$umalquraMonthLength(date.year, date.month);
}
getDaysInYear(date) {
if (date.year < $a938ddf4fc940323$var$UMALQURA_YEAR_START || date.year > $a938ddf4fc940323$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
return $a938ddf4fc940323$var$umalquraYearLength(date.year);
}
constructor(){
super(), this.identifier = 'islamic-umalqura';
if (!$a938ddf4fc940323$var$UMALQURA_MONTHLENGTH) $a938ddf4fc940323$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($a938ddf4fc940323$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
if (!$a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE) {
$a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($a938ddf4fc940323$var$UMALQURA_YEAR_END - $a938ddf4fc940323$var$UMALQURA_YEAR_START + 1);
let yearStart = 0;
for(let year = $a938ddf4fc940323$var$UMALQURA_YEAR_START; year <= $a938ddf4fc940323$var$UMALQURA_YEAR_END; year++){
$a938ddf4fc940323$var$UMALQURA_YEAR_START_TABLE[year - $a938ddf4fc940323$var$UMALQURA_YEAR_START] = yearStart;
for(let i = 1; i <= 12; i++)yearStart += $a938ddf4fc940323$var$umalquraMonthLength(year, i);
}
}
}
}
export {$a938ddf4fc940323$export$2066795aadd37bfc as IslamicCivilCalendar, $a938ddf4fc940323$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $a938ddf4fc940323$export$5baab4758c231076 as IslamicUmalquraCalendar};
//# sourceMappingURL=IslamicCalendar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,161 @@
import {CalendarDate as $2aaf608024c21ca1$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 $fd4f9bc1ba0e49a8$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
const $fd4f9bc1ba0e49a8$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
const $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START = 1300;
const $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END = 1600;
const $fd4f9bc1ba0e49a8$var$UMALQURA_START_DAYS = 460322;
function $fd4f9bc1ba0e49a8$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 $fd4f9bc1ba0e49a8$var$julianDayToIslamic(calendar, epoch, jd) {
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
let month = Math.min(12, Math.ceil((jd - (29 + $fd4f9bc1ba0e49a8$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
let day = jd - $fd4f9bc1ba0e49a8$var$islamicToJulianDay(epoch, year, month, 1) + 1;
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(calendar, year, month, day);
}
function $fd4f9bc1ba0e49a8$var$isLeapYear(year) {
return (14 + 11 * year) % 30 < 11;
}
class $fd4f9bc1ba0e49a8$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $fd4f9bc1ba0e49a8$var$julianDayToIslamic(this, $fd4f9bc1ba0e49a8$var$CIVIL_EPOC, jd);
}
toJulianDay(date) {
return $fd4f9bc1ba0e49a8$var$islamicToJulianDay($fd4f9bc1ba0e49a8$var$CIVIL_EPOC, date.year, date.month, date.day);
}
getDaysInMonth(date) {
let length = 29 + date.month % 2;
if (date.month === 12 && $fd4f9bc1ba0e49a8$var$isLeapYear(date.year)) length++;
return length;
}
getMonthsInYear() {
return 12;
}
getDaysInYear(date) {
return $fd4f9bc1ba0e49a8$var$isLeapYear(date.year) ? 355 : 354;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 30;
}
getYearsInEra() {
// 9999 gregorian
return 9665;
}
getEras() {
return [
'AH'
];
}
constructor(){
this.identifier = 'islamic-civil';
}
}
class $fd4f9bc1ba0e49a8$export$37f0887f2f9d22f7 extends $fd4f9bc1ba0e49a8$export$2066795aadd37bfc {
fromJulianDay(jd) {
return $fd4f9bc1ba0e49a8$var$julianDayToIslamic(this, $fd4f9bc1ba0e49a8$var$ASTRONOMICAL_EPOC, jd);
}
toJulianDay(date) {
return $fd4f9bc1ba0e49a8$var$islamicToJulianDay($fd4f9bc1ba0e49a8$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
}
constructor(...args){
super(...args), this.identifier = 'islamic-tbla';
}
}
// Generated by scripts/generate-umalqura.js
const $fd4f9bc1ba0e49a8$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
let $fd4f9bc1ba0e49a8$var$UMALQURA_MONTHLENGTH;
let $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE;
function $fd4f9bc1ba0e49a8$var$umalquraYearStart(year) {
return $fd4f9bc1ba0e49a8$var$UMALQURA_START_DAYS + $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE[year - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START];
}
function $fd4f9bc1ba0e49a8$var$umalquraMonthLength(year, month) {
let idx = year - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START;
let mask = 0x01 << 11 - (month - 1);
if (($fd4f9bc1ba0e49a8$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
else return 30;
}
function $fd4f9bc1ba0e49a8$var$umalquraMonthStart(year, month) {
let day = $fd4f9bc1ba0e49a8$var$umalquraYearStart(year);
for(let i = 1; i < month; i++)day += $fd4f9bc1ba0e49a8$var$umalquraMonthLength(year, i);
return day;
}
function $fd4f9bc1ba0e49a8$var$umalquraYearLength(year) {
return $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE[year + 1 - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START] - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE[year - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START];
}
class $fd4f9bc1ba0e49a8$export$5baab4758c231076 extends $fd4f9bc1ba0e49a8$export$2066795aadd37bfc {
constructor(){
super(), this.identifier = 'islamic-umalqura';
if (!$fd4f9bc1ba0e49a8$var$UMALQURA_MONTHLENGTH) $fd4f9bc1ba0e49a8$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($fd4f9bc1ba0e49a8$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
if (!$fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE) {
$fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START + 1);
let yearStart = 0;
for(let year = $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START; year <= $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END; year++){
$fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START_TABLE[year - $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START] = yearStart;
for(let i = 1; i <= 12; i++)yearStart += $fd4f9bc1ba0e49a8$var$umalquraMonthLength(year, i);
}
}
}
fromJulianDay(jd) {
let days = jd - $fd4f9bc1ba0e49a8$var$CIVIL_EPOC;
let startDays = $fd4f9bc1ba0e49a8$var$umalquraYearStart($fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START);
let endDays = $fd4f9bc1ba0e49a8$var$umalquraYearStart($fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END);
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
else {
let y = $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START - 1;
let m = 1;
let d = 1;
while(d > 0){
y++;
d = days - $fd4f9bc1ba0e49a8$var$umalquraYearStart(y) + 1;
let yearLength = $fd4f9bc1ba0e49a8$var$umalquraYearLength(y);
if (d === yearLength) {
m = 12;
break;
} else if (d < yearLength) {
let monthLength = $fd4f9bc1ba0e49a8$var$umalquraMonthLength(y, m);
m = 1;
while(d > monthLength){
d -= monthLength;
m++;
monthLength = $fd4f9bc1ba0e49a8$var$umalquraMonthLength(y, m);
}
break;
}
}
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, y, m, days - $fd4f9bc1ba0e49a8$var$umalquraMonthStart(y, m) + 1);
}
}
toJulianDay(date) {
if (date.year < $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START || date.year > $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
return $fd4f9bc1ba0e49a8$var$CIVIL_EPOC + $fd4f9bc1ba0e49a8$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
}
getDaysInMonth(date) {
if (date.year < $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START || date.year > $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
return $fd4f9bc1ba0e49a8$var$umalquraMonthLength(date.year, date.month);
}
getDaysInYear(date) {
if (date.year < $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_START || date.year > $fd4f9bc1ba0e49a8$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
return $fd4f9bc1ba0e49a8$var$umalquraYearLength(date.year);
}
}
export {$fd4f9bc1ba0e49a8$export$2066795aadd37bfc as IslamicCivilCalendar, $fd4f9bc1ba0e49a8$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $fd4f9bc1ba0e49a8$export$5baab4758c231076 as IslamicUmalquraCalendar};
//# sourceMappingURL=IslamicCalendar.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,179 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $05031860ba2f881f$exports = require("./GregorianCalendar.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "JapaneseCalendar", function () { return $a90e2192fa9a0f41$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 $a90e2192fa9a0f41$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $a90e2192fa9a0f41$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $a90e2192fa9a0f41$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $a90e2192fa9a0f41$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $a90e2192fa9a0f41$var$findEraFromGregorianDate(date) {
const idx = $a90e2192fa9a0f41$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 $a90e2192fa9a0f41$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $a90e2192fa9a0f41$var$toGregorian(date) {
let eraAddend = $a90e2192fa9a0f41$var$ERA_ADDENDS[$a90e2192fa9a0f41$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(date.year + eraAddend, date.month, date.day);
}
class $a90e2192fa9a0f41$export$b746ab2b60cdffbf extends (0, $05031860ba2f881f$exports.GregorianCalendar) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $a90e2192fa9a0f41$var$findEraFromGregorianDate(date);
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, $a90e2192fa9a0f41$var$ERA_NAMES[era], date.year - $a90e2192fa9a0f41$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($a90e2192fa9a0f41$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $a90e2192fa9a0f41$var$toGregorian(date);
let era = $a90e2192fa9a0f41$var$findEraFromGregorianDate(gregorianDate);
if ($a90e2192fa9a0f41$var$ERA_NAMES[era] !== date.era) {
date.era = $a90e2192fa9a0f41$var$ERA_NAMES[era];
date.year = gregorianDate.year - $a90e2192fa9a0f41$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $a90e2192fa9a0f41$var$ERA_NAMES.indexOf(date.era);
let end = $a90e2192fa9a0f41$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 - $a90e2192fa9a0f41$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] = $a90e2192fa9a0f41$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 $a90e2192fa9a0f41$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 = $a90e2192fa9a0f41$var$ERA_NAMES.indexOf(date.era);
let cur = $a90e2192fa9a0f41$var$ERA_START_DATES[era];
let next = $a90e2192fa9a0f41$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($a90e2192fa9a0f41$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $a90e2192fa9a0f41$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $a90e2192fa9a0f41$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args), this.identifier = 'japanese';
}
}
function $a90e2192fa9a0f41$var$getMinimums(date) {
if (date.year === 1) {
let idx = $a90e2192fa9a0f41$var$ERA_NAMES.indexOf(date.era);
return $a90e2192fa9a0f41$var$ERA_START_DATES[idx];
}
}
//# sourceMappingURL=JapaneseCalendar.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,174 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {GregorianCalendar as $f25df78da1f6b40f$export$80ee6245ec4f29ec} from "./GregorianCalendar.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 $97f08bcb2befa667$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $97f08bcb2befa667$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $97f08bcb2befa667$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $97f08bcb2befa667$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $97f08bcb2befa667$var$findEraFromGregorianDate(date) {
const idx = $97f08bcb2befa667$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 $97f08bcb2befa667$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $97f08bcb2befa667$var$toGregorian(date) {
let eraAddend = $97f08bcb2befa667$var$ERA_ADDENDS[$97f08bcb2befa667$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(date.year + eraAddend, date.month, date.day);
}
class $97f08bcb2befa667$export$b746ab2b60cdffbf extends (0, $f25df78da1f6b40f$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $97f08bcb2befa667$var$findEraFromGregorianDate(date);
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, $97f08bcb2befa667$var$ERA_NAMES[era], date.year - $97f08bcb2befa667$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($97f08bcb2befa667$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $97f08bcb2befa667$var$toGregorian(date);
let era = $97f08bcb2befa667$var$findEraFromGregorianDate(gregorianDate);
if ($97f08bcb2befa667$var$ERA_NAMES[era] !== date.era) {
date.era = $97f08bcb2befa667$var$ERA_NAMES[era];
date.year = gregorianDate.year - $97f08bcb2befa667$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $97f08bcb2befa667$var$ERA_NAMES.indexOf(date.era);
let end = $97f08bcb2befa667$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 - $97f08bcb2befa667$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] = $97f08bcb2befa667$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 $97f08bcb2befa667$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 = $97f08bcb2befa667$var$ERA_NAMES.indexOf(date.era);
let cur = $97f08bcb2befa667$var$ERA_START_DATES[era];
let next = $97f08bcb2befa667$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($97f08bcb2befa667$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $97f08bcb2befa667$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $97f08bcb2befa667$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args), this.identifier = 'japanese';
}
}
function $97f08bcb2befa667$var$getMinimums(date) {
if (date.year === 1) {
let idx = $97f08bcb2befa667$var$ERA_NAMES.indexOf(date.era);
return $97f08bcb2befa667$var$ERA_START_DATES[idx];
}
}
export {$97f08bcb2befa667$export$b746ab2b60cdffbf as JapaneseCalendar};
//# sourceMappingURL=JapaneseCalendar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,174 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {GregorianCalendar as $93635573935797de$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 $34b940b49ba042df$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $34b940b49ba042df$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $34b940b49ba042df$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $34b940b49ba042df$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $34b940b49ba042df$var$findEraFromGregorianDate(date) {
const idx = $34b940b49ba042df$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 $34b940b49ba042df$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $34b940b49ba042df$var$toGregorian(date) {
let eraAddend = $34b940b49ba042df$var$ERA_ADDENDS[$34b940b49ba042df$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(date.year + eraAddend, date.month, date.day);
}
class $34b940b49ba042df$export$b746ab2b60cdffbf extends (0, $93635573935797de$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $34b940b49ba042df$var$findEraFromGregorianDate(date);
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, $34b940b49ba042df$var$ERA_NAMES[era], date.year - $34b940b49ba042df$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($34b940b49ba042df$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $34b940b49ba042df$var$toGregorian(date);
let era = $34b940b49ba042df$var$findEraFromGregorianDate(gregorianDate);
if ($34b940b49ba042df$var$ERA_NAMES[era] !== date.era) {
date.era = $34b940b49ba042df$var$ERA_NAMES[era];
date.year = gregorianDate.year - $34b940b49ba042df$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $34b940b49ba042df$var$ERA_NAMES.indexOf(date.era);
let end = $34b940b49ba042df$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 - $34b940b49ba042df$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] = $34b940b49ba042df$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 $34b940b49ba042df$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 = $34b940b49ba042df$var$ERA_NAMES.indexOf(date.era);
let cur = $34b940b49ba042df$var$ERA_START_DATES[era];
let next = $34b940b49ba042df$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($34b940b49ba042df$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $34b940b49ba042df$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $34b940b49ba042df$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args), this.identifier = 'japanese';
}
}
function $34b940b49ba042df$var$getMinimums(date) {
if (date.year === 1) {
let idx = $34b940b49ba042df$var$ERA_NAMES.indexOf(date.era);
return $34b940b49ba042df$var$ERA_START_DATES[idx];
}
}
export {$34b940b49ba042df$export$b746ab2b60cdffbf as JapaneseCalendar};
//# sourceMappingURL=JapaneseCalendar.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,87 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $09f945753a699862$exports = require("../utils.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "PersianCalendar", function () { return $4100faec94dc031c$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 $4100faec94dc031c$var$PERSIAN_EPOCH = 1948320;
// Number of days from the start of the year to the start of each month.
const $4100faec94dc031c$var$MONTH_START = [
0,
31,
62,
93,
124,
155,
186,
216,
246,
276,
306,
336 // Esfand
];
class $4100faec94dc031c$export$37fccdbfd14c5939 {
fromJulianDay(jd) {
let daysSinceEpoch = jd - $4100faec94dc031c$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 - $4100faec94dc031c$var$MONTH_START[month] + 1;
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, year, month + 1, day);
}
toJulianDay(date) {
let jd = $4100faec94dc031c$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
jd += $4100faec94dc031c$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, $09f945753a699862$exports.mod)(25 * date.year + 11, 33) < 8;
return isLeapYear ? 30 : 29;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
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.cjs.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,IAAI,SAAS;CACd;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,MAAM,KAAK,KAAK,CAAC,YAAY,MAAM,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACxF,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,yBAAiC;QAC/B,OAAO;IACT;IAEA,wBAAgC;QAC9B,OAAO;IACT;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aApDA,aAAiC;;AAqDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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 ? Math.floor(dayOfYear / 31) : 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 getMaximumMonthsInYear(): number {\n return 12;\n }\n\n getMaximumDaysInMonth(): number {\n return 31;\n }\n\n getEras(): string[] {\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.cjs.map"}

View File

@@ -0,0 +1,82 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {mod as $1797f75f9a4d3bd4$export$842a2cf37af977e1} from "../utils.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 $3e485caf6e85028a$var$PERSIAN_EPOCH = 1948320;
// Number of days from the start of the year to the start of each month.
const $3e485caf6e85028a$var$MONTH_START = [
0,
31,
62,
93,
124,
155,
186,
216,
246,
276,
306,
336 // Esfand
];
class $3e485caf6e85028a$export$37fccdbfd14c5939 {
fromJulianDay(jd) {
let daysSinceEpoch = jd - $3e485caf6e85028a$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 - $3e485caf6e85028a$var$MONTH_START[month] + 1;
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, year, month + 1, day);
}
toJulianDay(date) {
let jd = $3e485caf6e85028a$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
jd += $3e485caf6e85028a$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, $1797f75f9a4d3bd4$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
return isLeapYear ? 30 : 29;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
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 {$3e485caf6e85028a$export$37fccdbfd14c5939 as PersianCalendar};
//# sourceMappingURL=PersianCalendar.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,IAAI,SAAS;CACd;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,MAAM,KAAK,KAAK,CAAC,YAAY,MAAM,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACxF,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,yBAAiC;QAC/B,OAAO;IACT;IAEA,wBAAgC;QAC9B,OAAO;IACT;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aApDA,aAAiC;;AAqDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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 ? Math.floor(dayOfYear / 31) : 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 getMaximumMonthsInYear(): number {\n return 12;\n }\n\n getMaximumDaysInMonth(): number {\n return 31;\n }\n\n getEras(): string[] {\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.js.map"}

View File

@@ -0,0 +1,82 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {mod as $09ec6a572d60460f$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 $a0cc0739a536c3b1$var$PERSIAN_EPOCH = 1948320;
// Number of days from the start of the year to the start of each month.
const $a0cc0739a536c3b1$var$MONTH_START = [
0,
31,
62,
93,
124,
155,
186,
216,
246,
276,
306,
336 // Esfand
];
class $a0cc0739a536c3b1$export$37fccdbfd14c5939 {
fromJulianDay(jd) {
let daysSinceEpoch = jd - $a0cc0739a536c3b1$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 - $a0cc0739a536c3b1$var$MONTH_START[month] + 1;
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, year, month + 1, day);
}
toJulianDay(date) {
let jd = $a0cc0739a536c3b1$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
jd += $a0cc0739a536c3b1$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, $09ec6a572d60460f$export$842a2cf37af977e1)(25 * date.year + 11, 33) < 8;
return isLeapYear ? 30 : 29;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
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 {$a0cc0739a536c3b1$export$37fccdbfd14c5939 as PersianCalendar};
//# sourceMappingURL=PersianCalendar.mjs.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,IAAI,SAAS;CACd;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,MAAM,KAAK,KAAK,CAAC,YAAY,MAAM,KAAK,KAAK,CAAC,AAAC,CAAA,YAAY,CAAA,IAAK;QACxF,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,yBAAiC;QAC/B,OAAO;IACT;IAEA,wBAAgC;QAC9B,OAAO;IACT;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,gBAAwB;QACtB,8CAA8C;QAC9C,mDAAmD;QACnD,OAAO;IACT;;aApDA,aAAiC;;AAqDnC","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, CalendarIdentifier} 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: CalendarIdentifier = '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 ? Math.floor(dayOfYear / 31) : 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 getMaximumMonthsInYear(): number {\n return 12;\n }\n\n getMaximumDaysInMonth(): number {\n return 31;\n }\n\n getEras(): string[] {\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.mjs.map"}

View File

@@ -0,0 +1,80 @@
var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
var $05031860ba2f881f$exports = require("./GregorianCalendar.cjs");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "TaiwanCalendar", function () { return $2dab1d4ea1fc722b$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 $2dab1d4ea1fc722b$var$TAIWAN_ERA_START = 1911;
function $2dab1d4ea1fc722b$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $2dab1d4ea1fc722b$var$TAIWAN_ERA_START : 1 - date.year + $2dab1d4ea1fc722b$var$TAIWAN_ERA_START;
}
function $2dab1d4ea1fc722b$var$gregorianToTaiwan(year) {
let y = year - $2dab1d4ea1fc722b$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $2dab1d4ea1fc722b$export$65e01080afcb0799 extends (0, $05031860ba2f881f$exports.GregorianCalendar) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $05031860ba2f881f$exports.getExtendedYear)(date.era, date.year);
let [era, year] = $2dab1d4ea1fc722b$var$gregorianToTaiwan(extendedYear);
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($2dab1d4ea1fc722b$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $2dab1d4ea1fc722b$var$gregorianToTaiwan($2dab1d4ea1fc722b$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($2dab1d4ea1fc722b$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $2dab1d4ea1fc722b$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args), this.identifier = 'roc' // Republic of China
;
}
}
function $2dab1d4ea1fc722b$var$toGregorian(date) {
let [era, year] = (0, $05031860ba2f881f$exports.fromExtendedYear)($2dab1d4ea1fc722b$var$gregorianYear(date));
return new (0, $c51b7e0106f45dea$exports.CalendarDate)(era, year, date.month, date.day);
}
//# sourceMappingURL=TaiwanCalendar.cjs.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,WAAW,KAAK,IAAI,GAAG,yCAAmB,IAAI,KAAK,IAAI,GAAG;AAChF;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,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,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;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","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, CalendarIdentifier} 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' ? date.year + TAIWAN_ERA_START : 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\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(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.cjs.map"}

View File

@@ -0,0 +1,75 @@
import {CalendarDate as $9a4e222e1bd2b190$export$99faa760c7908e4f} from "../CalendarDate.js";
import {fromExtendedYear as $f25df78da1f6b40f$export$4475b7e617eb123c, getExtendedYear as $f25df78da1f6b40f$export$c36e0ecb2d4fa69d, GregorianCalendar as $f25df78da1f6b40f$export$80ee6245ec4f29ec} from "./GregorianCalendar.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 $0e7b6ab888014459$var$TAIWAN_ERA_START = 1911;
function $0e7b6ab888014459$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $0e7b6ab888014459$var$TAIWAN_ERA_START : 1 - date.year + $0e7b6ab888014459$var$TAIWAN_ERA_START;
}
function $0e7b6ab888014459$var$gregorianToTaiwan(year) {
let y = year - $0e7b6ab888014459$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $0e7b6ab888014459$export$65e01080afcb0799 extends (0, $f25df78da1f6b40f$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $f25df78da1f6b40f$export$c36e0ecb2d4fa69d)(date.era, date.year);
let [era, year] = $0e7b6ab888014459$var$gregorianToTaiwan(extendedYear);
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($0e7b6ab888014459$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $0e7b6ab888014459$var$gregorianToTaiwan($0e7b6ab888014459$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($0e7b6ab888014459$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $0e7b6ab888014459$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args), this.identifier = 'roc' // Republic of China
;
}
}
function $0e7b6ab888014459$var$toGregorian(date) {
let [era, year] = (0, $f25df78da1f6b40f$export$4475b7e617eb123c)($0e7b6ab888014459$var$gregorianYear(date));
return new (0, $9a4e222e1bd2b190$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$0e7b6ab888014459$export$65e01080afcb0799 as TaiwanCalendar};
//# sourceMappingURL=TaiwanCalendar.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,WAAW,KAAK,IAAI,GAAG,yCAAmB,IAAI,KAAK,IAAI,GAAG;AAChF;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,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,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;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","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, CalendarIdentifier} 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' ? date.year + TAIWAN_ERA_START : 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\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(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.js.map"}

View File

@@ -0,0 +1,75 @@
import {CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f} from "../CalendarDate.mjs";
import {fromExtendedYear as $93635573935797de$export$4475b7e617eb123c, getExtendedYear as $93635573935797de$export$c36e0ecb2d4fa69d, GregorianCalendar as $93635573935797de$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 $c009cc5f64923054$var$TAIWAN_ERA_START = 1911;
function $c009cc5f64923054$var$gregorianYear(date) {
return date.era === 'minguo' ? date.year + $c009cc5f64923054$var$TAIWAN_ERA_START : 1 - date.year + $c009cc5f64923054$var$TAIWAN_ERA_START;
}
function $c009cc5f64923054$var$gregorianToTaiwan(year) {
let y = year - $c009cc5f64923054$var$TAIWAN_ERA_START;
if (y > 0) return [
'minguo',
y
];
else return [
'before_minguo',
1 - y
];
}
class $c009cc5f64923054$export$65e01080afcb0799 extends (0, $93635573935797de$export$80ee6245ec4f29ec) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let extendedYear = (0, $93635573935797de$export$c36e0ecb2d4fa69d)(date.era, date.year);
let [era, year] = $c009cc5f64923054$var$gregorianToTaiwan(extendedYear);
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(this, era, year, date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($c009cc5f64923054$var$toGregorian(date));
}
getEras() {
return [
'before_minguo',
'minguo'
];
}
balanceDate(date) {
let [era, year] = $c009cc5f64923054$var$gregorianToTaiwan($c009cc5f64923054$var$gregorianYear(date));
date.era = era;
date.year = year;
}
isInverseEra(date) {
return date.era === 'before_minguo';
}
getDaysInMonth(date) {
return super.getDaysInMonth($c009cc5f64923054$var$toGregorian(date));
}
getYearsInEra(date) {
return date.era === 'before_minguo' ? 9999 : 9999 - $c009cc5f64923054$var$TAIWAN_ERA_START;
}
constructor(...args){
super(...args), this.identifier = 'roc' // Republic of China
;
}
}
function $c009cc5f64923054$var$toGregorian(date) {
let [era, year] = (0, $93635573935797de$export$4475b7e617eb123c)($c009cc5f64923054$var$gregorianYear(date));
return new (0, $2aaf608024c21ca1$export$99faa760c7908e4f)(era, year, date.month, date.day);
}
export {$c009cc5f64923054$export$65e01080afcb0799 as TaiwanCalendar};
//# sourceMappingURL=TaiwanCalendar.mjs.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,WAAW,KAAK,IAAI,GAAG,yCAAmB,IAAI,KAAK,IAAI,GAAG;AAChF;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,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAQ;QAChD,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;;QAlCK,qBACL,aAAiC,MAAO,oBAAoB;;;AAkC9D;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","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, CalendarIdentifier} 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' ? date.year + TAIWAN_ERA_START : 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\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(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.mjs.map"}