@internationalized/date 3.5.6 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/BuddhistCalendar.main.js +1 -2
- package/dist/BuddhistCalendar.main.js.map +1 -1
- package/dist/BuddhistCalendar.mjs +1 -2
- package/dist/BuddhistCalendar.module.js +1 -2
- package/dist/BuddhistCalendar.module.js.map +1 -1
- package/dist/DateFormatter.main.js.map +1 -1
- package/dist/DateFormatter.module.js.map +1 -1
- package/dist/EthiopicCalendar.main.js +2 -4
- package/dist/EthiopicCalendar.main.js.map +1 -1
- package/dist/EthiopicCalendar.mjs +2 -4
- package/dist/EthiopicCalendar.module.js +2 -4
- package/dist/EthiopicCalendar.module.js.map +1 -1
- package/dist/IndianCalendar.main.js +1 -2
- package/dist/IndianCalendar.main.js.map +1 -1
- package/dist/IndianCalendar.mjs +1 -2
- package/dist/IndianCalendar.module.js +1 -2
- package/dist/IndianCalendar.module.js.map +1 -1
- package/dist/IslamicCalendar.main.js +2 -4
- package/dist/IslamicCalendar.main.js.map +1 -1
- package/dist/IslamicCalendar.mjs +2 -4
- package/dist/IslamicCalendar.module.js +2 -4
- package/dist/IslamicCalendar.module.js.map +1 -1
- package/dist/JapaneseCalendar.main.js +1 -2
- package/dist/JapaneseCalendar.main.js.map +1 -1
- package/dist/JapaneseCalendar.mjs +1 -2
- package/dist/JapaneseCalendar.module.js +1 -2
- package/dist/JapaneseCalendar.module.js.map +1 -1
- package/dist/TaiwanCalendar.main.js +1 -2
- package/dist/TaiwanCalendar.main.js.map +1 -1
- package/dist/TaiwanCalendar.mjs +1 -2
- package/dist/TaiwanCalendar.module.js +1 -2
- package/dist/TaiwanCalendar.module.js.map +1 -1
- package/dist/conversion.main.js +1 -1
- package/dist/conversion.main.js.map +1 -1
- package/dist/conversion.mjs +1 -1
- package/dist/conversion.module.js +1 -1
- package/dist/conversion.module.js.map +1 -1
- package/dist/queries.main.js +18 -8
- package/dist/queries.main.js.map +1 -1
- package/dist/queries.mjs +18 -8
- package/dist/queries.module.js +18 -8
- package/dist/queries.module.js.map +1 -1
- package/dist/string.main.js +26 -17
- package/dist/string.main.js.map +1 -1
- package/dist/string.mjs +26 -17
- package/dist/string.module.js +26 -17
- package/dist/string.module.js.map +1 -1
- package/dist/types.d.ts +12 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/DateFormatter.ts +4 -8
- package/src/conversion.ts +1 -1
- package/src/queries.ts +29 -16
- package/src/string.ts +37 -19
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2019 Adobe
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -41,8 +41,7 @@ class $561c4ef058278b74$export$42d20a78301dee44 extends (0, $af14c9812fdceb33$ex
|
|
|
41
41
|
}
|
|
42
42
|
balanceDate() {}
|
|
43
43
|
constructor(...args){
|
|
44
|
-
super(...args);
|
|
45
|
-
this.identifier = 'buddhist';
|
|
44
|
+
super(...args), this.identifier = 'buddhist';
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
function $561c4ef058278b74$var$toGregorian(date) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;QA1BV,qBACL,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.main.js.map"}
|
|
@@ -35,8 +35,7 @@ class $8d73d47422ca7302$export$42d20a78301dee44 extends (0, $3b62074eb05584b2$ex
|
|
|
35
35
|
}
|
|
36
36
|
balanceDate() {}
|
|
37
37
|
constructor(...args){
|
|
38
|
-
super(...args);
|
|
39
|
-
this.identifier = 'buddhist';
|
|
38
|
+
super(...args), this.identifier = 'buddhist';
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
function $8d73d47422ca7302$var$toGregorian(date) {
|
|
@@ -35,8 +35,7 @@ class $8d73d47422ca7302$export$42d20a78301dee44 extends (0, $3b62074eb05584b2$ex
|
|
|
35
35
|
}
|
|
36
36
|
balanceDate() {}
|
|
37
37
|
constructor(...args){
|
|
38
|
-
super(...args);
|
|
39
|
-
this.identifier = 'buddhist';
|
|
38
|
+
super(...args), this.identifier = 'buddhist';
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
function $8d73d47422ca7302$var$toGregorian(date) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;QA1BV,qBACL,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAWlB,MAAM;IAUX,qGAAqG,GACrG,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YACxC,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO;QAG3C,IAAI,MAAM,OACR,MAAM,IAAI,WAAW;QAGvB,wCAAwC;QACxC,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,UAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IAC1E;IAEA,+CAA+C,GAC/C,mBAAmB,KA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QACN,QAAQ;IACV,GAAG,eAAe,GAAqC,SAAS,KAAK;IAGvE,OAAO;AACT;AAEA,SAAS,2CAAqB,MAAc,EAAE,OAAmC;IAC/E,IAAI,CAAC,QAAQ,SAAS,IAAI,CAAC,QAAQ,IAAI,EACrC,OAAO;IAGT,gFAAgF;IAChF,6FAA6F;IAC7F,SAAS,OAAO,OAAO,CAAC,0BAA0B;IAClD,UAAU,AAAC,CAAA,OAAO,QAAQ,CAAC,SAAS,KAAK,IAAG,IAAK;IACjD,IAAI,YAAY,6CAAuB,QAAQ;QAC7C,GAAG,OAAO;QACV,UAAU,UAAU,qBAAqB;IAC3C;IAEA,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IACzG,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IAE1G,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB","sources":["packages/@internationalized/date/src/DateFormatter.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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {\n hourCycle?: Intl.DateTimeFormatOptions['hourCycle']\n}\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"DateFormatter.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAOlB,MAAM;IAUX,qGAAqG,GACrG,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YACxC,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO;QAG3C,IAAI,MAAM,OACR,MAAM,IAAI,WAAW;QAGvB,wCAAwC;QACxC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,UAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM;IAC1E;IAEA,+CAA+C,GAC/C,mBAAmB,KAAW,EAAE,GAAS,EAAyB;QAChE,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,KAAK,YAC/C,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,OAAO;QAGlD,IAAI,MAAM,OACR,MAAM,IAAI,WAAW;QAGvB,IAAI,aAAa,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;QAC9C,IAAI,WAAW,IAAI,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S,KAAK,IAAG,IAAK;IACjD,IAAI,YAAY,6CAAuB,QAAQ;QAC7C,GAAG,OAAO;QACV,UAAU,UAAU,qBAAqB;IAC3C;IAEA,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IACzG,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IAE1G,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB","sources":["packages/@internationalized/date/src/DateFormatter.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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"DateFormatter.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAWlB,MAAM;IAUX,qGAAqG,GACrG,OAAO,KAAW,EAAU;QAC1B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IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB","sources":["packages/@internationalized/date/src/DateFormatter.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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {\n hourCycle?: Intl.DateTimeFormatOptions['hourCycle']\n}\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"DateFormatter.module.js.map"}
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAOlB,MAAM;IAUX,qGAAqG,GACrG,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YACxC,aAAa;Q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AC7B,gDAA0B,IAAI,KAAK,cAAc,CAAC,SAAS;QACzD,MAAM;QACN,QAAQ;IACV,GAAG,MAAM,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,QAAQ;IAGzC,OAAO;AACT;AAEA,IAAI,mDAA6C;AACjD,SAAS;IACP,IAAI,oDAA8B,MAChC,mDAA6B,IAAI,KAAK,cAAc,CAAC,MAAM;QACzD,MAAM;QACN,QAAQ;IACV,GAAG,eAAe,GAAG,SAAS,KAAK;IAGrC,OAAO;AACT;AAEA,SAAS,2CAAqB,MAAc,EAAE,OAAmC;IAC/E,IAAI,CAAC,QAAQ,SAAS,IAAI,CAAC,QAAQ,IAAI,EACrC,OAAO;IAGT,gFAAgF;IAChF,6FAA6F;IAC7F,SAAS,OAAO,OAAO,CAAC,0BAA0B;IAClD,UAAU,AAAC,CAAA,OAAO,QAAQ,CAAC,SAAS,KAAK,IAAG,IAAK;IACjD,IAAI,YAAY,6CAAuB,QAAQ;QAC7C,GAAG,OAAO;QACV,UAAU,UAAU,qBAAqB;IAC3C;IAEA,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IACzG,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IAE1G,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB","sources":["packages/@internationalized/date/src/DateFormatter.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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"DateFormatter.module.js.map"}
|
|
@@ -114,8 +114,7 @@ class $4db04d1051af0f2f$export$d72e0c37005a4914 extends $4db04d1051af0f2f$export
|
|
|
114
114
|
return 9999;
|
|
115
115
|
}
|
|
116
116
|
constructor(...args){
|
|
117
|
-
super(...args)
|
|
118
|
-
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
|
|
117
|
+
super(...args), this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
|
|
119
118
|
;
|
|
120
119
|
}
|
|
121
120
|
}
|
|
@@ -161,8 +160,7 @@ class $4db04d1051af0f2f$export$fe6243cbe1a4b7c1 extends $4db04d1051af0f2f$export
|
|
|
161
160
|
return date.era === 'BCE' ? 9999 : 9715;
|
|
162
161
|
}
|
|
163
162
|
constructor(...args){
|
|
164
|
-
super(...args);
|
|
165
|
-
this.identifier = 'coptic';
|
|
163
|
+
super(...args), this.identifier = 'coptic';
|
|
166
164
|
}
|
|
167
165
|
}
|
|
168
166
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,oCAAc,KAAa,EAAE,IAAY,EAA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;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.main.js.map"}
|
|
@@ -106,8 +106,7 @@ class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export
|
|
|
106
106
|
return 9999;
|
|
107
107
|
}
|
|
108
108
|
constructor(...args){
|
|
109
|
-
super(...args)
|
|
110
|
-
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
|
|
109
|
+
super(...args), this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
|
|
111
110
|
;
|
|
112
111
|
}
|
|
113
112
|
}
|
|
@@ -153,8 +152,7 @@ class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export
|
|
|
153
152
|
return date.era === 'BCE' ? 9999 : 9715;
|
|
154
153
|
}
|
|
155
154
|
constructor(...args){
|
|
156
|
-
super(...args);
|
|
157
|
-
this.identifier = 'coptic';
|
|
155
|
+
super(...args), this.identifier = 'coptic';
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -106,8 +106,7 @@ class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export
|
|
|
106
106
|
return 9999;
|
|
107
107
|
}
|
|
108
108
|
constructor(...args){
|
|
109
|
-
super(...args)
|
|
110
|
-
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
|
|
109
|
+
super(...args), this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
|
|
111
110
|
;
|
|
112
111
|
}
|
|
113
112
|
}
|
|
@@ -153,8 +152,7 @@ class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export
|
|
|
153
152
|
return date.era === 'BCE' ? 9999 : 9715;
|
|
154
153
|
}
|
|
155
154
|
constructor(...args){
|
|
156
|
-
super(...args);
|
|
157
|
-
this.identifier = 'coptic';
|
|
155
|
+
super(...args), this.identifier = 'coptic';
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,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Ac,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGA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B,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,KAAK,KAAK,CAAA,GAAA,oCAAS,EAAE,KAAK,IAAI,GAAG,yCAC7C,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,GACnC,OAAO;QAGT,OAAO;IACT;IAEA,gBAAwB;QACtB,6CAA6C;QAC7C,6CAA6C;QAC7C,OAAO;IACT;IAEA,UAAU;QACR,OAAO;YAAC;SAAO;IACjB;IAEA,cAAc,CAAC;;QAjGV,qBACL,aAAa;;AAiGf","sources":["packages/@internationalized/date/src/calendars/IndianCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, GregorianCalendar, gregorianToJulianDay, isLeapYear} from './GregorianCalendar';\n\n// Starts in 78 AD,\nconst INDIAN_ERA_START = 78;\n\n// The Indian year starts 80 days later than the Gregorian year.\nconst INDIAN_YEAR_START = 80;\n\n/**\n * The Indian National Calendar is similar to the Gregorian calendar, but with\n * years numbered since the Saka era in 78 AD (Gregorian). There are 12 months\n * in each year, with either 30 or 31 days. Only one era identifier is supported: 'saka'.\n */\nexport class IndianCalendar extends GregorianCalendar {\n identifier = 'indian';\n\n fromJulianDay(jd: number): CalendarDate {\n // Gregorian date for Julian day\n let date = super.fromJulianDay(jd);\n\n // Year in Saka era\n let indianYear = date.year - INDIAN_ERA_START;\n\n // Day number in Gregorian year (starting from 0)\n let yDay = jd - gregorianToJulianDay(date.era, date.year, 1, 1);\n\n let leapMonth: number;\n if (yDay < INDIAN_YEAR_START) {\n // Day is at the end of the preceding Saka year\n indianYear--;\n\n // Days in leapMonth this year, previous Gregorian year\n leapMonth = isLeapYear(date.year - 1) ? 31 : 30;\n yDay += leapMonth + (31 * 5) + (30 * 3) + 10;\n } else {\n // Days in leapMonth this year\n leapMonth = isLeapYear(date.year) ? 31 : 30;\n yDay -= INDIAN_YEAR_START;\n }\n\n let indianMonth: number;\n let indianDay: number;\n if (yDay < leapMonth) {\n indianMonth = 1;\n indianDay = yDay + 1;\n } else {\n let mDay = yDay - leapMonth;\n if (mDay < (31 * 5)) {\n indianMonth = Math.floor(mDay / 31) + 2;\n indianDay = (mDay % 31) + 1;\n } else {\n mDay -= 31 * 5;\n indianMonth = Math.floor(mDay / 30) + 7;\n indianDay = (mDay % 30) + 1;\n }\n }\n\n return new CalendarDate(this, indianYear, indianMonth, indianDay);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let extendedYear = date.year + INDIAN_ERA_START;\n let [era, year] = fromExtendedYear(extendedYear);\n\n let leapMonth: number;\n let jd: number;\n if (isLeapYear(year)) {\n leapMonth = 31;\n jd = gregorianToJulianDay(era, year, 3, 21);\n } else {\n leapMonth = 30;\n jd = gregorianToJulianDay(era, year, 3, 22);\n }\n\n if (date.month === 1) {\n return jd + date.day - 1;\n }\n\n jd += leapMonth + Math.min(date.month - 2, 5) * 31;\n\n if (date.month >= 8) {\n jd += (date.month - 7) * 30;\n }\n\n jd += date.day - 1;\n return jd;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month === 1 && isLeapYear(date.year + INDIAN_ERA_START)) {\n return 31;\n }\n\n if (date.month >= 2 && date.month <= 6) {\n return 31;\n }\n\n return 30;\n }\n\n getYearsInEra(): number {\n // 9999-12-31 gregorian is 9920-10-10 indian.\n // Round down to 9919 for the last full year.\n return 9919;\n }\n\n getEras() {\n return ['saka'];\n }\n\n balanceDate() {}\n}\n"],"names":[],"version":3,"file":"IndianCalendar.main.js.map"}
|
package/dist/IndianCalendar.mjs
CHANGED