1 | require = function e(t, n, r) {
|
---|
2 | function s(o, u) {
|
---|
3 | if (!n[o]) {
|
---|
4 | if (!t[o]) {
|
---|
5 | var a = typeof require == "function" && require;
|
---|
6 | if (!u && a)
|
---|
7 | return a(o, !0);
|
---|
8 | if (i)
|
---|
9 | return i(o, !0);
|
---|
10 | var f = new Error("Cannot find module '" + o + "'");
|
---|
11 | throw f.code = "MODULE_NOT_FOUND", f
|
---|
12 | }
|
---|
13 | var l = n[o] = {
|
---|
14 | exports: {}
|
---|
15 | };
|
---|
16 | t[o][0].call(l.exports, function (e) {
|
---|
17 | var n = t[o][1][e];
|
---|
18 | return s(n ? n : e)
|
---|
19 | }, l, l.exports, e, t, n, r)
|
---|
20 | }
|
---|
21 | return n[o].exports
|
---|
22 | }
|
---|
23 | var i = typeof require == "function" && require;
|
---|
24 | for (var o = 0; o < r.length; o++)
|
---|
25 | s(r[o]);
|
---|
26 | return s
|
---|
27 | }({
|
---|
28 | 1: [function (require, module, exports) {
|
---|
29 | (function (root, factory) {
|
---|
30 | "use strict";
|
---|
31 | var opening_hours_resources = {
|
---|
32 | en: {
|
---|
33 | opening_hours: {
|
---|
34 | pretty: {
|
---|
35 | off: "closed",
|
---|
36 | SH: "school holidays",
|
---|
37 | PH: "public holidays"
|
---|
38 | }
|
---|
39 | }
|
---|
40 | },
|
---|
41 | de: {
|
---|
42 | opening_hours: {
|
---|
43 | texts: {
|
---|
44 | "unexpected token": 'Unerwartetes Zeichen: "__token__" Das bedeutet, dass die Syntax an dieser Stelle nicht erkannt werden konnte.',
|
---|
45 | "no string": "Der Wert (erster Parameter) ist kein String",
|
---|
46 | nothing: "Der Wert enthält nichts, was ausgewertet werden könnte.",
|
---|
47 | "nothing useful": "Diese Regel enthält nichts nützliches. Bitte entferne diese leere Regel.",
|
---|
48 | "programmers joke": "Kann es sein, dass du ein Programmierer bist und das Hinzufügen eines Semikolons nach jedem Statement ist zwanghaft ;) ?" + " Es ist so, dass das Semikolon in der opening_hours-Syntax als Trenner für Regeln definiert ist." + " Bitte verzichte an dieser Stelle auf ein Semikolon.",
|
---|
49 | "interpreted as year": "Die Zahl __number__ wird als Jahr interpretiert." + ' Vermutlich ist das nicht beabsichtigt. Uhrzeiten werden als "12:00" angegeben.',
|
---|
50 | "rule before fallback empty": "Die Regel vor der Fallback-Regel enthält nichts nützliches",
|
---|
51 | "hour min separator": 'Bitte benutze ":" als Stunden/Minuten-Trenner',
|
---|
52 | "warnings severity": 'Der Parameter optional_conf_parm["warnings_severity"] muss eine ganze Zahl zwischen (einschließlich) 0 und (einschließlich) 7 sein.' + " Gegeben: __severity__ " + ", erwartet: Eine der Zahlen: __allowed__.",
|
---|
53 | "optional conf parm type": "Der optional_conf_parm Parameter hat einen unbekannten Typ." + " Gegeben: __given__",
|
---|
54 | "conf param tag key missing": 'Der optional_conf_parm["tag_key"] fehlt, ist aber notwendig wegen optional_conf_parm["map_value"].',
|
---|
55 | "conf param mode invalid": 'Der optional_conf_parm["mode"]-Parameter ist eine ungültige Zahl.' + " Gegeben: __given__" + ", erwartet: Eine der Zahlen: __allowed__.",
|
---|
56 | "conf param unkown type": 'Der optional_conf_parm["__key__"] Parameter hat einen unbekannten Typ.' + " Gegeben: __given__, erwartet: __expected__.",
|
---|
57 | "library bug": 'Bei der Auswertung des Wertes "__value__" ist ein Fehler aufgetreten.' + " Bitte melde diesen Fehler oder korrigiere diesen mittels eines Pull Requests oder Patches: __url__.__message__",
|
---|
58 | "library bug PR only": 'Bei der Auswertung des Wertes "__value__" ist ein Fehler aufgetreten.' + " Du kannst dies korrigieren, indem du das Problem löst und in Form eines Pull Requests oder Patches zum Projekt beiträgst: __url__.__message__",
|
---|
59 | "use multi": 'Du hast __count__ __part2__ Einzelne Regeln können mit ";" getrennt werden.',
|
---|
60 | "selector multi 2a": "__what__ in einer Regel benutzt. Du kannst nur einen davon je Regel verwenden",
|
---|
61 | "selector multi 2b": "nicht verbundene __what__ in einer Regel benutzt. Das ist vermutlich ein Fehler." + " Gleiche Selektoren können (und sollten) immer zusammen und durch Kommas getrennt geschrieben werden." + ' Beispiel für Zeitspannen "12:00-13:00,15:00-18:00".' + ' Beispiel für Wochentage "Mo-We,Fr".',
|
---|
62 | "selector state": "Status-Schlüsselwörter (offen, geschlossen)",
|
---|
63 | comments: "Kommentare",
|
---|
64 | months: "Monate",
|
---|
65 | weekdays: "Wochentage",
|
---|
66 | ranges: "Zeitspannen",
|
---|
67 | "default state": "Diese Regel, welche den Standard-Status (d.h. geschlossen) für alle folgenden Regeln ändert, ist nicht die erste Regel." + " Diese Regel überschreibt alle vorherigen Regeln." + " Es kann legitim sein, den Standard-Status z.B. auf geöffnet festzulegen" + " und dann nur die Zeiten, zu denen geschlossen ist, anzugeben.",
|
---|
68 | vague: "Diese Regel ist nicht sehr aussagekräftig, da keine Zeit angegeben wurde." + " Bitte füge eine Zeitangabe oder einen Kommentar hinzu, um dies zu verbessern.",
|
---|
69 | "empty comment": "Du hast einen leeren Kommentar verwendet." + '" Bitte schreibe entweder einen Kommentar-Text oder benutze stattdessen das Schlüsselwort "unknown".',
|
---|
70 | separator_for_readability: "Du hast das optionale Symbol <separator_for_readability> an der falschen Stelle benutzt." + " Bitte lies die Syntax-Spezifikation um zu sehen, wo es verwendet werden kann, oder entferne es.",
|
---|
71 | "strange 24/7": 'Du hast 24/7 in einer Art verwendet, welche wahrscheinlich nicht als "24 Stunden, 7 Tage die Woche" interpretiert wird.' + ' Der Richtigkeit halber solltest du "open" oder "closed"' + " für diese Regel verwenden und dann die Ausnahmen angeben um das selbe Ziel zu erreichen. So ist es klarer –" + ' zum Beispiel "open; Mo 12:00-14:00 off".',
|
---|
72 | "public holiday": 'Es wurde keine Regel für "PH" (feiertags) angegeben. Dies ist nicht sehr aussagekräftig.__part2__' + ' Bitte füge die Regel "PH off" an, wenn die Einrichtung an allen Feiertagen geschlossen ist' + ' oder schreibe "Sa,Su,PH 12:00-16:00" um auszudrücken, dass Samstags, Sonntags und feiertags von 12:00-16:00 geöffnet ist.' + ' Falls die Einrichtung täglich und an Feiertagen geöffnet ist, kann dies explizit mittels "Mo-Su,PH" ausgedrückt werden.' + " Wenn du dir im Unklaren bist, versuche die Öffnungszeit zu klären. Falls das nicht möglich ist, lass die Angabe weg und ignoriere diese Warnung.",
|
---|
73 | "public holiday part2": ' Leider ist der "tag key" (beispielsweise "opening_hours", oder "lit") in opening_hours.js nicht bekannt.' + " Diese Warnung betrifft nur die Keys: __keys__. Falls deine Angabe nicht für einen dieser ist, ignoriere bitte folgenden Hinweis:",
|
---|
74 | switched: 'Der Selektor "__first__" wurde für eine bessere Lesbarkeit und der Vollständigkeit halber mit' + ' "__second__" getauscht.',
|
---|
75 | "no colon after": 'Bitte Benutze kein ":" nach dem Token __token__.',
|
---|
76 | "number -5 to 5": "Zahl zwischen -5 und 5 (außer 0) erwartet.",
|
---|
77 | "one weekday constraint": "Du kannst höchstens einen beschränkten Wochentag in einer Monats-Spanne verwenden",
|
---|
78 | "range constrained weekdays": "Du kannst keine Wochentags-Spanne als Beschränkung in einer Monats-Spanne verwenden",
|
---|
79 | expected: '"__symbol__" erwartet.',
|
---|
80 | "range zero": 'Du kannst keine __type__-Spanne mit Periode "0" verwenden.',
|
---|
81 | "period one year+": 'Bitte verwende keine __type__-Spannen mit Periode "1".' + ' Wenn du ausdrücken willst, das eine Einrichtung ab einem bestimmten Jahr immer offen ist, benutze bitte "<year>+".',
|
---|
82 | "period one": 'Bitte verwende keine __type__-Spannen mit Periode "1".',
|
---|
83 | "month 31": "Die Tagesangabe für __month__ muss zwischen 1 und 31 liegen.",
|
---|
84 | "month 30": "Der Monat __month__ hat keine 31 Tage. Der letzte Tag von __month__ ist Tag 30.",
|
---|
85 | "month feb": '"Der Monat __month__ hat entweder 28 oder 29 Tage (Schaltjahre)."',
|
---|
86 | "point in time": "Erwarte Bindestrich (-) oder offenes Ende (+) in der Zeitspanne __calc__." + " Um mit Zeitpunkten zu arbeiten, muss der Modus für __libraryname__ umgestellt werden." + " Vielleicht falsches OSM-tag verwendet?",
|
---|
87 | calculation: "Berechnung",
|
---|
88 | "time range continue": "Die Zeitspanne geht nicht wie erwartet weiter",
|
---|
89 | "period continue": 'Die Zeitspannen-Periode geht nicht wie erwartet weiter. Beispiel "/01:30".',
|
---|
90 | "time range mode": '__libraryname__ wurde im "Zeitspannen-Modus" aufgerufen. Zeitpunkt gefunden.',
|
---|
91 | "point in time mode": '__libraryname__ wurde im "Zeitpunkt-Modus" aufgerufen. Zeitspanne gefunden.',
|
---|
92 | "outside current day": "Zeitspanne beginnt außerhalb des aktuellen Tages",
|
---|
93 | "two midnights": "Zeitspanne welche mehrmals Mitternacht beinhaltet wird nicht unterstützt",
|
---|
94 | "without minutes": "Zeitspanne ohne Minutenangabe angegeben. Das ist nicht sehr eindeutig!" + ' Bitte verwende stattdessen folgende Syntax "__syntax__".',
|
---|
95 | "outside day": "Die Zeitspanne beginnt außerhalb des aktuellen Tages",
|
---|
96 | "zero calculation": "Das Hinzufügen von 0 in einer variablen Zeitberechnung ändert die variable Zeit nicht." + ' Bitte entferne die Zeitberechnung (Beispiel: "sunrise-(sunset-00:00)").',
|
---|
97 | "calculation syntax": "Berechnung mit variabler Zeit hat nicht die korrekte Syntax",
|
---|
98 | missing: 'Fehlendes "__symbol__"',
|
---|
99 | "(time)": "(Zeit)",
|
---|
100 | "bad range": "Ungültige Zeitspanne: __from__-__to__",
|
---|
101 | "] or more numbers": '"]" oder weitere Zahlen erwartet.',
|
---|
102 | "additional rule no sense": 'Eine weitere Regel an dieser Stelle ergibt keinen Sinn. Benutze einfach ";" als Trenner für Regeln.' + " Siehe https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator",
|
---|
103 | "unexpected token weekday range": "Unerwartes Token in Tages-Spanne: __token__",
|
---|
104 | "max differ": "Es sollte keinen Grund geben, mehr als __maxdiffer__ Tage von einem __name__ abzuweichen. Wenn nötig, teile uns dies bitte mit …",
|
---|
105 | "adding 0": "Addition von 0 verändert das Datum nicht. Bitte weglassen.",
|
---|
106 | "unexpected token holiday": "Unerwarteter Token (in Feiertags-Auswertung): __token__",
|
---|
107 | "no holiday definition": "__name__ ist für das Land __cc__ nicht definiert.",
|
---|
108 | "no holiday definition state": "__name__ ist für das Land __cc__ und Bundesland __state__ nicht definiert.",
|
---|
109 | "no country code": "Der Ländercode fehlt. Dieser wird benötigt um die korrekten Feiertage zu bestimmen (siehe in der README wie dieser anzugeben ist)",
|
---|
110 | "movable no formula": "Der bewegliche Feiertag __name__ kann nicht berechnet werden." + " Bitte füge eine entsprechende Formel hinzu.",
|
---|
111 | "movable not in year": "Der bewegliche Feiertag __name__ plus __days__" + " Tage befindet sich nicht mehr im selben Jahr. Aktuell nicht unterstützt.",
|
---|
112 | "year range one year": "Eine Jahres-Spanne mit gleichem Jahr als Beginn und Ende ergibt keinen Sinn." + ' Bitte entferne das Ende-Jahr. zum Beispiel: "__year__ May 23"',
|
---|
113 | "year range reverse": "Eine Jahres-Spanne mit Beginn größer als Ende ergibt keinen Sinn." + " Bitte umdrehen.",
|
---|
114 | "year past": "Das Jahr liegt in der Vergangenheit.",
|
---|
115 | "unexpected token year range": "Unerwartetes Token in der Jahres-Spanne: __token__",
|
---|
116 | "week range reverse": "Du hast eine Wochen-Spanne in umgekehrter Reihenfolge oder mehrere Jahre umfassende angegeben. Dies ist aktuell nicht unterstützt.",
|
---|
117 | "week negative": "Du hast eine Kalenderwoche kleiner 1 angegeben. Korrekte Angaben sind 1-53.",
|
---|
118 | "week exceed": "Du hast eine Kalenderwoche größer als 53 angegeben. Korrekte Angaben sind 1-53.",
|
---|
119 | "week period less than 2": "Du hast eine Wochenperiode kleiner 2 angegeben." + ' Wenn du die gesamte Spanne von __weekfrom__ bis __weekto__ angeben willst, lasse "/__period__" einfach weg.',
|
---|
120 | "week period greater than 26": "Du hast eine Wochen-Periode größer als 26 angegeben." + " 26.5 ist die Hälfte des Maximums von 53 Wochen pro Jahr. Damit würde eine Periode größer als 26 nur einmal pro Jahr auftreten." + ' Bitte gibt den Wochen-Selektor als "week __weekfrom__" an, wenn es das ist, was du ausdrücken möchtest.',
|
---|
121 | "unexpected token week range": "Unerwartetes Token in Wochen-Spanne: __token__",
|
---|
122 | "unexpected token month range": "Unerwartetes Token in Monats-Spanne: __token__",
|
---|
123 | "day range reverse": "Zeitspanne in falscher Reihenfolge. Beginn ist größer als Ende.",
|
---|
124 | "open end": 'Angegeben als "open end". Schließzeit wurde geraten.',
|
---|
125 | "date parameter needed": "Datumsparameter nötig."
|
---|
126 | },
|
---|
127 | pretty: {
|
---|
128 | off: "geschlossen",
|
---|
129 | SH: "Schulferien",
|
---|
130 | PH: "Feiertags"
|
---|
131 | }
|
---|
132 | }
|
---|
133 | }
|
---|
134 | };
|
---|
135 | if (typeof require === "function" && typeof module !== "undefined") {
|
---|
136 | var i18n = require("i18next-client");
|
---|
137 | factory(i18n, opening_hours_resources);
|
---|
138 | module.exports = i18n
|
---|
139 | } else if (typeof define === "function" && define.amd) {
|
---|
140 | define(["i18next-client"], function (i18n) {
|
---|
141 | factory(i18n, opening_hours_resources);
|
---|
142 | return i18n
|
---|
143 | })
|
---|
144 | }
|
---|
145 | })(this, function (i18n, opening_hours_resources) {
|
---|
146 | if (!i18n.isInitialized()) {
|
---|
147 | i18n.init({
|
---|
148 | fallbackLng: "en",
|
---|
149 | resStore: opening_hours_resources,
|
---|
150 | getAsync: true,
|
---|
151 | useCookie: true
|
---|
152 | })
|
---|
153 | } else {
|
---|
154 | for (lang in opening_hours_resources) {
|
---|
155 | i18n.addResourceBundle(lang, "opening_hours", opening_hours_resources[lang]["opening_hours"], true)
|
---|
156 | }
|
---|
157 | }
|
---|
158 | })
|
---|
159 | }, {
|
---|
160 | "i18next-client": "i18next-client"
|
---|
161 | }],
|
---|
162 | 2: [function (require, module, exports) {
|
---|
163 | /*
|
---|
164 | (c) 2011-2015, Vladimir Agafonkin
|
---|
165 | SunCalc is a JavaScript library for calculating sun/moon position and light phases.
|
---|
166 | https://github.com/mourner/suncalc
|
---|
167 | */
|
---|
168 | (function () {
|
---|
169 | "use strict";
|
---|
170 | var PI = Math.PI,
|
---|
171 | sin = Math.sin,
|
---|
172 | cos = Math.cos,
|
---|
173 | tan = Math.tan,
|
---|
174 | asin = Math.asin,
|
---|
175 | atan = Math.atan2,
|
---|
176 | acos = Math.acos,
|
---|
177 | rad = PI / 180;
|
---|
178 | var dayMs = 1e3 * 60 * 60 * 24,
|
---|
179 | J1970 = 2440588,
|
---|
180 | J2000 = 2451545;
|
---|
181 |
|
---|
182 | function toJulian(date) {
|
---|
183 | return date.valueOf() / dayMs - .5 + J1970
|
---|
184 | }
|
---|
185 |
|
---|
186 | function fromJulian(j) {
|
---|
187 | return new Date((j + .5 - J1970) * dayMs)
|
---|
188 | }
|
---|
189 |
|
---|
190 | function toDays(date) {
|
---|
191 | return toJulian(date) - J2000
|
---|
192 | }
|
---|
193 | var e = rad * 23.4397;
|
---|
194 |
|
---|
195 | function rightAscension(l, b) {
|
---|
196 | return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l))
|
---|
197 | }
|
---|
198 |
|
---|
199 | function declination(l, b) {
|
---|
200 | return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l))
|
---|
201 | }
|
---|
202 |
|
---|
203 | function azimuth(H, phi, dec) {
|
---|
204 | return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi))
|
---|
205 | }
|
---|
206 |
|
---|
207 | function altitude(H, phi, dec) {
|
---|
208 | return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H))
|
---|
209 | }
|
---|
210 |
|
---|
211 | function siderealTime(d, lw) {
|
---|
212 | return rad * (280.16 + 360.9856235 * d) - lw
|
---|
213 | }
|
---|
214 |
|
---|
215 | function astroRefraction(h) {
|
---|
216 | if (h < 0)
|
---|
217 | h = 0;
|
---|
218 | return 2967e-7 / Math.tan(h + .00312536 / (h + .08901179))
|
---|
219 | }
|
---|
220 |
|
---|
221 | function solarMeanAnomaly(d) {
|
---|
222 | return rad * (357.5291 + .98560028 * d)
|
---|
223 | }
|
---|
224 |
|
---|
225 | function eclipticLongitude(M) {
|
---|
226 | var C = rad * (1.9148 * sin(M) + .02 * sin(2 * M) + 3e-4 * sin(3 * M)),
|
---|
227 | P = rad * 102.9372;
|
---|
228 | return M + C + P + PI
|
---|
229 | }
|
---|
230 |
|
---|
231 | function sunCoords(d) {
|
---|
232 | var M = solarMeanAnomaly(d),
|
---|
233 | L = eclipticLongitude(M);
|
---|
234 | return {
|
---|
235 | dec: declination(L, 0),
|
---|
236 | ra: rightAscension(L, 0)
|
---|
237 | }
|
---|
238 | }
|
---|
239 | var SunCalc = {};
|
---|
240 | SunCalc.getPosition = function (date, lat, lng) {
|
---|
241 | var lw = rad * -lng,
|
---|
242 | phi = rad * lat,
|
---|
243 | d = toDays(date),
|
---|
244 | c = sunCoords(d),
|
---|
245 | H = siderealTime(d, lw) - c.ra;
|
---|
246 | return {
|
---|
247 | azimuth: azimuth(H, phi, c.dec),
|
---|
248 | altitude: altitude(H, phi, c.dec)
|
---|
249 | }
|
---|
250 | };
|
---|
251 | var times = SunCalc.times = [
|
---|
252 | [-.833, "sunrise", "sunset"],
|
---|
253 | [-.3, "sunriseEnd", "sunsetStart"],
|
---|
254 | [-6, "dawn", "dusk"],
|
---|
255 | [-12, "nauticalDawn", "nauticalDusk"],
|
---|
256 | [-18, "nightEnd", "night"],
|
---|
257 | [6, "goldenHourEnd", "goldenHour"]
|
---|
258 | ];
|
---|
259 | SunCalc.addTime = function (angle, riseName, setName) {
|
---|
260 | times.push([angle, riseName, setName])
|
---|
261 | };
|
---|
262 | var J0 = 9e-4;
|
---|
263 |
|
---|
264 | function julianCycle(d, lw) {
|
---|
265 | return Math.round(d - J0 - lw / (2 * PI))
|
---|
266 | }
|
---|
267 |
|
---|
268 | function approxTransit(Ht, lw, n) {
|
---|
269 | return J0 + (Ht + lw) / (2 * PI) + n
|
---|
270 | }
|
---|
271 |
|
---|
272 | function solarTransitJ(ds, M, L) {
|
---|
273 | return J2000 + ds + .0053 * sin(M) - .0069 * sin(2 * L)
|
---|
274 | }
|
---|
275 |
|
---|
276 | function hourAngle(h, phi, d) {
|
---|
277 | return acos((sin(h) - sin(phi) * sin(d)) / (cos(phi) * cos(d)))
|
---|
278 | }
|
---|
279 |
|
---|
280 | function getSetJ(h, lw, phi, dec, n, M, L) {
|
---|
281 | var w = hourAngle(h, phi, dec),
|
---|
282 | a = approxTransit(w, lw, n);
|
---|
283 | return solarTransitJ(a, M, L)
|
---|
284 | }
|
---|
285 | SunCalc.getTimes = function (date, lat, lng) {
|
---|
286 | var lw = rad * -lng,
|
---|
287 | phi = rad * lat,
|
---|
288 | d = toDays(date),
|
---|
289 | n = julianCycle(d, lw),
|
---|
290 | ds = approxTransit(0, lw, n),
|
---|
291 | M = solarMeanAnomaly(ds),
|
---|
292 | L = eclipticLongitude(M),
|
---|
293 | dec = declination(L, 0),
|
---|
294 | Jnoon = solarTransitJ(ds, M, L),
|
---|
295 | i, len, time, Jset, Jrise;
|
---|
296 | var result = {
|
---|
297 | solarNoon: fromJulian(Jnoon),
|
---|
298 | nadir: fromJulian(Jnoon - .5)
|
---|
299 | };
|
---|
300 | for (i = 0, len = times.length; i < len; i += 1) {
|
---|
301 | time = times[i];
|
---|
302 | Jset = getSetJ(time[0] * rad, lw, phi, dec, n, M, L);
|
---|
303 | Jrise = Jnoon - (Jset - Jnoon);
|
---|
304 | result[time[1]] = fromJulian(Jrise);
|
---|
305 | result[time[2]] = fromJulian(Jset)
|
---|
306 | }
|
---|
307 | return result
|
---|
308 | };
|
---|
309 |
|
---|
310 | function moonCoords(d) {
|
---|
311 | var L = rad * (218.316 + 13.176396 * d),
|
---|
312 | M = rad * (134.963 + 13.064993 * d),
|
---|
313 | F = rad * (93.272 + 13.22935 * d),
|
---|
314 | l = L + rad * 6.289 * sin(M),
|
---|
315 | b = rad * 5.128 * sin(F),
|
---|
316 | dt = 385001 - 20905 * cos(M);
|
---|
317 | return {
|
---|
318 | ra: rightAscension(l, b),
|
---|
319 | dec: declination(l, b),
|
---|
320 | dist: dt
|
---|
321 | }
|
---|
322 | }
|
---|
323 | SunCalc.getMoonPosition = function (date, lat, lng) {
|
---|
324 | var lw = rad * -lng,
|
---|
325 | phi = rad * lat,
|
---|
326 | d = toDays(date),
|
---|
327 | c = moonCoords(d),
|
---|
328 | H = siderealTime(d, lw) - c.ra,
|
---|
329 | h = altitude(H, phi, c.dec),
|
---|
330 | pa = atan(sin(H), tan(phi) * cos(c.dec) - sin(c.dec) * cos(H));
|
---|
331 | h = h + astroRefraction(h);
|
---|
332 | return {
|
---|
333 | azimuth: azimuth(H, phi, c.dec),
|
---|
334 | altitude: h,
|
---|
335 | distance: c.dist,
|
---|
336 | parallacticAngle: pa
|
---|
337 | }
|
---|
338 | };
|
---|
339 | SunCalc.getMoonIllumination = function (date) {
|
---|
340 | var d = toDays(date || new Date),
|
---|
341 | s = sunCoords(d),
|
---|
342 | m = moonCoords(d),
|
---|
343 | sdist = 149598e3,
|
---|
344 | phi = acos(sin(s.dec) * sin(m.dec) + cos(s.dec) * cos(m.dec) * cos(s.ra - m.ra)),
|
---|
345 | inc = atan(sdist * sin(phi), m.dist - sdist * cos(phi)),
|
---|
346 | angle = atan(cos(s.dec) * sin(s.ra - m.ra), sin(s.dec) * cos(m.dec) - cos(s.dec) * sin(m.dec) * cos(s.ra - m.ra));
|
---|
347 | return {
|
---|
348 | fraction: (1 + cos(inc)) / 2,
|
---|
349 | phase: .5 + .5 * inc * (angle < 0 ? -1 : 1) / Math.PI,
|
---|
350 | angle: angle
|
---|
351 | }
|
---|
352 | };
|
---|
353 |
|
---|
354 | function hoursLater(date, h) {
|
---|
355 | return new Date(date.valueOf() + h * dayMs / 24)
|
---|
356 | }
|
---|
357 | SunCalc.getMoonTimes = function (date, lat, lng, inUTC) {
|
---|
358 | var t = new Date(date);
|
---|
359 | if (inUTC)
|
---|
360 | t.setUTCHours(0, 0, 0, 0);
|
---|
361 | else
|
---|
362 | t.setHours(0, 0, 0, 0);
|
---|
363 | var hc = .133 * rad,
|
---|
364 | h0 = SunCalc.getMoonPosition(t, lat, lng).altitude - hc,
|
---|
365 | h1, h2, rise, set, a, b, xe, ye, d, roots, x1, x2, dx;
|
---|
366 | for (var i = 1; i <= 24; i += 2) {
|
---|
367 | h1 = SunCalc.getMoonPosition(hoursLater(t, i), lat, lng).altitude - hc;
|
---|
368 | h2 = SunCalc.getMoonPosition(hoursLater(t, i + 1), lat, lng).altitude - hc;
|
---|
369 | a = (h0 + h2) / 2 - h1;
|
---|
370 | b = (h2 - h0) / 2;
|
---|
371 | xe = -b / (2 * a);
|
---|
372 | ye = (a * xe + b) * xe + h1;
|
---|
373 | d = b * b - 4 * a * h1;
|
---|
374 | roots = 0;
|
---|
375 | if (d >= 0) {
|
---|
376 | dx = Math.sqrt(d) / (Math.abs(a) * 2);
|
---|
377 | x1 = xe - dx;
|
---|
378 | x2 = xe + dx;
|
---|
379 | if (Math.abs(x1) <= 1)
|
---|
380 | roots++;
|
---|
381 | if (Math.abs(x2) <= 1)
|
---|
382 | roots++;
|
---|
383 | if (x1 < -1)
|
---|
384 | x1 = x2
|
---|
385 | }
|
---|
386 | if (roots === 1) {
|
---|
387 | if (h0 < 0)
|
---|
388 | rise = i + x1;
|
---|
389 | else
|
---|
390 | set = i + x1
|
---|
391 | } else if (roots === 2) {
|
---|
392 | rise = i + (ye < 0 ? x2 : x1);
|
---|
393 | set = i + (ye < 0 ? x1 : x2)
|
---|
394 | }
|
---|
395 | if (rise && set)
|
---|
396 | break;
|
---|
397 | h0 = h2
|
---|
398 | }
|
---|
399 | var result = {};
|
---|
400 | if (rise)
|
---|
401 | result.rise = hoursLater(t, rise);
|
---|
402 | if (set)
|
---|
403 | result.set = hoursLater(t, set);
|
---|
404 | if (!rise && !set)
|
---|
405 | result[ye > 0 ? "alwaysUp" : "alwaysDown"] = true;
|
---|
406 | return result
|
---|
407 | };
|
---|
408 | if (typeof exports === "object" && typeof module !== "undefined")
|
---|
409 | module.exports = SunCalc;
|
---|
410 | else if (typeof define === "function" && define.amd)
|
---|
411 | define(SunCalc);
|
---|
412 | else
|
---|
413 | window.SunCalc = SunCalc
|
---|
414 | })()
|
---|
415 | }, {}],
|
---|
416 | "i18next-client": [function (require, module, exports) {
|
---|
417 | (function (root) {
|
---|
418 | if (!Array.prototype.indexOf) {
|
---|
419 | Array.prototype.indexOf = function (searchElement) {
|
---|
420 | "use strict";
|
---|
421 | if (this == null) {
|
---|
422 | throw new TypeError
|
---|
423 | }
|
---|
424 | var t = Object(this);
|
---|
425 | var len = t.length >>> 0;
|
---|
426 | if (len === 0) {
|
---|
427 | return -1
|
---|
428 | }
|
---|
429 | var n = 0;
|
---|
430 | if (arguments.length > 0) {
|
---|
431 | n = Number(arguments[1]);
|
---|
432 | if (n != n) {
|
---|
433 | n = 0
|
---|
434 | } else if (n != 0 && n != Infinity && n != -Infinity) {
|
---|
435 | n = (n > 0 || -1) * Math.floor(Math.abs(n))
|
---|
436 | }
|
---|
437 | }
|
---|
438 | if (n >= len) {
|
---|
439 | return -1
|
---|
440 | }
|
---|
441 | var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
|
---|
442 | for (; k < len; k++) {
|
---|
443 | if (k in t && t[k] === searchElement) {
|
---|
444 | return k
|
---|
445 | }
|
---|
446 | }
|
---|
447 | return -1
|
---|
448 | }
|
---|
449 | }
|
---|
450 | if (!Array.prototype.lastIndexOf) {
|
---|
451 | Array.prototype.lastIndexOf = function (searchElement) {
|
---|
452 | "use strict";
|
---|
453 | if (this == null) {
|
---|
454 | throw new TypeError
|
---|
455 | }
|
---|
456 | var t = Object(this);
|
---|
457 | var len = t.length >>> 0;
|
---|
458 | if (len === 0) {
|
---|
459 | return -1
|
---|
460 | }
|
---|
461 | var n = len;
|
---|
462 | if (arguments.length > 1) {
|
---|
463 | n = Number(arguments[1]);
|
---|
464 | if (n != n) {
|
---|
465 | n = 0
|
---|
466 | } else if (n != 0 && n != 1 / 0 && n != -(1 / 0)) {
|
---|
467 | n = (n > 0 || -1) * Math.floor(Math.abs(n))
|
---|
468 | }
|
---|
469 | }
|
---|
470 | var k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);
|
---|
471 | for (; k >= 0; k--) {
|
---|
472 | if (k in t && t[k] === searchElement) {
|
---|
473 | return k
|
---|
474 | }
|
---|
475 | }
|
---|
476 | return -1
|
---|
477 | }
|
---|
478 | }
|
---|
479 | if (typeof String.prototype.trim !== "function") {
|
---|
480 | String.prototype.trim = function () {
|
---|
481 | return this.replace(/^\s+|\s+$/g, "")
|
---|
482 | }
|
---|
483 | }
|
---|
484 | var $ = root.jQuery || root.Zepto,
|
---|
485 | i18n = {},
|
---|
486 | resStore = {},
|
---|
487 | currentLng, replacementCounter = 0,
|
---|
488 | languages = [],
|
---|
489 | initialized = false,
|
---|
490 | sync = {},
|
---|
491 | conflictReference = null;
|
---|
492 | if (typeof module !== "undefined" && module.exports) {
|
---|
493 | module.exports = i18n
|
---|
494 | } else {
|
---|
495 | if ($) {
|
---|
496 | $.i18n = $.i18n || i18n
|
---|
497 | }
|
---|
498 | if (root.i18n) {
|
---|
499 | conflictReference = root.i18n
|
---|
500 | }
|
---|
501 | root.i18n = i18n
|
---|
502 | }
|
---|
503 | sync = {
|
---|
504 | load: function (lngs, options, cb) {
|
---|
505 | if (options.useLocalStorage) {
|
---|
506 | sync._loadLocal(lngs, options, function (err, store) {
|
---|
507 | var missingLngs = [];
|
---|
508 | for (var i = 0, len = lngs.length; i < len; i++) {
|
---|
509 | if (!store[lngs[i]])
|
---|
510 | missingLngs.push(lngs[i])
|
---|
511 | }
|
---|
512 | if (missingLngs.length > 0) {
|
---|
513 | sync._fetch(missingLngs, options, function (err, fetched) {
|
---|
514 | f.extend(store, fetched);
|
---|
515 | sync._storeLocal(fetched);
|
---|
516 | cb(err, store)
|
---|
517 | })
|
---|
518 | } else {
|
---|
519 | cb(err, store)
|
---|
520 | }
|
---|
521 | })
|
---|
522 | } else {
|
---|
523 | sync._fetch(lngs, options, function (err, store) {
|
---|
524 | cb(err, store)
|
---|
525 | })
|
---|
526 | }
|
---|
527 | },
|
---|
528 | _loadLocal: function (lngs, options, cb) {
|
---|
529 | var store = {},
|
---|
530 | nowMS = (new Date).getTime();
|
---|
531 | if (window.localStorage) {
|
---|
532 | var todo = lngs.length;
|
---|
533 | f.each(lngs, function (key, lng) {
|
---|
534 | var local = f.localStorage.getItem("res_" + lng);
|
---|
535 | if (local) {
|
---|
536 | local = JSON.parse(local);
|
---|
537 | if (local.i18nStamp && local.i18nStamp + options.localStorageExpirationTime > nowMS) {
|
---|
538 | store[lng] = local
|
---|
539 | }
|
---|
540 | }
|
---|
541 | todo--;
|
---|
542 | if (todo === 0)
|
---|
543 | cb(null, store)
|
---|
544 | })
|
---|
545 | }
|
---|
546 | },
|
---|
547 | _storeLocal: function (store) {
|
---|
548 | if (window.localStorage) {
|
---|
549 | for (var m in store) {
|
---|
550 | store[m].i18nStamp = (new Date).getTime();
|
---|
551 | f.localStorage.setItem("res_" + m, JSON.stringify(store[m]))
|
---|
552 | }
|
---|
553 | }
|
---|
554 | return
|
---|
555 | },
|
---|
556 | _fetch: function (lngs, options, cb) {
|
---|
557 | var ns = options.ns,
|
---|
558 | store = {};
|
---|
559 | if (!options.dynamicLoad) {
|
---|
560 | var todo = ns.namespaces.length * lngs.length,
|
---|
561 | errors;
|
---|
562 | f.each(ns.namespaces, function (nsIndex, nsValue) {
|
---|
563 | f.each(lngs, function (lngIndex, lngValue) {
|
---|
564 | var loadComplete = function (err, data) {
|
---|
565 | if (err) {
|
---|
566 | errors = errors || [];
|
---|
567 | errors.push(err)
|
---|
568 | }
|
---|
569 | store[lngValue] = store[lngValue] || {};
|
---|
570 | store[lngValue][nsValue] = data;
|
---|
571 | todo--;
|
---|
572 | if (todo === 0)
|
---|
573 | cb(errors, store)
|
---|
574 | };
|
---|
575 | if (typeof options.customLoad == "function") {
|
---|
576 | options.customLoad(lngValue, nsValue, options, loadComplete)
|
---|
577 | } else {
|
---|
578 | sync._fetchOne(lngValue, nsValue, options, loadComplete)
|
---|
579 | }
|
---|
580 | })
|
---|
581 | })
|
---|
582 | } else {
|
---|
583 | var loadComplete = function (err, data) {
|
---|
584 | cb(err, data)
|
---|
585 | };
|
---|
586 | if (typeof options.customLoad == "function") {
|
---|
587 | options.customLoad(lngs, ns.namespaces, options, loadComplete)
|
---|
588 | } else {
|
---|
589 | var url = applyReplacement(options.resGetPath, {
|
---|
590 | lng: lngs.join("+"),
|
---|
591 | ns: ns.namespaces.join("+")
|
---|
592 | });
|
---|
593 | f.ajax({
|
---|
594 | url: url,
|
---|
595 | cache: options.cache,
|
---|
596 | success: function (data, status, xhr) {
|
---|
597 | f.log("loaded: " + url);
|
---|
598 | loadComplete(null, data)
|
---|
599 | },
|
---|
600 | error: function (xhr, status, error) {
|
---|
601 | f.log("failed loading: " + url);
|
---|
602 | loadComplete("failed loading resource.json error: " + error)
|
---|
603 | },
|
---|
604 | dataType: "json",
|
---|
605 | async: options.getAsync,
|
---|
606 | timeout: options.ajaxTimeout
|
---|
607 | })
|
---|
608 | }
|
---|
609 | }
|
---|
610 | },
|
---|
611 | _fetchOne: function (lng, ns, options, done) {
|
---|
612 | var url = applyReplacement(options.resGetPath, {
|
---|
613 | lng: lng,
|
---|
614 | ns: ns
|
---|
615 | });
|
---|
616 | f.ajax({
|
---|
617 | url: url,
|
---|
618 | cache: options.cache,
|
---|
619 | success: function (data, status, xhr) {
|
---|
620 | f.log("loaded: " + url);
|
---|
621 | done(null, data)
|
---|
622 | },
|
---|
623 | error: function (xhr, status, error) {
|
---|
624 | if (status && status == 200 || xhr && xhr.status && xhr.status == 200) {
|
---|
625 | f.error("There is a typo in: " + url)
|
---|
626 | } else if (status && status == 404 || xhr && xhr.status && xhr.status == 404) {
|
---|
627 | f.log("Does not exist: " + url)
|
---|
628 | } else {
|
---|
629 | var theStatus = status ? status : xhr && xhr.status ? xhr.status : null;
|
---|
630 | f.log(theStatus + " when loading " + url)
|
---|
631 | }
|
---|
632 | done(error, {})
|
---|
633 | },
|
---|
634 | dataType: "json",
|
---|
635 | async: options.getAsync,
|
---|
636 | timeout: options.ajaxTimeout,
|
---|
637 | headers: options.headers
|
---|
638 | })
|
---|
639 | },
|
---|
640 | postMissing: function (lng, ns, key, defaultValue, lngs) {
|
---|
641 | var payload = {};
|
---|
642 | payload[key] = defaultValue;
|
---|
643 | var urls = [];
|
---|
644 | if (o.sendMissingTo === "fallback" && o.fallbackLng[0] !== false) {
|
---|
645 | for (var i = 0; i < o.fallbackLng.length; i++) {
|
---|
646 | urls.push({
|
---|
647 | lng: o.fallbackLng[i],
|
---|
648 | url: applyReplacement(o.resPostPath, {
|
---|
649 | lng: o.fallbackLng[i],
|
---|
650 | ns: ns
|
---|
651 | })
|
---|
652 | })
|
---|
653 | }
|
---|
654 | } else if (o.sendMissingTo === "current" || o.sendMissingTo === "fallback" && o.fallbackLng[0] === false) {
|
---|
655 | urls.push({
|
---|
656 | lng: lng,
|
---|
657 | url: applyReplacement(o.resPostPath, {
|
---|
658 | lng: lng,
|
---|
659 | ns: ns
|
---|
660 | })
|
---|
661 | })
|
---|
662 | } else if (o.sendMissingTo === "all") {
|
---|
663 | for (var i = 0, l = lngs.length; i < l; i++) {
|
---|
664 | urls.push({
|
---|
665 | lng: lngs[i],
|
---|
666 | url: applyReplacement(o.resPostPath, {
|
---|
667 | lng: lngs[i],
|
---|
668 | ns: ns
|
---|
669 | })
|
---|
670 | })
|
---|
671 | }
|
---|
672 | }
|
---|
673 | for (var y = 0, len = urls.length; y < len; y++) {
|
---|
674 | var item = urls[y];
|
---|
675 | f.ajax({
|
---|
676 | url: item.url,
|
---|
677 | type: o.sendType,
|
---|
678 | data: payload,
|
---|
679 | success: function (data, status, xhr) {
|
---|
680 | f.log("posted missing key '" + key + "' to: " + item.url);
|
---|
681 | var keys = key.split(".");
|
---|
682 | var x = 0;
|
---|
683 | var value = resStore[item.lng][ns];
|
---|
684 | while (keys[x]) {
|
---|
685 | if (x === keys.length - 1) {
|
---|
686 | value = value[keys[x]] = defaultValue
|
---|
687 | } else {
|
---|
688 | value = value[keys[x]] = value[keys[x]] || {}
|
---|
689 | }
|
---|
690 | x++
|
---|
691 | }
|
---|
692 | },
|
---|
693 | error: function (xhr, status, error) {
|
---|
694 | f.log("failed posting missing key '" + key + "' to: " + item.url)
|
---|
695 | },
|
---|
696 | dataType: "json",
|
---|
697 | async: o.postAsync,
|
---|
698 | timeout: o.ajaxTimeout
|
---|
699 | })
|
---|
700 | }
|
---|
701 | },
|
---|
702 | reload: reload
|
---|
703 | };
|
---|
704 | var o = {
|
---|
705 | lng: undefined,
|
---|
706 | load: "all",
|
---|
707 | preload: [],
|
---|
708 | lowerCaseLng: false,
|
---|
709 | returnObjectTrees: false,
|
---|
710 | fallbackLng: ["dev"],
|
---|
711 | fallbackNS: [],
|
---|
712 | detectLngQS: "setLng",
|
---|
713 | detectLngFromLocalStorage: false,
|
---|
714 | ns: {
|
---|
715 | namespaces: ["translation"],
|
---|
716 | defaultNs: "translation"
|
---|
717 | },
|
---|
718 | fallbackOnNull: true,
|
---|
719 | fallbackOnEmpty: false,
|
---|
720 | fallbackToDefaultNS: false,
|
---|
721 | showKeyIfEmpty: false,
|
---|
722 | nsseparator: ":",
|
---|
723 | keyseparator: ".",
|
---|
724 | selectorAttr: "data-i18n",
|
---|
725 | debug: false,
|
---|
726 | resGetPath: "locales/__lng__/__ns__.json",
|
---|
727 | resPostPath: "locales/add/__lng__/__ns__",
|
---|
728 | getAsync: true,
|
---|
729 | postAsync: true,
|
---|
730 | resStore: undefined,
|
---|
731 | useLocalStorage: false,
|
---|
732 | localStorageExpirationTime: 7 * 24 * 60 * 60 * 1e3,
|
---|
733 | dynamicLoad: false,
|
---|
734 | sendMissing: false,
|
---|
735 | sendMissingTo: "fallback",
|
---|
736 | sendType: "POST",
|
---|
737 | interpolationPrefix: "__",
|
---|
738 | interpolationSuffix: "__",
|
---|
739 | defaultVariables: false,
|
---|
740 | reusePrefix: "$t(",
|
---|
741 | reuseSuffix: ")",
|
---|
742 | pluralSuffix: "_plural",
|
---|
743 | pluralNotFound: ["plural_not_found", Math.random()].join(""),
|
---|
744 | contextNotFound: ["context_not_found", Math.random()].join(""),
|
---|
745 | escapeInterpolation: false,
|
---|
746 | indefiniteSuffix: "_indefinite",
|
---|
747 | indefiniteNotFound: ["indefinite_not_found", Math.random()].join(""),
|
---|
748 | setJqueryExt: true,
|
---|
749 | defaultValueFromContent: true,
|
---|
750 | useDataAttrOptions: false,
|
---|
751 | cookieExpirationTime: undefined,
|
---|
752 | useCookie: true,
|
---|
753 | cookieName: "i18next",
|
---|
754 | cookieDomain: undefined,
|
---|
755 | objectTreeKeyHandler: undefined,
|
---|
756 | postProcess: undefined,
|
---|
757 | parseMissingKey: undefined,
|
---|
758 | missingKeyHandler: sync.postMissing,
|
---|
759 | ajaxTimeout: 0,
|
---|
760 | shortcutFunction: "sprintf"
|
---|
761 | };
|
---|
762 |
|
---|
763 | function _extend(target, source) {
|
---|
764 | if (!source || typeof source === "function") {
|
---|
765 | return target
|
---|
766 | }
|
---|
767 | for (var attr in source) {
|
---|
768 | target[attr] = source[attr]
|
---|
769 | }
|
---|
770 | return target
|
---|
771 | }
|
---|
772 |
|
---|
773 | function _deepExtend(target, source, overwrite) {
|
---|
774 | for (var prop in source)
|
---|
775 | if (prop in target) {
|
---|
776 | if (typeof target[prop] === "string" || target[prop] instanceof String || typeof source[prop] === "string" || source[prop] instanceof String) {
|
---|
777 | if (overwrite) {
|
---|
778 | target[prop] = source[prop]
|
---|
779 | }
|
---|
780 | } else {
|
---|
781 | _deepExtend(target[prop], source[prop], overwrite)
|
---|
782 | }
|
---|
783 | } else {
|
---|
784 | target[prop] = source[prop]
|
---|
785 | }
|
---|
786 | return target
|
---|
787 | }
|
---|
788 |
|
---|
789 | function _each(object, callback, args) {
|
---|
790 | var name, i = 0,
|
---|
791 | length = object.length,
|
---|
792 | isObj = length === undefined || Object.prototype.toString.apply(object) !== "[object Array]" || typeof object === "function";
|
---|
793 | if (args) {
|
---|
794 | if (isObj) {
|
---|
795 | for (name in object) {
|
---|
796 | if (callback.apply(object[name], args) === false) {
|
---|
797 | break
|
---|
798 | }
|
---|
799 | }
|
---|
800 | } else {
|
---|
801 | for (; i < length; ) {
|
---|
802 | if (callback.apply(object[i++], args) === false) {
|
---|
803 | break
|
---|
804 | }
|
---|
805 | }
|
---|
806 | }
|
---|
807 | } else {
|
---|
808 | if (isObj) {
|
---|
809 | for (name in object) {
|
---|
810 | if (callback.call(object[name], name, object[name]) === false) {
|
---|
811 | break
|
---|
812 | }
|
---|
813 | }
|
---|
814 | } else {
|
---|
815 | for (; i < length; ) {
|
---|
816 | if (callback.call(object[i], i, object[i++]) === false) {
|
---|
817 | break
|
---|
818 | }
|
---|
819 | }
|
---|
820 | }
|
---|
821 | }
|
---|
822 | return object
|
---|
823 | }
|
---|
824 | var _entityMap = {
|
---|
825 | "&": "&",
|
---|
826 | "<": "<",
|
---|
827 | ">": ">",
|
---|
828 | '"': """,
|
---|
829 | "'": "'",
|
---|
830 | "/": "/"
|
---|
831 | };
|
---|
832 |
|
---|
833 | function _escape(data) {
|
---|
834 | if (typeof data === "string") {
|
---|
835 | return data.replace(/[&<>"'\/]/g, function (s) {
|
---|
836 | return _entityMap[s]
|
---|
837 | })
|
---|
838 | } else {
|
---|
839 | return data
|
---|
840 | }
|
---|
841 | }
|
---|
842 |
|
---|
843 | function _ajax(options) { // v0.5.0 of https://github.com/goloroden/http.js
|
---|
844 | var getXhr = function (callback) {
|
---|
845 | if (window.XMLHttpRequest) {
|
---|
846 | return callback(null, new XMLHttpRequest)
|
---|
847 | } else if (window.ActiveXObject) {
|
---|
848 | try {
|
---|
849 | return callback(null, new ActiveXObject("Msxml2.XMLHTTP"))
|
---|
850 | } catch (e) {
|
---|
851 | return callback(null, new ActiveXObject("Microsoft.XMLHTTP"))
|
---|
852 | }
|
---|
853 | }
|
---|
854 | return callback(new Error)
|
---|
855 | };
|
---|
856 | var encodeUsingUrlEncoding = function (data) {
|
---|
857 | if (typeof data === "string") {
|
---|
858 | return data
|
---|
859 | }
|
---|
860 | var result = [];
|
---|
861 | for (var dataItem in data) {
|
---|
862 | if (data.hasOwnProperty(dataItem)) {
|
---|
863 | result.push(encodeURIComponent(dataItem) + "=" + encodeURIComponent(data[dataItem]))
|
---|
864 | }
|
---|
865 | }
|
---|
866 | return result.join("&")
|
---|
867 | };
|
---|
868 | var utf8 = function (text) {
|
---|
869 | text = text.replace(/\r\n/g, "\n");
|
---|
870 | var result = "";
|
---|
871 | for (var i = 0; i < text.length; i++) {
|
---|
872 | var c = text.charCodeAt(i);
|
---|
873 | if (c < 128) {
|
---|
874 | result += String.fromCharCode(c)
|
---|
875 | } else if (c > 127 && c < 2048) {
|
---|
876 | result += String.fromCharCode(c >> 6 | 192);
|
---|
877 | result += String.fromCharCode(c & 63 | 128)
|
---|
878 | } else {
|
---|
879 | result += String.fromCharCode(c >> 12 | 224);
|
---|
880 | result += String.fromCharCode(c >> 6 & 63 | 128);
|
---|
881 | result += String.fromCharCode(c & 63 | 128)
|
---|
882 | }
|
---|
883 | }
|
---|
884 | return result
|
---|
885 | };
|
---|
886 | var base64 = function (text) {
|
---|
887 | var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
---|
888 | text = utf8(text);
|
---|
889 | var result = "",
|
---|
890 | chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0;
|
---|
891 | do {
|
---|
892 | chr1 = text.charCodeAt(i++);
|
---|
893 | chr2 = text.charCodeAt(i++);
|
---|
894 | chr3 = text.charCodeAt(i++);
|
---|
895 | enc1 = chr1 >> 2;
|
---|
896 | enc2 = (chr1 & 3) << 4 | chr2 >> 4;
|
---|
897 | enc3 = (chr2 & 15) << 2 | chr3 >> 6;
|
---|
898 | enc4 = chr3 & 63;
|
---|
899 | if (isNaN(chr2)) {
|
---|
900 | enc3 = enc4 = 64
|
---|
901 | } else if (isNaN(chr3)) {
|
---|
902 | enc4 = 64
|
---|
903 | }
|
---|
904 | result += keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
---|
905 | chr1 = chr2 = chr3 = "";
|
---|
906 | enc1 = enc2 = enc3 = enc4 = ""
|
---|
907 | } while (i < text.length);
|
---|
908 | return result
|
---|
909 | };
|
---|
910 | var mergeHeaders = function () {
|
---|
911 | var result = arguments[0];
|
---|
912 | for (var i = 1; i < arguments.length; i++) {
|
---|
913 | var currentHeaders = arguments[i];
|
---|
914 | for (var header in currentHeaders) {
|
---|
915 | if (currentHeaders.hasOwnProperty(header)) {
|
---|
916 | result[header] = currentHeaders[header]
|
---|
917 | }
|
---|
918 | }
|
---|
919 | }
|
---|
920 | return result
|
---|
921 | };
|
---|
922 | var ajax = function (method, url, options, callback) {
|
---|
923 | if (typeof options === "function") {
|
---|
924 | callback = options;
|
---|
925 | options = {}
|
---|
926 | }
|
---|
927 | options.cache = options.cache || false;
|
---|
928 | options.data = options.data || {};
|
---|
929 | options.headers = options.headers || {};
|
---|
930 | options.jsonp = options.jsonp || false;
|
---|
931 | options.async = options.async === undefined ? true : options.async;
|
---|
932 | var headers = mergeHeaders({
|
---|
933 | accept: "*/*",
|
---|
934 | "content-type": "application/x-www-form-urlencoded;charset=UTF-8"
|
---|
935 | }, ajax.headers, options.headers);
|
---|
936 | var payload;
|
---|
937 | if (headers["content-type"] === "application/json") {
|
---|
938 | payload = JSON.stringify(options.data)
|
---|
939 | } else {
|
---|
940 | payload = encodeUsingUrlEncoding(options.data)
|
---|
941 | }
|
---|
942 | if (method === "GET") {
|
---|
943 | var queryString = [];
|
---|
944 | if (payload) {
|
---|
945 | queryString.push(payload);
|
---|
946 | payload = null
|
---|
947 | }
|
---|
948 | if (!options.cache) {
|
---|
949 | queryString.push("_=" + (new Date).getTime())
|
---|
950 | }
|
---|
951 | if (options.jsonp) {
|
---|
952 | queryString.push("callback=" + options.jsonp);
|
---|
953 | queryString.push("jsonp=" + options.jsonp)
|
---|
954 | }
|
---|
955 | queryString = queryString.join("&");
|
---|
956 | if (queryString.length > 1) {
|
---|
957 | if (url.indexOf("?") > -1) {
|
---|
958 | url += "&" + queryString
|
---|
959 | } else {
|
---|
960 | url += "?" + queryString
|
---|
961 | }
|
---|
962 | }
|
---|
963 | if (options.jsonp) {
|
---|
964 | var head = document.getElementsByTagName("head")[0];
|
---|
965 | var script = document.createElement("script");
|
---|
966 | script.type = "text/javascript";
|
---|
967 | script.src = url;
|
---|
968 | head.appendChild(script);
|
---|
969 | return
|
---|
970 | }
|
---|
971 | }
|
---|
972 | getXhr(function (err, xhr) {
|
---|
973 | if (err)
|
---|
974 | return callback(err);
|
---|
975 | xhr.open(method, url, options.async);
|
---|
976 | for (var header in headers) {
|
---|
977 | if (headers.hasOwnProperty(header)) {
|
---|
978 | xhr.setRequestHeader(header, headers[header])
|
---|
979 | }
|
---|
980 | }
|
---|
981 | xhr.onreadystatechange = function () {
|
---|
982 | if (xhr.readyState === 4) {
|
---|
983 | var data = xhr.responseText || "";
|
---|
984 | if (!callback) {
|
---|
985 | return
|
---|
986 | }
|
---|
987 | callback(xhr.status, {
|
---|
988 | text: function () {
|
---|
989 | return data
|
---|
990 | },
|
---|
991 | json: function () {
|
---|
992 | try {
|
---|
993 | return JSON.parse(data)
|
---|
994 | } catch (e) {
|
---|
995 | f.error("Can not parse JSON. URL: " + url);
|
---|
996 | return {}
|
---|
997 | }
|
---|
998 | }
|
---|
999 | })
|
---|
1000 | }
|
---|
1001 | };
|
---|
1002 | xhr.send(payload)
|
---|
1003 | })
|
---|
1004 | };
|
---|
1005 | var http = {
|
---|
1006 | authBasic: function (username, password) {
|
---|
1007 | ajax.headers["Authorization"] = "Basic " + base64(username + ":" + password)
|
---|
1008 | },
|
---|
1009 | connect: function (url, options, callback) {
|
---|
1010 | return ajax("CONNECT", url, options, callback)
|
---|
1011 | },
|
---|
1012 | del: function (url, options, callback) {
|
---|
1013 | return ajax("DELETE", url, options, callback)
|
---|
1014 | },
|
---|
1015 | get: function (url, options, callback) {
|
---|
1016 | return ajax("GET", url, options, callback)
|
---|
1017 | },
|
---|
1018 | head: function (url, options, callback) {
|
---|
1019 | return ajax("HEAD", url, options, callback)
|
---|
1020 | },
|
---|
1021 | headers: function (headers) {
|
---|
1022 | ajax.headers = headers || {}
|
---|
1023 | },
|
---|
1024 | isAllowed: function (url, verb, callback) {
|
---|
1025 | this.options(url, function (status, data) {
|
---|
1026 | callback(data.text().indexOf(verb) !== -1)
|
---|
1027 | })
|
---|
1028 | },
|
---|
1029 | options: function (url, options, callback) {
|
---|
1030 | return ajax("OPTIONS", url, options, callback)
|
---|
1031 | },
|
---|
1032 | patch: function (url, options, callback) {
|
---|
1033 | return ajax("PATCH", url, options, callback)
|
---|
1034 | },
|
---|
1035 | post: function (url, options, callback) {
|
---|
1036 | return ajax("POST", url, options, callback)
|
---|
1037 | },
|
---|
1038 | put: function (url, options, callback) {
|
---|
1039 | return ajax("PUT", url, options, callback)
|
---|
1040 | },
|
---|
1041 | trace: function (url, options, callback) {
|
---|
1042 | return ajax("TRACE", url, options, callback)
|
---|
1043 | }
|
---|
1044 | };
|
---|
1045 | var methode = options.type ? options.type.toLowerCase() : "get";
|
---|
1046 | http[methode](options.url, options, function (status, data) {
|
---|
1047 | if (status === 200 || status === 0 && data.text()) {
|
---|
1048 | options.success(data.json(), status, null)
|
---|
1049 | } else {
|
---|
1050 | options.error(data.text(), status, null)
|
---|
1051 | }
|
---|
1052 | })
|
---|
1053 | }
|
---|
1054 | var _cookie = {
|
---|
1055 | create: function (name, value, minutes, domain) {
|
---|
1056 | var expires;
|
---|
1057 | if (minutes) {
|
---|
1058 | var date = new Date;
|
---|
1059 | date.setTime(date.getTime() + minutes * 60 * 1e3);
|
---|
1060 | expires = "; expires=" + date.toGMTString()
|
---|
1061 | } else
|
---|
1062 | expires = "";
|
---|
1063 | domain = domain ? "domain=" + domain + ";" : "";
|
---|
1064 | document.cookie = name + "=" + value + expires + ";" + domain + "path=/"
|
---|
1065 | },
|
---|
1066 | read: function (name) {
|
---|
1067 | var nameEQ = name + "=";
|
---|
1068 | var ca = document.cookie.split(";");
|
---|
1069 | for (var i = 0; i < ca.length; i++) {
|
---|
1070 | var c = ca[i];
|
---|
1071 | while (c.charAt(0) == " ")
|
---|
1072 | c = c.substring(1, c.length);
|
---|
1073 | if (c.indexOf(nameEQ) === 0)
|
---|
1074 | return c.substring(nameEQ.length, c.length)
|
---|
1075 | }
|
---|
1076 | return null
|
---|
1077 | },
|
---|
1078 | remove: function (name) {
|
---|
1079 | this.create(name, "", -1)
|
---|
1080 | }
|
---|
1081 | };
|
---|
1082 | var cookie_noop = {
|
---|
1083 | create: function (name, value, minutes, domain) {},
|
---|
1084 | read: function (name) {
|
---|
1085 | return null
|
---|
1086 | },
|
---|
1087 | remove: function (name) {}
|
---|
1088 | };
|
---|
1089 | var f = {
|
---|
1090 | extend: $ ? $.extend : _extend,
|
---|
1091 | deepExtend: _deepExtend,
|
---|
1092 | each: $ ? $.each : _each,
|
---|
1093 | ajax: $ ? $.ajax : typeof document !== "undefined" ? _ajax : function () {},
|
---|
1094 | cookie: typeof document !== "undefined" ? _cookie : cookie_noop,
|
---|
1095 | detectLanguage: detectLanguage,
|
---|
1096 | escape: _escape,
|
---|
1097 | log: function (str) {
|
---|
1098 | if (o.debug && typeof console !== "undefined")
|
---|
1099 | console.log(str)
|
---|
1100 | },
|
---|
1101 | error: function (str) {
|
---|
1102 | if (typeof console !== "undefined")
|
---|
1103 | console.error(str)
|
---|
1104 | },
|
---|
1105 | getCountyIndexOfLng: function (lng) {
|
---|
1106 | var lng_index = 0;
|
---|
1107 | if (lng === "nb-NO" || lng === "nn-NO" || lng === "nb-no" || lng === "nn-no")
|
---|
1108 | lng_index = 1;
|
---|
1109 | return lng_index
|
---|
1110 | },
|
---|
1111 | toLanguages: function (lng, fallbackLng) {
|
---|
1112 | var log = this.log;
|
---|
1113 | fallbackLng = fallbackLng || o.fallbackLng;
|
---|
1114 | if (typeof fallbackLng === "string")
|
---|
1115 | fallbackLng = [fallbackLng];
|
---|
1116 |
|
---|
1117 | function applyCase(l) {
|
---|
1118 | var ret = l;
|
---|
1119 | if (typeof l === "string" && l.indexOf("-") > -1) {
|
---|
1120 | var parts = l.split("-");
|
---|
1121 | ret = o.lowerCaseLng ? parts[0].toLowerCase() + "-" + parts[1].toLowerCase() : parts[0].toLowerCase() + "-" + parts[1].toUpperCase()
|
---|
1122 | } else {
|
---|
1123 | ret = o.lowerCaseLng ? l.toLowerCase() : l
|
---|
1124 | }
|
---|
1125 | return ret
|
---|
1126 | }
|
---|
1127 | var languages = [];
|
---|
1128 | var whitelist = o.lngWhitelist || false;
|
---|
1129 | var addLanguage = function (language) {
|
---|
1130 | if (!whitelist || whitelist.indexOf(language) > -1) {
|
---|
1131 | languages.push(language)
|
---|
1132 | } else {
|
---|
1133 | log("rejecting non-whitelisted language: " + language)
|
---|
1134 | }
|
---|
1135 | };
|
---|
1136 | if (typeof lng === "string" && lng.indexOf("-") > -1) {
|
---|
1137 | var parts = lng.split("-");
|
---|
1138 | if (o.load !== "unspecific")
|
---|
1139 | addLanguage(applyCase(lng));
|
---|
1140 | if (o.load !== "current")
|
---|
1141 | addLanguage(applyCase(parts[this.getCountyIndexOfLng(lng)]))
|
---|
1142 | } else {
|
---|
1143 | addLanguage(applyCase(lng))
|
---|
1144 | }
|
---|
1145 | for (var i = 0; i < fallbackLng.length; i++) {
|
---|
1146 | if (languages.indexOf(fallbackLng[i]) === -1 && fallbackLng[i])
|
---|
1147 | languages.push(applyCase(fallbackLng[i]))
|
---|
1148 | }
|
---|
1149 | return languages
|
---|
1150 | },
|
---|
1151 | regexEscape: function (str) {
|
---|
1152 | return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")
|
---|
1153 | },
|
---|
1154 | regexReplacementEscape: function (strOrFn) {
|
---|
1155 | if (typeof strOrFn === "string") {
|
---|
1156 | return strOrFn.replace(/\$/g, "$$$$")
|
---|
1157 | } else {
|
---|
1158 | return strOrFn
|
---|
1159 | }
|
---|
1160 | },
|
---|
1161 | localStorage: {
|
---|
1162 | setItem: function (key, value) {
|
---|
1163 | if (window.localStorage) {
|
---|
1164 | try {
|
---|
1165 | window.localStorage.setItem(key, value)
|
---|
1166 | } catch (e) {
|
---|
1167 | f.log('failed to set value for key "' + key + '" to localStorage.')
|
---|
1168 | }
|
---|
1169 | }
|
---|
1170 | },
|
---|
1171 | getItem: function (key, value) {
|
---|
1172 | if (window.localStorage) {
|
---|
1173 | try {
|
---|
1174 | return window.localStorage.getItem(key, value)
|
---|
1175 | } catch (e) {
|
---|
1176 | f.log('failed to get value for key "' + key + '" from localStorage.');
|
---|
1177 | return undefined
|
---|
1178 | }
|
---|
1179 | }
|
---|
1180 | }
|
---|
1181 | }
|
---|
1182 | };
|
---|
1183 |
|
---|
1184 | function init(options, cb) {
|
---|
1185 | if (typeof options === "function") {
|
---|
1186 | cb = options;
|
---|
1187 | options = {}
|
---|
1188 | }
|
---|
1189 | options = options || {};
|
---|
1190 | f.extend(o, options);
|
---|
1191 | delete o.fixLng;
|
---|
1192 | if (o.functions) {
|
---|
1193 | delete o.functions;
|
---|
1194 | f.extend(f, options.functions)
|
---|
1195 | }
|
---|
1196 | if (typeof o.ns == "string") {
|
---|
1197 | o.ns = {
|
---|
1198 | namespaces: [o.ns],
|
---|
1199 | defaultNs: o.ns
|
---|
1200 | }
|
---|
1201 | }
|
---|
1202 | if (typeof o.fallbackNS == "string") {
|
---|
1203 | o.fallbackNS = [o.fallbackNS]
|
---|
1204 | }
|
---|
1205 | if (typeof o.fallbackLng == "string" || typeof o.fallbackLng == "boolean") {
|
---|
1206 | o.fallbackLng = [o.fallbackLng]
|
---|
1207 | }
|
---|
1208 | o.interpolationPrefixEscaped = f.regexEscape(o.interpolationPrefix);
|
---|
1209 | o.interpolationSuffixEscaped = f.regexEscape(o.interpolationSuffix);
|
---|
1210 | if (!o.lng)
|
---|
1211 | o.lng = f.detectLanguage();
|
---|
1212 | languages = f.toLanguages(o.lng);
|
---|
1213 | currentLng = languages[0];
|
---|
1214 | f.log("currentLng set to: " + currentLng);
|
---|
1215 | if (o.useCookie && f.cookie.read(o.cookieName) !== currentLng) {
|
---|
1216 | f.cookie.create(o.cookieName, currentLng, o.cookieExpirationTime, o.cookieDomain)
|
---|
1217 | }
|
---|
1218 | if (o.detectLngFromLocalStorage && typeof document !== "undefined" && window.localStorage) {
|
---|
1219 | f.localStorage.setItem("i18next_lng", currentLng)
|
---|
1220 | }
|
---|
1221 | var lngTranslate = translate;
|
---|
1222 | if (options.fixLng) {
|
---|
1223 | lngTranslate = function (key, options) {
|
---|
1224 | options = options || {};
|
---|
1225 | options.lng = options.lng || lngTranslate.lng;
|
---|
1226 | return translate(key, options)
|
---|
1227 | };
|
---|
1228 | lngTranslate.lng = currentLng
|
---|
1229 | }
|
---|
1230 | pluralExtensions.setCurrentLng(currentLng);
|
---|
1231 | if ($ && o.setJqueryExt) {
|
---|
1232 | addJqueryFunct && addJqueryFunct()
|
---|
1233 | } else {
|
---|
1234 | addJqueryLikeFunctionality && addJqueryLikeFunctionality()
|
---|
1235 | }
|
---|
1236 | var deferred;
|
---|
1237 | if ($ && $.Deferred) {
|
---|
1238 | deferred = $.Deferred()
|
---|
1239 | }
|
---|
1240 | if (o.resStore) {
|
---|
1241 | resStore = o.resStore;
|
---|
1242 | initialized = true;
|
---|
1243 | if (cb)
|
---|
1244 | cb(null, lngTranslate);
|
---|
1245 | if (deferred)
|
---|
1246 | deferred.resolve(lngTranslate);
|
---|
1247 | if (deferred)
|
---|
1248 | return deferred.promise();
|
---|
1249 | return
|
---|
1250 | }
|
---|
1251 | var lngsToLoad = f.toLanguages(o.lng);
|
---|
1252 | if (typeof o.preload === "string")
|
---|
1253 | o.preload = [o.preload];
|
---|
1254 | for (var i = 0, l = o.preload.length; i < l; i++) {
|
---|
1255 | var pres = f.toLanguages(o.preload[i]);
|
---|
1256 | for (var y = 0, len = pres.length; y < len; y++) {
|
---|
1257 | if (lngsToLoad.indexOf(pres[y]) < 0) {
|
---|
1258 | lngsToLoad.push(pres[y])
|
---|
1259 | }
|
---|
1260 | }
|
---|
1261 | }
|
---|
1262 | i18n.sync.load(lngsToLoad, o, function (err, store) {
|
---|
1263 | resStore = store;
|
---|
1264 | initialized = true;
|
---|
1265 | if (cb)
|
---|
1266 | cb(err, lngTranslate);
|
---|
1267 | if (deferred)
|
---|
1268 | (!err ? deferred.resolve : deferred.reject)(err || lngTranslate)
|
---|
1269 | });
|
---|
1270 | if (deferred)
|
---|
1271 | return deferred.promise()
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | function isInitialized() {
|
---|
1275 | return initialized
|
---|
1276 | }
|
---|
1277 |
|
---|
1278 | function preload(lngs, cb) {
|
---|
1279 | if (typeof lngs === "string")
|
---|
1280 | lngs = [lngs];
|
---|
1281 | for (var i = 0, l = lngs.length; i < l; i++) {
|
---|
1282 | if (o.preload.indexOf(lngs[i]) < 0) {
|
---|
1283 | o.preload.push(lngs[i])
|
---|
1284 | }
|
---|
1285 | }
|
---|
1286 | return init(cb)
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
---|
1290 | if (typeof ns !== "string") {
|
---|
1291 | resources = ns;
|
---|
1292 | ns = o.ns.defaultNs
|
---|
1293 | } else if (o.ns.namespaces.indexOf(ns) < 0) {
|
---|
1294 | o.ns.namespaces.push(ns)
|
---|
1295 | }
|
---|
1296 | resStore[lng] = resStore[lng] || {};
|
---|
1297 | resStore[lng][ns] = resStore[lng][ns] || {};
|
---|
1298 | if (deep) {
|
---|
1299 | f.deepExtend(resStore[lng][ns], resources, overwrite)
|
---|
1300 | } else {
|
---|
1301 | f.extend(resStore[lng][ns], resources)
|
---|
1302 | }
|
---|
1303 | if (o.useLocalStorage) {
|
---|
1304 | sync._storeLocal(resStore)
|
---|
1305 | }
|
---|
1306 | }
|
---|
1307 |
|
---|
1308 | function hasResourceBundle(lng, ns) {
|
---|
1309 | if (typeof ns !== "string") {
|
---|
1310 | ns = o.ns.defaultNs
|
---|
1311 | }
|
---|
1312 | resStore[lng] = resStore[lng] || {};
|
---|
1313 | var res = resStore[lng][ns] || {};
|
---|
1314 | var hasValues = false;
|
---|
1315 | for (var prop in res) {
|
---|
1316 | if (res.hasOwnProperty(prop)) {
|
---|
1317 | hasValues = true
|
---|
1318 | }
|
---|
1319 | }
|
---|
1320 | return hasValues
|
---|
1321 | }
|
---|
1322 |
|
---|
1323 | function getResourceBundle(lng, ns) {
|
---|
1324 | if (typeof ns !== "string") {
|
---|
1325 | ns = o.ns.defaultNs
|
---|
1326 | }
|
---|
1327 | resStore[lng] = resStore[lng] || {};
|
---|
1328 | return f.extend({}, resStore[lng][ns])
|
---|
1329 | }
|
---|
1330 |
|
---|
1331 | function removeResourceBundle(lng, ns) {
|
---|
1332 | if (typeof ns !== "string") {
|
---|
1333 | ns = o.ns.defaultNs
|
---|
1334 | }
|
---|
1335 | resStore[lng] = resStore[lng] || {};
|
---|
1336 | resStore[lng][ns] = {};
|
---|
1337 | if (o.useLocalStorage) {
|
---|
1338 | sync._storeLocal(resStore)
|
---|
1339 | }
|
---|
1340 | }
|
---|
1341 |
|
---|
1342 | function addResource(lng, ns, key, value) {
|
---|
1343 | if (typeof ns !== "string") {
|
---|
1344 | resource = ns;
|
---|
1345 | ns = o.ns.defaultNs
|
---|
1346 | } else if (o.ns.namespaces.indexOf(ns) < 0) {
|
---|
1347 | o.ns.namespaces.push(ns)
|
---|
1348 | }
|
---|
1349 | resStore[lng] = resStore[lng] || {};
|
---|
1350 | resStore[lng][ns] = resStore[lng][ns] || {};
|
---|
1351 | var keys = key.split(o.keyseparator);
|
---|
1352 | var x = 0;
|
---|
1353 | var node = resStore[lng][ns];
|
---|
1354 | var origRef = node;
|
---|
1355 | while (keys[x]) {
|
---|
1356 | if (x == keys.length - 1)
|
---|
1357 | node[keys[x]] = value;
|
---|
1358 | else {
|
---|
1359 | if (node[keys[x]] == null)
|
---|
1360 | node[keys[x]] = {};
|
---|
1361 | node = node[keys[x]]
|
---|
1362 | }
|
---|
1363 | x++
|
---|
1364 | }
|
---|
1365 | if (o.useLocalStorage) {
|
---|
1366 | sync._storeLocal(resStore)
|
---|
1367 | }
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 | function addResources(lng, ns, resources) {
|
---|
1371 | if (typeof ns !== "string") {
|
---|
1372 | resources = ns;
|
---|
1373 | ns = o.ns.defaultNs
|
---|
1374 | } else if (o.ns.namespaces.indexOf(ns) < 0) {
|
---|
1375 | o.ns.namespaces.push(ns)
|
---|
1376 | }
|
---|
1377 | for (var m in resources) {
|
---|
1378 | if (typeof resources[m] === "string")
|
---|
1379 | addResource(lng, ns, m, resources[m])
|
---|
1380 | }
|
---|
1381 | }
|
---|
1382 |
|
---|
1383 | function setDefaultNamespace(ns) {
|
---|
1384 | o.ns.defaultNs = ns
|
---|
1385 | }
|
---|
1386 |
|
---|
1387 | function loadNamespace(namespace, cb) {
|
---|
1388 | loadNamespaces([namespace], cb)
|
---|
1389 | }
|
---|
1390 |
|
---|
1391 | function loadNamespaces(namespaces, cb) {
|
---|
1392 | var opts = {
|
---|
1393 | dynamicLoad: o.dynamicLoad,
|
---|
1394 | resGetPath: o.resGetPath,
|
---|
1395 | getAsync: o.getAsync,
|
---|
1396 | customLoad: o.customLoad,
|
---|
1397 | ns: {
|
---|
1398 | namespaces: namespaces,
|
---|
1399 | defaultNs: ""
|
---|
1400 | }
|
---|
1401 | };
|
---|
1402 | var lngsToLoad = f.toLanguages(o.lng);
|
---|
1403 | if (typeof o.preload === "string")
|
---|
1404 | o.preload = [o.preload];
|
---|
1405 | for (var i = 0, l = o.preload.length; i < l; i++) {
|
---|
1406 | var pres = f.toLanguages(o.preload[i]);
|
---|
1407 | for (var y = 0, len = pres.length; y < len; y++) {
|
---|
1408 | if (lngsToLoad.indexOf(pres[y]) < 0) {
|
---|
1409 | lngsToLoad.push(pres[y])
|
---|
1410 | }
|
---|
1411 | }
|
---|
1412 | }
|
---|
1413 | var lngNeedLoad = [];
|
---|
1414 | for (var a = 0, lenA = lngsToLoad.length; a < lenA; a++) {
|
---|
1415 | var needLoad = false;
|
---|
1416 | var resSet = resStore[lngsToLoad[a]];
|
---|
1417 | if (resSet) {
|
---|
1418 | for (var b = 0, lenB = namespaces.length; b < lenB; b++) {
|
---|
1419 | if (!resSet[namespaces[b]])
|
---|
1420 | needLoad = true
|
---|
1421 | }
|
---|
1422 | } else {
|
---|
1423 | needLoad = true
|
---|
1424 | }
|
---|
1425 | if (needLoad)
|
---|
1426 | lngNeedLoad.push(lngsToLoad[a])
|
---|
1427 | }
|
---|
1428 | if (lngNeedLoad.length) {
|
---|
1429 | i18n.sync._fetch(lngNeedLoad, opts, function (err, store) {
|
---|
1430 | var todo = namespaces.length * lngNeedLoad.length;
|
---|
1431 | f.each(namespaces, function (nsIndex, nsValue) {
|
---|
1432 | if (o.ns.namespaces.indexOf(nsValue) < 0) {
|
---|
1433 | o.ns.namespaces.push(nsValue)
|
---|
1434 | }
|
---|
1435 | f.each(lngNeedLoad, function (lngIndex, lngValue) {
|
---|
1436 | resStore[lngValue] = resStore[lngValue] || {};
|
---|
1437 | resStore[lngValue][nsValue] = store[lngValue][nsValue];
|
---|
1438 | todo--;
|
---|
1439 | if (todo === 0 && cb) {
|
---|
1440 | if (o.useLocalStorage)
|
---|
1441 | i18n.sync._storeLocal(resStore);
|
---|
1442 | cb()
|
---|
1443 | }
|
---|
1444 | })
|
---|
1445 | })
|
---|
1446 | })
|
---|
1447 | } else {
|
---|
1448 | if (cb)
|
---|
1449 | cb()
|
---|
1450 | }
|
---|
1451 | }
|
---|
1452 |
|
---|
1453 | function setLng(lng, options, cb) {
|
---|
1454 | if (typeof options === "function") {
|
---|
1455 | cb = options;
|
---|
1456 | options = {}
|
---|
1457 | } else if (!options) {
|
---|
1458 | options = {}
|
---|
1459 | }
|
---|
1460 | options.lng = lng;
|
---|
1461 | return init(options, cb)
|
---|
1462 | }
|
---|
1463 |
|
---|
1464 | function lng() {
|
---|
1465 | return currentLng
|
---|
1466 | }
|
---|
1467 |
|
---|
1468 | function dir() {
|
---|
1469 | var rtlLangs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam"];
|
---|
1470 | if (rtlLangs.some(function (lang) {
|
---|
1471 | return new RegExp("^" + lang).test(currentLng)
|
---|
1472 | })) {
|
---|
1473 | return "rtl"
|
---|
1474 | }
|
---|
1475 | return "ltr"
|
---|
1476 | }
|
---|
1477 |
|
---|
1478 | function reload(cb) {
|
---|
1479 | resStore = {};
|
---|
1480 | setLng(currentLng, cb)
|
---|
1481 | }
|
---|
1482 |
|
---|
1483 | function noConflict() {
|
---|
1484 | window.i18next = window.i18n;
|
---|
1485 | if (conflictReference) {
|
---|
1486 | window.i18n = conflictReference
|
---|
1487 | } else {
|
---|
1488 | delete window.i18n
|
---|
1489 | }
|
---|
1490 | }
|
---|
1491 |
|
---|
1492 | function addJqueryFunct() {
|
---|
1493 | $.t = $.t || translate;
|
---|
1494 |
|
---|
1495 | function parse(ele, key, options) {
|
---|
1496 | if (key.length === 0)
|
---|
1497 | return;
|
---|
1498 | var attr = "text";
|
---|
1499 | if (key.indexOf("[") === 0) {
|
---|
1500 | var parts = key.split("]");
|
---|
1501 | key = parts[1];
|
---|
1502 | attr = parts[0].substr(1, parts[0].length - 1)
|
---|
1503 | }
|
---|
1504 | if (key.indexOf(";") === key.length - 1) {
|
---|
1505 | key = key.substr(0, key.length - 2)
|
---|
1506 | }
|
---|
1507 | var optionsToUse;
|
---|
1508 | if (attr === "html") {
|
---|
1509 | optionsToUse = o.defaultValueFromContent ? $.extend({
|
---|
1510 | defaultValue: ele.html()
|
---|
1511 | }, options) : options;
|
---|
1512 | ele.html($.t(key, optionsToUse))
|
---|
1513 | } else if (attr === "text") {
|
---|
1514 | optionsToUse = o.defaultValueFromContent ? $.extend({
|
---|
1515 | defaultValue: ele.text()
|
---|
1516 | }, options) : options;
|
---|
1517 | ele.text($.t(key, optionsToUse))
|
---|
1518 | } else if (attr === "prepend") {
|
---|
1519 | optionsToUse = o.defaultValueFromContent ? $.extend({
|
---|
1520 | defaultValue: ele.html()
|
---|
1521 | }, options) : options;
|
---|
1522 | ele.prepend($.t(key, optionsToUse))
|
---|
1523 | } else if (attr === "append") {
|
---|
1524 | optionsToUse = o.defaultValueFromContent ? $.extend({
|
---|
1525 | defaultValue: ele.html()
|
---|
1526 | }, options) : options;
|
---|
1527 | ele.append($.t(key, optionsToUse))
|
---|
1528 | } else if (attr.indexOf("data-") === 0) {
|
---|
1529 | var dataAttr = attr.substr("data-".length);
|
---|
1530 | optionsToUse = o.defaultValueFromContent ? $.extend({
|
---|
1531 | defaultValue: ele.data(dataAttr)
|
---|
1532 | }, options) : options;
|
---|
1533 | var translated = $.t(key, optionsToUse);
|
---|
1534 | ele.data(dataAttr, translated);
|
---|
1535 | ele.attr(attr, translated)
|
---|
1536 | } else {
|
---|
1537 | optionsToUse = o.defaultValueFromContent ? $.extend({
|
---|
1538 | defaultValue: ele.attr(attr)
|
---|
1539 | }, options) : options;
|
---|
1540 | ele.attr(attr, $.t(key, optionsToUse))
|
---|
1541 | }
|
---|
1542 | }
|
---|
1543 |
|
---|
1544 | function localize(ele, options) {
|
---|
1545 | var key = ele.attr(o.selectorAttr);
|
---|
1546 | if (!key && typeof key !== "undefined" && key !== false)
|
---|
1547 | key = ele.text() || ele.val();
|
---|
1548 | if (!key)
|
---|
1549 | return;
|
---|
1550 | var target = ele,
|
---|
1551 | targetSelector = ele.data("i18n-target");
|
---|
1552 | if (targetSelector) {
|
---|
1553 | target = ele.find(targetSelector) || ele
|
---|
1554 | }
|
---|
1555 | if (!options && o.useDataAttrOptions === true) {
|
---|
1556 | options = ele.data("i18n-options")
|
---|
1557 | }
|
---|
1558 | options = options || {};
|
---|
1559 | if (key.indexOf(";") >= 0) {
|
---|
1560 | var keys = key.split(";");
|
---|
1561 | $.each(keys, function (m, k) {
|
---|
1562 | if (k !== "")
|
---|
1563 | parse(target, k, options)
|
---|
1564 | })
|
---|
1565 | } else {
|
---|
1566 | parse(target, key, options)
|
---|
1567 | }
|
---|
1568 | if (o.useDataAttrOptions === true) {
|
---|
1569 | var clone = $.extend({
|
---|
1570 | lng: "non",
|
---|
1571 | lngs: [],
|
---|
1572 | _origLng: "non"
|
---|
1573 | }, options);
|
---|
1574 | delete clone.lng;
|
---|
1575 | delete clone.lngs;
|
---|
1576 | delete clone._origLng;
|
---|
1577 | ele.data("i18n-options", clone)
|
---|
1578 | }
|
---|
1579 | }
|
---|
1580 | $.fn.i18n = function (options) {
|
---|
1581 | return this.each(function () {
|
---|
1582 | localize($(this), options);
|
---|
1583 | var elements = $(this).find("[" + o.selectorAttr + "]");
|
---|
1584 | elements.each(function () {
|
---|
1585 | localize($(this), options)
|
---|
1586 | })
|
---|
1587 | })
|
---|
1588 | }
|
---|
1589 | }
|
---|
1590 |
|
---|
1591 | function addJqueryLikeFunctionality() {
|
---|
1592 | function parse(ele, key, options) {
|
---|
1593 | if (key.length === 0)
|
---|
1594 | return;
|
---|
1595 | var attr = "text";
|
---|
1596 | if (key.indexOf("[") === 0) {
|
---|
1597 | var parts = key.split("]");
|
---|
1598 | key = parts[1];
|
---|
1599 | attr = parts[0].substr(1, parts[0].length - 1)
|
---|
1600 | }
|
---|
1601 | if (key.indexOf(";") === key.length - 1) {
|
---|
1602 | key = key.substr(0, key.length - 2)
|
---|
1603 | }
|
---|
1604 | if (attr === "html") {
|
---|
1605 | ele.innerHTML = translate(key, options)
|
---|
1606 | } else if (attr === "text") {
|
---|
1607 | ele.textContent = translate(key, options)
|
---|
1608 | } else if (attr === "prepend") {
|
---|
1609 | ele.insertAdjacentHTML(translate(key, options), "afterbegin")
|
---|
1610 | } else if (attr === "append") {
|
---|
1611 | ele.insertAdjacentHTML(translate(key, options), "beforeend")
|
---|
1612 | } else {
|
---|
1613 | ele.setAttribute(attr, translate(key, options))
|
---|
1614 | }
|
---|
1615 | }
|
---|
1616 |
|
---|
1617 | function localize(ele, options) {
|
---|
1618 | var key = ele.getAttribute(o.selectorAttr);
|
---|
1619 | if (!key && typeof key !== "undefined" && key !== false)
|
---|
1620 | key = ele.textContent || ele.value;
|
---|
1621 | if (!key)
|
---|
1622 | return;
|
---|
1623 | var target = ele,
|
---|
1624 | targetSelector = ele.getAttribute("i18n-target");
|
---|
1625 | if (targetSelector) {
|
---|
1626 | target = ele.querySelector(targetSelector) || ele
|
---|
1627 | }
|
---|
1628 | if (key.indexOf(";") >= 0) {
|
---|
1629 | var keys = key.split(";"),
|
---|
1630 | index = 0,
|
---|
1631 | length = keys.length;
|
---|
1632 | for (; index < length; index++) {
|
---|
1633 | if (keys[index] !== "")
|
---|
1634 | parse(target, keys[index], options)
|
---|
1635 | }
|
---|
1636 | } else {
|
---|
1637 | parse(target, key, options)
|
---|
1638 | }
|
---|
1639 | }
|
---|
1640 | i18n.translateObject = function (object, options) {
|
---|
1641 | var elements = object.querySelectorAll("[" + o.selectorAttr + "]");
|
---|
1642 | var index = 0,
|
---|
1643 | length = elements.length;
|
---|
1644 | for (; index < length; index++) {
|
---|
1645 | localize(elements[index], options)
|
---|
1646 | }
|
---|
1647 | }
|
---|
1648 | }
|
---|
1649 |
|
---|
1650 | function applyReplacement(str, replacementHash, nestedKey, options) {
|
---|
1651 | if (!str)
|
---|
1652 | return str;
|
---|
1653 | options = options || replacementHash;
|
---|
1654 | if (str.indexOf(options.interpolationPrefix || o.interpolationPrefix) < 0)
|
---|
1655 | return str;
|
---|
1656 | var prefix = options.interpolationPrefix ? f.regexEscape(options.interpolationPrefix) : o.interpolationPrefixEscaped,
|
---|
1657 | suffix = options.interpolationSuffix ? f.regexEscape(options.interpolationSuffix) : o.interpolationSuffixEscaped,
|
---|
1658 | keyseparator = options.keyseparator || o.keyseparator,
|
---|
1659 | unEscapingSuffix = "HTML" + suffix;
|
---|
1660 | var hash = replacementHash.replace && typeof replacementHash.replace === "object" ? replacementHash.replace : replacementHash;
|
---|
1661 | var replacementRegex = new RegExp([prefix, "(.+?)", "(HTML)?", suffix].join(""), "g");
|
---|
1662 | var escapeInterpolation = options.escapeInterpolation || o.escapeInterpolation;
|
---|
1663 | return str.replace(replacementRegex, function (wholeMatch, keyMatch, htmlMatched) {
|
---|
1664 | var objectMatching = hash;
|
---|
1665 | var keyLeaf = keyMatch;
|
---|
1666 | while (keyLeaf.indexOf(keyseparator) >= 0 && typeof objectMatching === "object" && objectMatching) {
|
---|
1667 | var propName = keyLeaf.slice(0, keyLeaf.indexOf(keyseparator));
|
---|
1668 | keyLeaf = keyLeaf.slice(keyLeaf.indexOf(keyseparator) + 1);
|
---|
1669 | objectMatching = objectMatching[propName]
|
---|
1670 | }
|
---|
1671 | if (objectMatching && typeof objectMatching === "object" && objectMatching.hasOwnProperty(keyLeaf)) {
|
---|
1672 | var value = objectMatching[keyLeaf];
|
---|
1673 | if (escapeInterpolation && !htmlMatched) {
|
---|
1674 | return f.escape(objectMatching[keyLeaf])
|
---|
1675 | } else {
|
---|
1676 | return objectMatching[keyLeaf]
|
---|
1677 | }
|
---|
1678 | } else {
|
---|
1679 | return wholeMatch
|
---|
1680 | }
|
---|
1681 | })
|
---|
1682 | }
|
---|
1683 | f.applyReplacement = applyReplacement;
|
---|
1684 |
|
---|
1685 | function applyReuse(translated, options) {
|
---|
1686 | var comma = ",";
|
---|
1687 | var options_open = "{";
|
---|
1688 | var options_close = "}";
|
---|
1689 | var opts = f.extend({}, options);
|
---|
1690 | delete opts.postProcess;
|
---|
1691 | delete opts.isFallbackLookup;
|
---|
1692 | while (translated.indexOf(o.reusePrefix) != -1) {
|
---|
1693 | replacementCounter++;
|
---|
1694 | if (replacementCounter > o.maxRecursion) {
|
---|
1695 | break
|
---|
1696 | }
|
---|
1697 | var index_of_opening = translated.lastIndexOf(o.reusePrefix);
|
---|
1698 | var index_of_end_of_closing = translated.indexOf(o.reuseSuffix, index_of_opening) + o.reuseSuffix.length;
|
---|
1699 | var token = translated.substring(index_of_opening, index_of_end_of_closing);
|
---|
1700 | var token_without_symbols = token.replace(o.reusePrefix, "").replace(o.reuseSuffix, "");
|
---|
1701 | if (index_of_end_of_closing <= index_of_opening) {
|
---|
1702 | f.error("there is an missing closing in following translation value", translated);
|
---|
1703 | return ""
|
---|
1704 | }
|
---|
1705 | if (token_without_symbols.indexOf(comma) != -1) {
|
---|
1706 | var index_of_token_end_of_closing = token_without_symbols.indexOf(comma);
|
---|
1707 | if (token_without_symbols.indexOf(options_open, index_of_token_end_of_closing) != -1 && token_without_symbols.indexOf(options_close, index_of_token_end_of_closing) != -1) {
|
---|
1708 | var index_of_opts_opening = token_without_symbols.indexOf(options_open, index_of_token_end_of_closing);
|
---|
1709 | var index_of_opts_end_of_closing = token_without_symbols.indexOf(options_close, index_of_opts_opening) + options_close.length;
|
---|
1710 | try {
|
---|
1711 | opts = f.extend(opts, JSON.parse(token_without_symbols.substring(index_of_opts_opening, index_of_opts_end_of_closing)));
|
---|
1712 | token_without_symbols = token_without_symbols.substring(0, index_of_token_end_of_closing)
|
---|
1713 | } catch (e) {
|
---|
1714 | }
|
---|
1715 | }
|
---|
1716 | }
|
---|
1717 | var translated_token = _translate(token_without_symbols, opts);
|
---|
1718 | translated = translated.replace(token, f.regexReplacementEscape(translated_token))
|
---|
1719 | }
|
---|
1720 | return translated
|
---|
1721 | }
|
---|
1722 |
|
---|
1723 | function hasContext(options) {
|
---|
1724 | return options.context && (typeof options.context == "string" || typeof options.context == "number")
|
---|
1725 | }
|
---|
1726 |
|
---|
1727 | function needsPlural(options, lng) {
|
---|
1728 | return options.count !== undefined && typeof options.count != "string"
|
---|
1729 | }
|
---|
1730 |
|
---|
1731 | function needsIndefiniteArticle(options) {
|
---|
1732 | return options.indefinite_article !== undefined && typeof options.indefinite_article != "string" && options.indefinite_article
|
---|
1733 | }
|
---|
1734 |
|
---|
1735 | function exists(key, options) {
|
---|
1736 | options = options || {};
|
---|
1737 | var notFound = _getDefaultValue(key, options),
|
---|
1738 | found = _find(key, options);
|
---|
1739 | return found !== undefined || found === notFound
|
---|
1740 | }
|
---|
1741 |
|
---|
1742 | function translate(key, options) {
|
---|
1743 | if (!initialized) {
|
---|
1744 | f.log("i18next not finished initialization. you might have called t function before loading resources finished.");
|
---|
1745 | if (options && options.defaultValue) {
|
---|
1746 | return options.detaultValue
|
---|
1747 | } else {
|
---|
1748 | return ""
|
---|
1749 | }
|
---|
1750 | }
|
---|
1751 | replacementCounter = 0;
|
---|
1752 | return _translate.apply(null, arguments)
|
---|
1753 | }
|
---|
1754 |
|
---|
1755 | function _getDefaultValue(key, options) {
|
---|
1756 | return options.defaultValue !== undefined ? options.defaultValue : key
|
---|
1757 | }
|
---|
1758 |
|
---|
1759 | function _injectSprintfProcessor() {
|
---|
1760 | var values = [];
|
---|
1761 | for (var i = 1; i < arguments.length; i++) {
|
---|
1762 | values.push(arguments[i])
|
---|
1763 | }
|
---|
1764 | return {
|
---|
1765 | postProcess: "sprintf",
|
---|
1766 | sprintf: values
|
---|
1767 | }
|
---|
1768 | }
|
---|
1769 |
|
---|
1770 | function _translate(potentialKeys, options) {
|
---|
1771 | if (typeof options !== "undefined" && typeof options !== "object") {
|
---|
1772 | if (o.shortcutFunction === "sprintf") {
|
---|
1773 | options = _injectSprintfProcessor.apply(null, arguments)
|
---|
1774 | } else if (o.shortcutFunction === "defaultValue") {
|
---|
1775 | options = {
|
---|
1776 | defaultValue: options
|
---|
1777 | }
|
---|
1778 | }
|
---|
1779 | } else {
|
---|
1780 | options = options || {}
|
---|
1781 | }
|
---|
1782 | if (typeof o.defaultVariables === "object") {
|
---|
1783 | options = f.extend({}, o.defaultVariables, options)
|
---|
1784 | }
|
---|
1785 | if (potentialKeys === undefined || potentialKeys === null || potentialKeys === "")
|
---|
1786 | return "";
|
---|
1787 | if (typeof potentialKeys === "number") {
|
---|
1788 | potentialKeys = String(potentialKeys)
|
---|
1789 | }
|
---|
1790 | if (typeof potentialKeys === "string") {
|
---|
1791 | potentialKeys = [potentialKeys]
|
---|
1792 | }
|
---|
1793 | var key = potentialKeys[0];
|
---|
1794 | if (potentialKeys.length > 1) {
|
---|
1795 | for (var i = 0; i < potentialKeys.length; i++) {
|
---|
1796 | key = potentialKeys[i];
|
---|
1797 | if (exists(key, options)) {
|
---|
1798 | break
|
---|
1799 | }
|
---|
1800 | }
|
---|
1801 | }
|
---|
1802 | var notFound = _getDefaultValue(key, options),
|
---|
1803 | found = _find(key, options),
|
---|
1804 | nsseparator = options.nsseparator || o.nsseparator,
|
---|
1805 | lngs = options.lng ? f.toLanguages(options.lng, options.fallbackLng) : languages,
|
---|
1806 | ns = options.ns || o.ns.defaultNs,
|
---|
1807 | parts;
|
---|
1808 | if (key.indexOf(nsseparator) > -1) {
|
---|
1809 | parts = key.split(nsseparator);
|
---|
1810 | ns = parts[0];
|
---|
1811 | key = parts[1]
|
---|
1812 | }
|
---|
1813 | if (found === undefined && o.sendMissing && typeof o.missingKeyHandler === "function") {
|
---|
1814 | if (options.lng) {
|
---|
1815 | o.missingKeyHandler(lngs[0], ns, key, notFound, lngs)
|
---|
1816 | } else {
|
---|
1817 | o.missingKeyHandler(o.lng, ns, key, notFound, lngs)
|
---|
1818 | }
|
---|
1819 | }
|
---|
1820 | var postProcessorsToApply, postProcessor, j;
|
---|
1821 | if (typeof o.postProcess === "string" && o.postProcess !== "") {
|
---|
1822 | postProcessorsToApply = [o.postProcess]
|
---|
1823 | } else if (typeof o.postProcess === "array" || typeof o.postProcess === "object") {
|
---|
1824 | postProcessorsToApply = o.postProcess
|
---|
1825 | } else {
|
---|
1826 | postProcessorsToApply = []
|
---|
1827 | }
|
---|
1828 | if (typeof options.postProcess === "string" && options.postProcess !== "") {
|
---|
1829 | postProcessorsToApply = postProcessorsToApply.concat([options.postProcess])
|
---|
1830 | } else if (typeof options.postProcess === "array" || typeof options.postProcess === "object") {
|
---|
1831 | postProcessorsToApply = postProcessorsToApply.concat(options.postProcess)
|
---|
1832 | }
|
---|
1833 | if (found !== undefined && postProcessorsToApply.length) {
|
---|
1834 | for (j = 0; j < postProcessorsToApply.length; j += 1) {
|
---|
1835 | postProcessor = postProcessorsToApply[j];
|
---|
1836 | if (postProcessors[postProcessor]) {
|
---|
1837 | found = postProcessors[postProcessor](found, key, options)
|
---|
1838 | }
|
---|
1839 | }
|
---|
1840 | }
|
---|
1841 | var splitNotFound = notFound;
|
---|
1842 | if (notFound.indexOf(nsseparator) > -1) {
|
---|
1843 | parts = notFound.split(nsseparator);
|
---|
1844 | splitNotFound = parts[1]
|
---|
1845 | }
|
---|
1846 | if (splitNotFound === key && o.parseMissingKey) {
|
---|
1847 | notFound = o.parseMissingKey(notFound)
|
---|
1848 | }
|
---|
1849 | if (found === undefined) {
|
---|
1850 | notFound = applyReplacement(notFound, options);
|
---|
1851 | notFound = applyReuse(notFound, options);
|
---|
1852 | if (postProcessorsToApply.length) {
|
---|
1853 | found = _getDefaultValue(key, options);
|
---|
1854 | for (j = 0; j < postProcessorsToApply.length; j += 1) {
|
---|
1855 | postProcessor = postProcessorsToApply[j];
|
---|
1856 | if (postProcessors[postProcessor]) {
|
---|
1857 | found = postProcessors[postProcessor](found, key, options)
|
---|
1858 | }
|
---|
1859 | }
|
---|
1860 | }
|
---|
1861 | }
|
---|
1862 | return found !== undefined ? found : notFound
|
---|
1863 | }
|
---|
1864 |
|
---|
1865 | function _find(key, options) {
|
---|
1866 | options = options || {};
|
---|
1867 | var optionWithoutCount, translated, notFound = _getDefaultValue(key, options),
|
---|
1868 | lngs = languages;
|
---|
1869 | if (!resStore) {
|
---|
1870 | return notFound
|
---|
1871 | }
|
---|
1872 | if (lngs[0].toLowerCase() === "cimode")
|
---|
1873 | return notFound;
|
---|
1874 | if (options.lngs)
|
---|
1875 | lngs = options.lngs;
|
---|
1876 | if (options.lng) {
|
---|
1877 | lngs = f.toLanguages(options.lng, options.fallbackLng);
|
---|
1878 | if (!resStore[lngs[0]]) {
|
---|
1879 | var oldAsync = o.getAsync;
|
---|
1880 | o.getAsync = false;
|
---|
1881 | i18n.sync.load(lngs, o, function (err, store) {
|
---|
1882 | f.extend(resStore, store);
|
---|
1883 | o.getAsync = oldAsync
|
---|
1884 | })
|
---|
1885 | }
|
---|
1886 | }
|
---|
1887 | var ns = options.ns || o.ns.defaultNs;
|
---|
1888 | var nsseparator = options.nsseparator || o.nsseparator;
|
---|
1889 | if (key.indexOf(nsseparator) > -1) {
|
---|
1890 | var parts = key.split(nsseparator);
|
---|
1891 | ns = parts[0];
|
---|
1892 | key = parts[1]
|
---|
1893 | }
|
---|
1894 | if (hasContext(options)) {
|
---|
1895 | optionWithoutCount = f.extend({}, options);
|
---|
1896 | delete optionWithoutCount.context;
|
---|
1897 | optionWithoutCount.defaultValue = o.contextNotFound;
|
---|
1898 | var contextKey = ns + nsseparator + key + "_" + options.context;
|
---|
1899 | translated = translate(contextKey, optionWithoutCount);
|
---|
1900 | if (translated != o.contextNotFound) {
|
---|
1901 | return applyReplacement(translated, {
|
---|
1902 | context: options.context
|
---|
1903 | })
|
---|
1904 | }
|
---|
1905 | }
|
---|
1906 | if (needsPlural(options, lngs[0])) {
|
---|
1907 | optionWithoutCount = f.extend({
|
---|
1908 | lngs: [lngs[0]]
|
---|
1909 | }, options);
|
---|
1910 | delete optionWithoutCount.count;
|
---|
1911 | optionWithoutCount._origLng = optionWithoutCount._origLng || optionWithoutCount.lng || lngs[0];
|
---|
1912 | delete optionWithoutCount.lng;
|
---|
1913 | optionWithoutCount.defaultValue = o.pluralNotFound;
|
---|
1914 | var pluralKey;
|
---|
1915 | if (!pluralExtensions.needsPlural(lngs[0], options.count)) {
|
---|
1916 | pluralKey = ns + nsseparator + key
|
---|
1917 | } else {
|
---|
1918 | pluralKey = ns + nsseparator + key + o.pluralSuffix;
|
---|
1919 | var pluralExtension = pluralExtensions.get(lngs[0], options.count);
|
---|
1920 | if (pluralExtension >= 0) {
|
---|
1921 | pluralKey = pluralKey + "_" + pluralExtension
|
---|
1922 | } else if (pluralExtension === 1) {
|
---|
1923 | pluralKey = ns + nsseparator + key
|
---|
1924 | }
|
---|
1925 | }
|
---|
1926 | translated = translate(pluralKey, optionWithoutCount);
|
---|
1927 | if (translated != o.pluralNotFound) {
|
---|
1928 | return applyReplacement(translated, {
|
---|
1929 | count: options.count,
|
---|
1930 | interpolationPrefix: options.interpolationPrefix,
|
---|
1931 | interpolationSuffix: options.interpolationSuffix
|
---|
1932 | })
|
---|
1933 | } else if (lngs.length > 1) {
|
---|
1934 | var clone = lngs.slice();
|
---|
1935 | clone.shift();
|
---|
1936 | options = f.extend(options, {
|
---|
1937 | lngs: clone
|
---|
1938 | });
|
---|
1939 | options._origLng = optionWithoutCount._origLng;
|
---|
1940 | delete options.lng;
|
---|
1941 | translated = translate(ns + nsseparator + key, options);
|
---|
1942 | if (translated != o.pluralNotFound)
|
---|
1943 | return translated
|
---|
1944 | } else {
|
---|
1945 | optionWithoutCount.lng = optionWithoutCount._origLng;
|
---|
1946 | delete optionWithoutCount._origLng;
|
---|
1947 | translated = translate(ns + nsseparator + key, optionWithoutCount);
|
---|
1948 | return applyReplacement(translated, {
|
---|
1949 | count: options.count,
|
---|
1950 | interpolationPrefix: options.interpolationPrefix,
|
---|
1951 | interpolationSuffix: options.interpolationSuffix
|
---|
1952 | })
|
---|
1953 | }
|
---|
1954 | }
|
---|
1955 | if (needsIndefiniteArticle(options)) {
|
---|
1956 | var optionsWithoutIndef = f.extend({}, options);
|
---|
1957 | delete optionsWithoutIndef.indefinite_article;
|
---|
1958 | optionsWithoutIndef.defaultValue = o.indefiniteNotFound;
|
---|
1959 | var indefiniteKey = ns + nsseparator + key + (options.count && !needsPlural(options, lngs[0]) || !options.count ? o.indefiniteSuffix : "");
|
---|
1960 | translated = translate(indefiniteKey, optionsWithoutIndef);
|
---|
1961 | if (translated != o.indefiniteNotFound) {
|
---|
1962 | return translated
|
---|
1963 | }
|
---|
1964 | }
|
---|
1965 | var found;
|
---|
1966 | var keyseparator = options.keyseparator || o.keyseparator;
|
---|
1967 | var keys = key.split(keyseparator);
|
---|
1968 | for (var i = 0, len = lngs.length; i < len; i++) {
|
---|
1969 | if (found !== undefined)
|
---|
1970 | break;
|
---|
1971 | var l = lngs[i];
|
---|
1972 | var x = 0;
|
---|
1973 | var value = resStore[l] && resStore[l][ns];
|
---|
1974 | while (keys[x]) {
|
---|
1975 | value = value && value[keys[x]];
|
---|
1976 | x++
|
---|
1977 | }
|
---|
1978 | if (value !== undefined && (!o.showKeyIfEmpty || value !== "")) {
|
---|
1979 | var valueType = Object.prototype.toString.apply(value);
|
---|
1980 | if (typeof value === "string") {
|
---|
1981 | value = applyReplacement(value, options);
|
---|
1982 | value = applyReuse(value, options)
|
---|
1983 | } else if (valueType === "[object Array]" && !o.returnObjectTrees && !options.returnObjectTrees) {
|
---|
1984 | value = value.join("\n");
|
---|
1985 | value = applyReplacement(value, options);
|
---|
1986 | value = applyReuse(value, options)
|
---|
1987 | } else if (value === null && o.fallbackOnNull === true) {
|
---|
1988 | value = undefined
|
---|
1989 | } else if (value !== null) {
|
---|
1990 | if (!o.returnObjectTrees && !options.returnObjectTrees) {
|
---|
1991 | if (o.objectTreeKeyHandler && typeof o.objectTreeKeyHandler == "function") {
|
---|
1992 | value = o.objectTreeKeyHandler(key, value, l, ns, options)
|
---|
1993 | } else {
|
---|
1994 | value = "key '" + ns + ":" + key + " (" + l + ")' " + "returned an object instead of string.";
|
---|
1995 | f.log(value)
|
---|
1996 | }
|
---|
1997 | } else if (valueType !== "[object Number]" && valueType !== "[object Function]" && valueType !== "[object RegExp]") {
|
---|
1998 | var copy = valueType === "[object Array]" ? [] : {};
|
---|
1999 | f.each(value, function (m) {
|
---|
2000 | copy[m] = _translate(ns + nsseparator + key + keyseparator + m, options)
|
---|
2001 | });
|
---|
2002 | value = copy
|
---|
2003 | }
|
---|
2004 | }
|
---|
2005 | if (typeof value === "string" && value.trim() === "" && o.fallbackOnEmpty === true)
|
---|
2006 | value = undefined;
|
---|
2007 | found = value
|
---|
2008 | }
|
---|
2009 | }
|
---|
2010 | if (found === undefined && !options.isFallbackLookup && (o.fallbackToDefaultNS === true || o.fallbackNS && o.fallbackNS.length > 0)) {
|
---|
2011 | options.isFallbackLookup = true;
|
---|
2012 | if (o.fallbackNS.length) {
|
---|
2013 | for (var y = 0, lenY = o.fallbackNS.length; y < lenY; y++) {
|
---|
2014 | found = _find(o.fallbackNS[y] + nsseparator + key, options);
|
---|
2015 | if (found || found === "" && o.fallbackOnEmpty === false) {
|
---|
2016 | var foundValue = found.indexOf(nsseparator) > -1 ? found.split(nsseparator)[1] : found,
|
---|
2017 | notFoundValue = notFound.indexOf(nsseparator) > -1 ? notFound.split(nsseparator)[1] : notFound;
|
---|
2018 | if (foundValue !== notFoundValue)
|
---|
2019 | break
|
---|
2020 | }
|
---|
2021 | }
|
---|
2022 | } else {
|
---|
2023 | options.ns = o.ns.defaultNs;
|
---|
2024 | found = _find(key, options)
|
---|
2025 | }
|
---|
2026 | options.isFallbackLookup = false
|
---|
2027 | }
|
---|
2028 | return found
|
---|
2029 | }
|
---|
2030 |
|
---|
2031 | function detectLanguage() {
|
---|
2032 | var detectedLng;
|
---|
2033 | var whitelist = o.lngWhitelist || [];
|
---|
2034 | var userLngChoices = [];
|
---|
2035 | var qsParm = [];
|
---|
2036 | if (typeof window !== "undefined") {
|
---|
2037 | (function () {
|
---|
2038 | var query = window.location.search.substring(1);
|
---|
2039 | var params = query.split("&");
|
---|
2040 | for (var i = 0; i < params.length; i++) {
|
---|
2041 | var pos = params[i].indexOf("=");
|
---|
2042 | if (pos > 0) {
|
---|
2043 | var key = params[i].substring(0, pos);
|
---|
2044 | if (key == o.detectLngQS) {
|
---|
2045 | userLngChoices.push(params[i].substring(pos + 1))
|
---|
2046 | }
|
---|
2047 | }
|
---|
2048 | }
|
---|
2049 | })()
|
---|
2050 | }
|
---|
2051 | if (o.useCookie && typeof document !== "undefined") {
|
---|
2052 | var c = f.cookie.read(o.cookieName);
|
---|
2053 | if (c)
|
---|
2054 | userLngChoices.push(c)
|
---|
2055 | }
|
---|
2056 | if (o.detectLngFromLocalStorage && typeof window !== "undefined" && window.localStorage) {
|
---|
2057 | var lang = f.localStorage.getItem("i18next_lng");
|
---|
2058 | if (lang) {
|
---|
2059 | userLngChoices.push(lang)
|
---|
2060 | }
|
---|
2061 | }
|
---|
2062 | if (typeof navigator !== "undefined") {
|
---|
2063 | if (navigator.languages) {
|
---|
2064 | for (var i = 0; i < navigator.languages.length; i++) {
|
---|
2065 | userLngChoices.push(navigator.languages[i])
|
---|
2066 | }
|
---|
2067 | }
|
---|
2068 | if (navigator.userLanguage) {
|
---|
2069 | userLngChoices.push(navigator.userLanguage)
|
---|
2070 | }
|
---|
2071 | if (navigator.language) {
|
---|
2072 | userLngChoices.push(navigator.language)
|
---|
2073 | }
|
---|
2074 | }
|
---|
2075 | (function () {
|
---|
2076 | for (var i = 0; i < userLngChoices.length; i++) {
|
---|
2077 | var lng = userLngChoices[i];
|
---|
2078 | if (lng.indexOf("-") > -1) {
|
---|
2079 | var parts = lng.split("-");
|
---|
2080 | lng = o.lowerCaseLng ? parts[0].toLowerCase() + "-" + parts[1].toLowerCase() : parts[0].toLowerCase() + "-" + parts[1].toUpperCase()
|
---|
2081 | }
|
---|
2082 | if (whitelist.length === 0 || whitelist.indexOf(lng) > -1) {
|
---|
2083 | detectedLng = lng;
|
---|
2084 | break
|
---|
2085 | }
|
---|
2086 | }
|
---|
2087 | })();
|
---|
2088 | if (!detectedLng) {
|
---|
2089 | detectedLng = o.fallbackLng[0]
|
---|
2090 | }
|
---|
2091 | return detectedLng
|
---|
2092 | }
|
---|
2093 | var _rules = [
|
---|
2094 | ["ach", "Acholi", [1, 2], 1],
|
---|
2095 | ["af", "Afrikaans", [1, 2], 2],
|
---|
2096 | ["ak", "Akan", [1, 2], 1],
|
---|
2097 | ["am", "Amharic", [1, 2], 1],
|
---|
2098 | ["an", "Aragonese", [1, 2], 2],
|
---|
2099 | ["ar", "Arabic", [0, 1, 2, 3, 11, 100], 5],
|
---|
2100 | ["arn", "Mapudungun", [1, 2], 1],
|
---|
2101 | ["ast", "Asturian", [1, 2], 2],
|
---|
2102 | ["ay", "Aymará", [1], 3],
|
---|
2103 | ["az", "Azerbaijani", [1, 2], 2],
|
---|
2104 | ["be", "Belarusian", [1, 2, 5], 4],
|
---|
2105 | ["bg", "Bulgarian", [1, 2], 2],
|
---|
2106 | ["bn", "Bengali", [1, 2], 2],
|
---|
2107 | ["bo", "Tibetan", [1], 3],
|
---|
2108 | ["br", "Breton", [1, 2], 1],
|
---|
2109 | ["bs", "Bosnian", [1, 2, 5], 4],
|
---|
2110 | ["ca", "Catalan", [1, 2], 2],
|
---|
2111 | ["cgg", "Chiga", [1], 3],
|
---|
2112 | ["cs", "Czech", [1, 2, 5], 6],
|
---|
2113 | ["csb", "Kashubian", [1, 2, 5], 7],
|
---|
2114 | ["cy", "Welsh", [1, 2, 3, 8], 8],
|
---|
2115 | ["da", "Danish", [1, 2], 2],
|
---|
2116 | ["de", "German", [1, 2], 2],
|
---|
2117 | ["dev", "Development Fallback", [1, 2], 2],
|
---|
2118 | ["dz", "Dzongkha", [1], 3],
|
---|
2119 | ["el", "Greek", [1, 2], 2],
|
---|
2120 | ["en", "English", [1, 2], 2],
|
---|
2121 | ["eo", "Esperanto", [1, 2], 2],
|
---|
2122 | ["es", "Spanish", [1, 2], 2],
|
---|
2123 | ["es_ar", "Argentinean Spanish", [1, 2], 2],
|
---|
2124 | ["et", "Estonian", [1, 2], 2],
|
---|
2125 | ["eu", "Basque", [1, 2], 2],
|
---|
2126 | ["fa", "Persian", [1], 3],
|
---|
2127 | ["fi", "Finnish", [1, 2], 2],
|
---|
2128 | ["fil", "Filipino", [1, 2], 1],
|
---|
2129 | ["fo", "Faroese", [1, 2], 2],
|
---|
2130 | ["fr", "French", [1, 2], 9],
|
---|
2131 | ["fur", "Friulian", [1, 2], 2],
|
---|
2132 | ["fy", "Frisian", [1, 2], 2],
|
---|
2133 | ["ga", "Irish", [1, 2, 3, 7, 11], 10],
|
---|
2134 | ["gd", "Scottish Gaelic", [1, 2, 3, 20], 11],
|
---|
2135 | ["gl", "Galician", [1, 2], 2],
|
---|
2136 | ["gu", "Gujarati", [1, 2], 2],
|
---|
2137 | ["gun", "Gun", [1, 2], 1],
|
---|
2138 | ["ha", "Hausa", [1, 2], 2],
|
---|
2139 | ["he", "Hebrew", [1, 2], 2],
|
---|
2140 | ["hi", "Hindi", [1, 2], 2],
|
---|
2141 | ["hr", "Croatian", [1, 2, 5], 4],
|
---|
2142 | ["hu", "Hungarian", [1, 2], 2],
|
---|
2143 | ["hy", "Armenian", [1, 2], 2],
|
---|
2144 | ["ia", "Interlingua", [1, 2], 2],
|
---|
2145 | ["id", "Indonesian", [1], 3],
|
---|
2146 | ["is", "Icelandic", [1, 2], 12],
|
---|
2147 | ["it", "Italian", [1, 2], 2],
|
---|
2148 | ["ja", "Japanese", [1], 3],
|
---|
2149 | ["jbo", "Lojban", [1], 3],
|
---|
2150 | ["jv", "Javanese", [0, 1], 13],
|
---|
2151 | ["ka", "Georgian", [1], 3],
|
---|
2152 | ["kk", "Kazakh", [1], 3],
|
---|
2153 | ["km", "Khmer", [1], 3],
|
---|
2154 | ["kn", "Kannada", [1, 2], 2],
|
---|
2155 | ["ko", "Korean", [1], 3],
|
---|
2156 | ["ku", "Kurdish", [1, 2], 2],
|
---|
2157 | ["kw", "Cornish", [1, 2, 3, 4], 14],
|
---|
2158 | ["ky", "Kyrgyz", [1], 3],
|
---|
2159 | ["lb", "Letzeburgesch", [1, 2], 2],
|
---|
2160 | ["ln", "Lingala", [1, 2], 1],
|
---|
2161 | ["lo", "Lao", [1], 3],
|
---|
2162 | ["lt", "Lithuanian", [1, 2, 10], 15],
|
---|
2163 | ["lv", "Latvian", [1, 2, 0], 16],
|
---|
2164 | ["mai", "Maithili", [1, 2], 2],
|
---|
2165 | ["mfe", "Mauritian Creole", [1, 2], 1],
|
---|
2166 | ["mg", "Malagasy", [1, 2], 1],
|
---|
2167 | ["mi", "Maori", [1, 2], 1],
|
---|
2168 | ["mk", "Macedonian", [1, 2], 17],
|
---|
2169 | ["ml", "Malayalam", [1, 2], 2],
|
---|
2170 | ["mn", "Mongolian", [1, 2], 2],
|
---|
2171 | ["mnk", "Mandinka", [0, 1, 2], 18],
|
---|
2172 | ["mr", "Marathi", [1, 2], 2],
|
---|
2173 | ["ms", "Malay", [1], 3],
|
---|
2174 | ["mt", "Maltese", [1, 2, 11, 20], 19],
|
---|
2175 | ["nah", "Nahuatl", [1, 2], 2],
|
---|
2176 | ["nap", "Neapolitan", [1, 2], 2],
|
---|
2177 | ["nb", "Norwegian Bokmal", [1, 2], 2],
|
---|
2178 | ["ne", "Nepali", [1, 2], 2],
|
---|
2179 | ["nl", "Dutch", [1, 2], 2],
|
---|
2180 | ["nn", "Norwegian Nynorsk", [1, 2], 2],
|
---|
2181 | ["no", "Norwegian", [1, 2], 2],
|
---|
2182 | ["nso", "Northern Sotho", [1, 2], 2],
|
---|
2183 | ["oc", "Occitan", [1, 2], 1],
|
---|
2184 | ["or", "Oriya", [2, 1], 2],
|
---|
2185 | ["pa", "Punjabi", [1, 2], 2],
|
---|
2186 | ["pap", "Papiamento", [1, 2], 2],
|
---|
2187 | ["pl", "Polish", [1, 2, 5], 7],
|
---|
2188 | ["pms", "Piemontese", [1, 2], 2],
|
---|
2189 | ["ps", "Pashto", [1, 2], 2],
|
---|
2190 | ["pt", "Portuguese", [1, 2], 2],
|
---|
2191 | ["pt_br", "Brazilian Portuguese", [1, 2], 2],
|
---|
2192 | ["rm", "Romansh", [1, 2], 2],
|
---|
2193 | ["ro", "Romanian", [1, 2, 20], 20],
|
---|
2194 | ["ru", "Russian", [1, 2, 5], 4],
|
---|
2195 | ["sah", "Yakut", [1], 3],
|
---|
2196 | ["sco", "Scots", [1, 2], 2],
|
---|
2197 | ["se", "Northern Sami", [1, 2], 2],
|
---|
2198 | ["si", "Sinhala", [1, 2], 2],
|
---|
2199 | ["sk", "Slovak", [1, 2, 5], 6],
|
---|
2200 | ["sl", "Slovenian", [5, 1, 2, 3], 21],
|
---|
2201 | ["so", "Somali", [1, 2], 2],
|
---|
2202 | ["son", "Songhay", [1, 2], 2],
|
---|
2203 | ["sq", "Albanian", [1, 2], 2],
|
---|
2204 | ["sr", "Serbian", [1, 2, 5], 4],
|
---|
2205 | ["su", "Sundanese", [1], 3],
|
---|
2206 | ["sv", "Swedish", [1, 2], 2],
|
---|
2207 | ["sw", "Swahili", [1, 2], 2],
|
---|
2208 | ["ta", "Tamil", [1, 2], 2],
|
---|
2209 | ["te", "Telugu", [1, 2], 2],
|
---|
2210 | ["tg", "Tajik", [1, 2], 1],
|
---|
2211 | ["th", "Thai", [1], 3],
|
---|
2212 | ["ti", "Tigrinya", [1, 2], 1],
|
---|
2213 | ["tk", "Turkmen", [1, 2], 2],
|
---|
2214 | ["tr", "Turkish", [1, 2], 1],
|
---|
2215 | ["tt", "Tatar", [1], 3],
|
---|
2216 | ["ug", "Uyghur", [1], 3],
|
---|
2217 | ["uk", "Ukrainian", [1, 2, 5], 4],
|
---|
2218 | ["ur", "Urdu", [1, 2], 2],
|
---|
2219 | ["uz", "Uzbek", [1, 2], 1],
|
---|
2220 | ["vi", "Vietnamese", [1], 3],
|
---|
2221 | ["wa", "Walloon", [1, 2], 1],
|
---|
2222 | ["wo", "Wolof", [1], 3],
|
---|
2223 | ["yo", "Yoruba", [1, 2], 2],
|
---|
2224 | ["zh", "Chinese", [1], 3]
|
---|
2225 | ];
|
---|
2226 | var _rulesPluralsTypes = {
|
---|
2227 | 1: function (n) {
|
---|
2228 | return Number(n > 1)
|
---|
2229 | },
|
---|
2230 | 2: function (n) {
|
---|
2231 | return Number(n != 1)
|
---|
2232 | },
|
---|
2233 | 3: function (n) {
|
---|
2234 | return 0
|
---|
2235 | },
|
---|
2236 | 4: function (n) {
|
---|
2237 | return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2)
|
---|
2238 | },
|
---|
2239 | 5: function (n) {
|
---|
2240 | return Number(n === 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5)
|
---|
2241 | },
|
---|
2242 | 6: function (n) {
|
---|
2243 | return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2)
|
---|
2244 | },
|
---|
2245 | 7: function (n) {
|
---|
2246 | return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2)
|
---|
2247 | },
|
---|
2248 | 8: function (n) {
|
---|
2249 | return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3)
|
---|
2250 | },
|
---|
2251 | 9: function (n) {
|
---|
2252 | return Number(n >= 2)
|
---|
2253 | },
|
---|
2254 | 10: function (n) {
|
---|
2255 | return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4)
|
---|
2256 | },
|
---|
2257 | 11: function (n) {
|
---|
2258 | return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3)
|
---|
2259 | },
|
---|
2260 | 12: function (n) {
|
---|
2261 | return Number(n % 10 != 1 || n % 100 == 11)
|
---|
2262 | },
|
---|
2263 | 13: function (n) {
|
---|
2264 | return Number(n !== 0)
|
---|
2265 | },
|
---|
2266 | 14: function (n) {
|
---|
2267 | return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3)
|
---|
2268 | },
|
---|
2269 | 15: function (n) {
|
---|
2270 | return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2)
|
---|
2271 | },
|
---|
2272 | 16: function (n) {
|
---|
2273 | return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2)
|
---|
2274 | },
|
---|
2275 | 17: function (n) {
|
---|
2276 | return Number(n == 1 || n % 10 == 1 ? 0 : 1)
|
---|
2277 | },
|
---|
2278 | 18: function (n) {
|
---|
2279 | return Number(n == 0 ? 0 : n == 1 ? 1 : 2)
|
---|
2280 | },
|
---|
2281 | 19: function (n) {
|
---|
2282 | return Number(n == 1 ? 0 : n === 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3)
|
---|
2283 | },
|
---|
2284 | 20: function (n) {
|
---|
2285 | return Number(n == 1 ? 0 : n === 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2)
|
---|
2286 | },
|
---|
2287 | 21: function (n) {
|
---|
2288 | return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0)
|
---|
2289 | }
|
---|
2290 | };
|
---|
2291 | var pluralExtensions = {
|
---|
2292 | rules: function () {
|
---|
2293 | var l, rules = {};
|
---|
2294 | for (l = _rules.length; l--; ) {
|
---|
2295 | rules[_rules[l][0]] = {
|
---|
2296 | name: _rules[l][1],
|
---|
2297 | numbers: _rules[l][2],
|
---|
2298 | plurals: _rulesPluralsTypes[_rules[l][3]]
|
---|
2299 | }
|
---|
2300 | }
|
---|
2301 | return rules
|
---|
2302 | }(),
|
---|
2303 | addRule: function (lng, obj) {
|
---|
2304 | pluralExtensions.rules[lng] = obj
|
---|
2305 | },
|
---|
2306 | setCurrentLng: function (lng) {
|
---|
2307 | if (!pluralExtensions.currentRule || pluralExtensions.currentRule.lng !== lng) {
|
---|
2308 | var parts = lng.split("-");
|
---|
2309 | pluralExtensions.currentRule = {
|
---|
2310 | lng: lng,
|
---|
2311 | rule: pluralExtensions.rules[parts[0]]
|
---|
2312 | }
|
---|
2313 | }
|
---|
2314 | },
|
---|
2315 | needsPlural: function (lng, count) {
|
---|
2316 | var parts = lng.split("-");
|
---|
2317 | var ext;
|
---|
2318 | if (pluralExtensions.currentRule && pluralExtensions.currentRule.lng === lng) {
|
---|
2319 | ext = pluralExtensions.currentRule.rule
|
---|
2320 | } else {
|
---|
2321 | ext = pluralExtensions.rules[parts[f.getCountyIndexOfLng(lng)]]
|
---|
2322 | }
|
---|
2323 | if (ext && ext.numbers.length <= 1) {
|
---|
2324 | return false
|
---|
2325 | } else {
|
---|
2326 | return this.get(lng, count) !== 1
|
---|
2327 | }
|
---|
2328 | },
|
---|
2329 | get: function (lng, count) {
|
---|
2330 | var parts = lng.split("-");
|
---|
2331 |
|
---|
2332 | function getResult(l, c) {
|
---|
2333 | var ext;
|
---|
2334 | if (pluralExtensions.currentRule && pluralExtensions.currentRule.lng === lng) {
|
---|
2335 | ext = pluralExtensions.currentRule.rule
|
---|
2336 | } else {
|
---|
2337 | ext = pluralExtensions.rules[l]
|
---|
2338 | }
|
---|
2339 | if (ext) {
|
---|
2340 | var i;
|
---|
2341 | if (ext.noAbs) {
|
---|
2342 | i = ext.plurals(c)
|
---|
2343 | } else {
|
---|
2344 | i = ext.plurals(Math.abs(c))
|
---|
2345 | }
|
---|
2346 | var number = ext.numbers[i];
|
---|
2347 | if (ext.numbers.length === 2 && ext.numbers[0] === 1) {
|
---|
2348 | if (number === 2) {
|
---|
2349 | number = -1
|
---|
2350 | } else if (number === 1) {
|
---|
2351 | number = 1
|
---|
2352 | }
|
---|
2353 | }
|
---|
2354 | return number
|
---|
2355 | } else {
|
---|
2356 | return c === 1 ? "1" : "-1"
|
---|
2357 | }
|
---|
2358 | }
|
---|
2359 | return getResult(parts[f.getCountyIndexOfLng(lng)], count)
|
---|
2360 | }
|
---|
2361 | };
|
---|
2362 | var postProcessors = {};
|
---|
2363 | var addPostProcessor = function (name, fc) {
|
---|
2364 | postProcessors[name] = fc
|
---|
2365 | };
|
---|
2366 | var sprintf = function () {
|
---|
2367 | function get_type(variable) {
|
---|
2368 | return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase()
|
---|
2369 | }
|
---|
2370 |
|
---|
2371 | function str_repeat(input, multiplier) {
|
---|
2372 | for (var output = []; multiplier > 0; output[--multiplier] = input) {
|
---|
2373 | }
|
---|
2374 | return output.join("")
|
---|
2375 | }
|
---|
2376 | var str_format = function () {
|
---|
2377 | if (!str_format.cache.hasOwnProperty(arguments[0])) {
|
---|
2378 | str_format.cache[arguments[0]] = str_format.parse(arguments[0])
|
---|
2379 | }
|
---|
2380 | return str_format.format.call(null, str_format.cache[arguments[0]], arguments)
|
---|
2381 | };
|
---|
2382 | str_format.format = function (parse_tree, argv) {
|
---|
2383 | var cursor = 1,
|
---|
2384 | tree_length = parse_tree.length,
|
---|
2385 | node_type = "",
|
---|
2386 | arg, output = [],
|
---|
2387 | i, k, match, pad, pad_character, pad_length;
|
---|
2388 | for (i = 0; i < tree_length; i++) {
|
---|
2389 | node_type = get_type(parse_tree[i]);
|
---|
2390 | if (node_type === "string") {
|
---|
2391 | output.push(parse_tree[i])
|
---|
2392 | } else if (node_type === "array") {
|
---|
2393 | match = parse_tree[i];
|
---|
2394 | if (match[2]) {
|
---|
2395 | arg = argv[cursor];
|
---|
2396 | for (k = 0; k < match[2].length; k++) {
|
---|
2397 | if (!arg.hasOwnProperty(match[2][k])) {
|
---|
2398 | throw sprintf('[sprintf] property "%s" does not exist', match[2][k])
|
---|
2399 | }
|
---|
2400 | arg = arg[match[2][k]]
|
---|
2401 | }
|
---|
2402 | } else if (match[1]) {
|
---|
2403 | arg = argv[match[1]]
|
---|
2404 | } else {
|
---|
2405 | arg = argv[cursor++]
|
---|
2406 | }
|
---|
2407 | if (/[^s]/.test(match[8]) && get_type(arg) != "number") {
|
---|
2408 | throw sprintf("[sprintf] expecting number but found %s", get_type(arg))
|
---|
2409 | }
|
---|
2410 | switch (match[8]) {
|
---|
2411 | case "b":
|
---|
2412 | arg = arg.toString(2);
|
---|
2413 | break;
|
---|
2414 | case "c":
|
---|
2415 | arg = String.fromCharCode(arg);
|
---|
2416 | break;
|
---|
2417 | case "d":
|
---|
2418 | arg = parseInt(arg, 10);
|
---|
2419 | break;
|
---|
2420 | case "e":
|
---|
2421 | arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential();
|
---|
2422 | break;
|
---|
2423 | case "f":
|
---|
2424 | arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg);
|
---|
2425 | break;
|
---|
2426 | case "o":
|
---|
2427 | arg = arg.toString(8);
|
---|
2428 | break;
|
---|
2429 | case "s":
|
---|
2430 | arg = (arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg;
|
---|
2431 | break;
|
---|
2432 | case "u":
|
---|
2433 | arg = Math.abs(arg);
|
---|
2434 | break;
|
---|
2435 | case "x":
|
---|
2436 | arg = arg.toString(16);
|
---|
2437 | break;
|
---|
2438 | case "X":
|
---|
2439 | arg = arg.toString(16).toUpperCase();
|
---|
2440 | break
|
---|
2441 | }
|
---|
2442 | arg = /[def]/.test(match[8]) && match[3] && arg >= 0 ? "+" + arg : arg;
|
---|
2443 | pad_character = match[4] ? match[4] == "0" ? "0" : match[4].charAt(1) : " ";
|
---|
2444 | pad_length = match[6] - String(arg).length;
|
---|
2445 | pad = match[6] ? str_repeat(pad_character, pad_length) : "";
|
---|
2446 | output.push(match[5] ? arg + pad : pad + arg)
|
---|
2447 | }
|
---|
2448 | }
|
---|
2449 | return output.join("")
|
---|
2450 | };
|
---|
2451 | str_format.cache = {};
|
---|
2452 | str_format.parse = function (fmt) {
|
---|
2453 | var _fmt = fmt,
|
---|
2454 | match = [],
|
---|
2455 | parse_tree = [],
|
---|
2456 | arg_names = 0;
|
---|
2457 | while (_fmt) {
|
---|
2458 | if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
|
---|
2459 | parse_tree.push(match[0])
|
---|
2460 | } else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
|
---|
2461 | parse_tree.push("%")
|
---|
2462 | } else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
|
---|
2463 | if (match[2]) {
|
---|
2464 | arg_names |= 1;
|
---|
2465 | var field_list = [],
|
---|
2466 | replacement_field = match[2],
|
---|
2467 | field_match = [];
|
---|
2468 | if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
|
---|
2469 | field_list.push(field_match[1]);
|
---|
2470 | while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
|
---|
2471 | if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
|
---|
2472 | field_list.push(field_match[1])
|
---|
2473 | } else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
|
---|
2474 | field_list.push(field_match[1])
|
---|
2475 | } else {
|
---|
2476 | throw "[sprintf] huh?"
|
---|
2477 | }
|
---|
2478 | }
|
---|
2479 | } else {
|
---|
2480 | throw "[sprintf] huh?"
|
---|
2481 | }
|
---|
2482 | match[2] = field_list
|
---|
2483 | } else {
|
---|
2484 | arg_names |= 2
|
---|
2485 | }
|
---|
2486 | if (arg_names === 3) {
|
---|
2487 | throw "[sprintf] mixing positional and named placeholders is not (yet) supported"
|
---|
2488 | }
|
---|
2489 | parse_tree.push(match)
|
---|
2490 | } else {
|
---|
2491 | throw "[sprintf] huh?"
|
---|
2492 | }
|
---|
2493 | _fmt = _fmt.substring(match[0].length)
|
---|
2494 | }
|
---|
2495 | return parse_tree
|
---|
2496 | };
|
---|
2497 | return str_format
|
---|
2498 | }();
|
---|
2499 | var vsprintf = function (fmt, argv) {
|
---|
2500 | argv.unshift(fmt);
|
---|
2501 | return sprintf.apply(null, argv)
|
---|
2502 | };
|
---|
2503 | addPostProcessor("sprintf", function (val, key, opts) {
|
---|
2504 | if (!opts.sprintf)
|
---|
2505 | return val;
|
---|
2506 | if (Object.prototype.toString.apply(opts.sprintf) === "[object Array]") {
|
---|
2507 | return vsprintf(val, opts.sprintf)
|
---|
2508 | } else if (typeof opts.sprintf === "object") {
|
---|
2509 | return sprintf(val, opts.sprintf)
|
---|
2510 | }
|
---|
2511 | return val
|
---|
2512 | });
|
---|
2513 | i18n.init = init;
|
---|
2514 | i18n.isInitialized = isInitialized;
|
---|
2515 | i18n.setLng = setLng;
|
---|
2516 | i18n.preload = preload;
|
---|
2517 | i18n.addResourceBundle = addResourceBundle;
|
---|
2518 | i18n.hasResourceBundle = hasResourceBundle;
|
---|
2519 | i18n.getResourceBundle = getResourceBundle;
|
---|
2520 | i18n.addResource = addResource;
|
---|
2521 | i18n.addResources = addResources;
|
---|
2522 | i18n.removeResourceBundle = removeResourceBundle;
|
---|
2523 | i18n.loadNamespace = loadNamespace;
|
---|
2524 | i18n.loadNamespaces = loadNamespaces;
|
---|
2525 | i18n.setDefaultNamespace = setDefaultNamespace;
|
---|
2526 | i18n.t = translate;
|
---|
2527 | i18n.translate = translate;
|
---|
2528 | i18n.exists = exists;
|
---|
2529 | i18n.detectLanguage = f.detectLanguage;
|
---|
2530 | i18n.pluralExtensions = pluralExtensions;
|
---|
2531 | i18n.sync = sync;
|
---|
2532 | i18n.functions = f;
|
---|
2533 | i18n.lng = lng;
|
---|
2534 | i18n.dir = dir;
|
---|
2535 | i18n.addPostProcessor = addPostProcessor;
|
---|
2536 | i18n.applyReplacement = f.applyReplacement;
|
---|
2537 | i18n.options = o;
|
---|
2538 | i18n.noConflict = noConflict
|
---|
2539 | })(typeof exports === "undefined" ? window : exports)
|
---|
2540 | }, {}],
|
---|
2541 | moment: [function (require, module, exports) {
|
---|
2542 | (function (global, factory) {
|
---|
2543 | typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.moment = factory()
|
---|
2544 | })(this, function () {
|
---|
2545 | "use strict";
|
---|
2546 | var hookCallback;
|
---|
2547 |
|
---|
2548 | function hooks() {
|
---|
2549 | return hookCallback.apply(null, arguments)
|
---|
2550 | }
|
---|
2551 |
|
---|
2552 | function setHookCallback(callback) {
|
---|
2553 | hookCallback = callback
|
---|
2554 | }
|
---|
2555 |
|
---|
2556 | function isArray(input) {
|
---|
2557 | return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]"
|
---|
2558 | }
|
---|
2559 |
|
---|
2560 | function isObject(input) {
|
---|
2561 | return input != null && Object.prototype.toString.call(input) === "[object Object]"
|
---|
2562 | }
|
---|
2563 |
|
---|
2564 | function isObjectEmpty(obj) {
|
---|
2565 | var k;
|
---|
2566 | for (k in obj) {
|
---|
2567 | return false
|
---|
2568 | }
|
---|
2569 | return true
|
---|
2570 | }
|
---|
2571 |
|
---|
2572 | function isNumber(input) {
|
---|
2573 | return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]"
|
---|
2574 | }
|
---|
2575 |
|
---|
2576 | function isDate(input) {
|
---|
2577 | return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]"
|
---|
2578 | }
|
---|
2579 |
|
---|
2580 | function map(arr, fn) {
|
---|
2581 | var res = [],
|
---|
2582 | i;
|
---|
2583 | for (i = 0; i < arr.length; ++i) {
|
---|
2584 | res.push(fn(arr[i], i))
|
---|
2585 | }
|
---|
2586 | return res
|
---|
2587 | }
|
---|
2588 |
|
---|
2589 | function hasOwnProp(a, b) {
|
---|
2590 | return Object.prototype.hasOwnProperty.call(a, b)
|
---|
2591 | }
|
---|
2592 |
|
---|
2593 | function extend(a, b) {
|
---|
2594 | for (var i in b) {
|
---|
2595 | if (hasOwnProp(b, i)) {
|
---|
2596 | a[i] = b[i]
|
---|
2597 | }
|
---|
2598 | }
|
---|
2599 | if (hasOwnProp(b, "toString")) {
|
---|
2600 | a.toString = b.toString
|
---|
2601 | }
|
---|
2602 | if (hasOwnProp(b, "valueOf")) {
|
---|
2603 | a.valueOf = b.valueOf
|
---|
2604 | }
|
---|
2605 | return a
|
---|
2606 | }
|
---|
2607 |
|
---|
2608 | function createUTC(input, format, locale, strict) {
|
---|
2609 | return createLocalOrUTC(input, format, locale, strict, true).utc()
|
---|
2610 | }
|
---|
2611 |
|
---|
2612 | function defaultParsingFlags() {
|
---|
2613 | return {
|
---|
2614 | empty: false,
|
---|
2615 | unusedTokens: [],
|
---|
2616 | unusedInput: [],
|
---|
2617 | overflow: -2,
|
---|
2618 | charsLeftOver: 0,
|
---|
2619 | nullInput: false,
|
---|
2620 | invalidMonth: null,
|
---|
2621 | invalidFormat: false,
|
---|
2622 | userInvalidated: false,
|
---|
2623 | iso: false,
|
---|
2624 | parsedDateParts: [],
|
---|
2625 | meridiem: null
|
---|
2626 | }
|
---|
2627 | }
|
---|
2628 |
|
---|
2629 | function getParsingFlags(m) {
|
---|
2630 | if (m._pf == null) {
|
---|
2631 | m._pf = defaultParsingFlags()
|
---|
2632 | }
|
---|
2633 | return m._pf
|
---|
2634 | }
|
---|
2635 | var some;
|
---|
2636 | if (Array.prototype.some) {
|
---|
2637 | some = Array.prototype.some
|
---|
2638 | } else {
|
---|
2639 | some = function (fun) {
|
---|
2640 | var t = Object(this);
|
---|
2641 | var len = t.length >>> 0;
|
---|
2642 | for (var i = 0; i < len; i++) {
|
---|
2643 | if (i in t && fun.call(this, t[i], i, t)) {
|
---|
2644 | return true
|
---|
2645 | }
|
---|
2646 | }
|
---|
2647 | return false
|
---|
2648 | }
|
---|
2649 | }
|
---|
2650 | var some$1 = some;
|
---|
2651 |
|
---|
2652 | function isValid(m) {
|
---|
2653 | if (m._isValid == null) {
|
---|
2654 | var flags = getParsingFlags(m);
|
---|
2655 | var parsedParts = some$1.call(flags.parsedDateParts, function (i) {
|
---|
2656 | return i != null
|
---|
2657 | });
|
---|
2658 | var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
|
---|
2659 | if (m._strict) {
|
---|
2660 | isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined
|
---|
2661 | }
|
---|
2662 | if (Object.isFrozen == null || !Object.isFrozen(m)) {
|
---|
2663 | m._isValid = isNowValid
|
---|
2664 | } else {
|
---|
2665 | return isNowValid
|
---|
2666 | }
|
---|
2667 | }
|
---|
2668 | return m._isValid
|
---|
2669 | }
|
---|
2670 |
|
---|
2671 | function createInvalid(flags) {
|
---|
2672 | var m = createUTC(NaN);
|
---|
2673 | if (flags != null) {
|
---|
2674 | extend(getParsingFlags(m), flags)
|
---|
2675 | } else {
|
---|
2676 | getParsingFlags(m).userInvalidated = true
|
---|
2677 | }
|
---|
2678 | return m
|
---|
2679 | }
|
---|
2680 |
|
---|
2681 | function isUndefined(input) {
|
---|
2682 | return input === void 0
|
---|
2683 | }
|
---|
2684 | var momentProperties = hooks.momentProperties = [];
|
---|
2685 |
|
---|
2686 | function copyConfig(to, from) {
|
---|
2687 | var i, prop, val;
|
---|
2688 | if (!isUndefined(from._isAMomentObject)) {
|
---|
2689 | to._isAMomentObject = from._isAMomentObject
|
---|
2690 | }
|
---|
2691 | if (!isUndefined(from._i)) {
|
---|
2692 | to._i = from._i
|
---|
2693 | }
|
---|
2694 | if (!isUndefined(from._f)) {
|
---|
2695 | to._f = from._f
|
---|
2696 | }
|
---|
2697 | if (!isUndefined(from._l)) {
|
---|
2698 | to._l = from._l
|
---|
2699 | }
|
---|
2700 | if (!isUndefined(from._strict)) {
|
---|
2701 | to._strict = from._strict
|
---|
2702 | }
|
---|
2703 | if (!isUndefined(from._tzm)) {
|
---|
2704 | to._tzm = from._tzm
|
---|
2705 | }
|
---|
2706 | if (!isUndefined(from._isUTC)) {
|
---|
2707 | to._isUTC = from._isUTC
|
---|
2708 | }
|
---|
2709 | if (!isUndefined(from._offset)) {
|
---|
2710 | to._offset = from._offset
|
---|
2711 | }
|
---|
2712 | if (!isUndefined(from._pf)) {
|
---|
2713 | to._pf = getParsingFlags(from)
|
---|
2714 | }
|
---|
2715 | if (!isUndefined(from._locale)) {
|
---|
2716 | to._locale = from._locale
|
---|
2717 | }
|
---|
2718 | if (momentProperties.length > 0) {
|
---|
2719 | for (i in momentProperties) {
|
---|
2720 | prop = momentProperties[i];
|
---|
2721 | val = from[prop];
|
---|
2722 | if (!isUndefined(val)) {
|
---|
2723 | to[prop] = val
|
---|
2724 | }
|
---|
2725 | }
|
---|
2726 | }
|
---|
2727 | return to
|
---|
2728 | }
|
---|
2729 | var updateInProgress = false;
|
---|
2730 |
|
---|
2731 | function Moment(config) {
|
---|
2732 | copyConfig(this, config);
|
---|
2733 | this._d = new Date(config._d != null ? config._d.getTime() : NaN);
|
---|
2734 | if (!this.isValid()) {
|
---|
2735 | this._d = new Date(NaN)
|
---|
2736 | }
|
---|
2737 | if (updateInProgress === false) {
|
---|
2738 | updateInProgress = true;
|
---|
2739 | hooks.updateOffset(this);
|
---|
2740 | updateInProgress = false
|
---|
2741 | }
|
---|
2742 | }
|
---|
2743 |
|
---|
2744 | function isMoment(obj) {
|
---|
2745 | return obj instanceof Moment || obj != null && obj._isAMomentObject != null
|
---|
2746 | }
|
---|
2747 |
|
---|
2748 | function absFloor(number) {
|
---|
2749 | if (number < 0) {
|
---|
2750 | return Math.ceil(number) || 0
|
---|
2751 | } else {
|
---|
2752 | return Math.floor(number)
|
---|
2753 | }
|
---|
2754 | }
|
---|
2755 |
|
---|
2756 | function toInt(argumentForCoercion) {
|
---|
2757 | var coercedNumber = +argumentForCoercion,
|
---|
2758 | value = 0;
|
---|
2759 | if (coercedNumber !== 0 && isFinite(coercedNumber)) {
|
---|
2760 | value = absFloor(coercedNumber)
|
---|
2761 | }
|
---|
2762 | return value
|
---|
2763 | }
|
---|
2764 |
|
---|
2765 | function compareArrays(array1, array2, dontConvert) {
|
---|
2766 | var len = Math.min(array1.length, array2.length),
|
---|
2767 | lengthDiff = Math.abs(array1.length - array2.length),
|
---|
2768 | diffs = 0,
|
---|
2769 | i;
|
---|
2770 | for (i = 0; i < len; i++) {
|
---|
2771 | if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
|
---|
2772 | diffs++
|
---|
2773 | }
|
---|
2774 | }
|
---|
2775 | return diffs + lengthDiff
|
---|
2776 | }
|
---|
2777 |
|
---|
2778 | function warn(msg) {
|
---|
2779 | if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
|
---|
2780 | console.warn("Deprecation warning: " + msg)
|
---|
2781 | }
|
---|
2782 | }
|
---|
2783 |
|
---|
2784 | function deprecate(msg, fn) {
|
---|
2785 | var firstTime = true;
|
---|
2786 | return extend(function () {
|
---|
2787 | if (hooks.deprecationHandler != null) {
|
---|
2788 | hooks.deprecationHandler(null, msg)
|
---|
2789 | }
|
---|
2790 | if (firstTime) {
|
---|
2791 | var args = [];
|
---|
2792 | var arg;
|
---|
2793 | for (var i = 0; i < arguments.length; i++) {
|
---|
2794 | arg = "";
|
---|
2795 | if (typeof arguments[i] === "object") {
|
---|
2796 | arg += "\n[" + i + "] ";
|
---|
2797 | for (var key in arguments[0]) {
|
---|
2798 | arg += key + ": " + arguments[0][key] + ", "
|
---|
2799 | }
|
---|
2800 | arg = arg.slice(0, -2)
|
---|
2801 | } else {
|
---|
2802 | arg = arguments[i]
|
---|
2803 | }
|
---|
2804 | args.push(arg)
|
---|
2805 | }
|
---|
2806 | warn(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + (new Error).stack);
|
---|
2807 | firstTime = false
|
---|
2808 | }
|
---|
2809 | return fn.apply(this, arguments)
|
---|
2810 | }, fn)
|
---|
2811 | }
|
---|
2812 | var deprecations = {};
|
---|
2813 |
|
---|
2814 | function deprecateSimple(name, msg) {
|
---|
2815 | if (hooks.deprecationHandler != null) {
|
---|
2816 | hooks.deprecationHandler(name, msg)
|
---|
2817 | }
|
---|
2818 | if (!deprecations[name]) {
|
---|
2819 | warn(msg);
|
---|
2820 | deprecations[name] = true
|
---|
2821 | }
|
---|
2822 | }
|
---|
2823 | hooks.suppressDeprecationWarnings = false;
|
---|
2824 | hooks.deprecationHandler = null;
|
---|
2825 |
|
---|
2826 | function isFunction(input) {
|
---|
2827 | return input instanceof Function || Object.prototype.toString.call(input) === "[object Function]"
|
---|
2828 | }
|
---|
2829 |
|
---|
2830 | function set(config) {
|
---|
2831 | var prop, i;
|
---|
2832 | for (i in config) {
|
---|
2833 | prop = config[i];
|
---|
2834 | if (isFunction(prop)) {
|
---|
2835 | this[i] = prop
|
---|
2836 | } else {
|
---|
2837 | this["_" + i] = prop
|
---|
2838 | }
|
---|
2839 | }
|
---|
2840 | this._config = config;
|
---|
2841 | this._ordinalParseLenient = new RegExp(this._ordinalParse.source + "|" + /\d{1,2}/.source)
|
---|
2842 | }
|
---|
2843 |
|
---|
2844 | function mergeConfigs(parentConfig, childConfig) {
|
---|
2845 | var res = extend({}, parentConfig),
|
---|
2846 | prop;
|
---|
2847 | for (prop in childConfig) {
|
---|
2848 | if (hasOwnProp(childConfig, prop)) {
|
---|
2849 | if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
|
---|
2850 | res[prop] = {};
|
---|
2851 | extend(res[prop], parentConfig[prop]);
|
---|
2852 | extend(res[prop], childConfig[prop])
|
---|
2853 | } else if (childConfig[prop] != null) {
|
---|
2854 | res[prop] = childConfig[prop]
|
---|
2855 | } else {
|
---|
2856 | delete res[prop]
|
---|
2857 | }
|
---|
2858 | }
|
---|
2859 | }
|
---|
2860 | for (prop in parentConfig) {
|
---|
2861 | if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
|
---|
2862 | res[prop] = extend({}, res[prop])
|
---|
2863 | }
|
---|
2864 | }
|
---|
2865 | return res
|
---|
2866 | }
|
---|
2867 |
|
---|
2868 | function Locale(config) {
|
---|
2869 | if (config != null) {
|
---|
2870 | this.set(config)
|
---|
2871 | }
|
---|
2872 | }
|
---|
2873 | var keys;
|
---|
2874 | if (Object.keys) {
|
---|
2875 | keys = Object.keys
|
---|
2876 | } else {
|
---|
2877 | keys = function (obj) {
|
---|
2878 | var i, res = [];
|
---|
2879 | for (i in obj) {
|
---|
2880 | if (hasOwnProp(obj, i)) {
|
---|
2881 | res.push(i)
|
---|
2882 | }
|
---|
2883 | }
|
---|
2884 | return res
|
---|
2885 | }
|
---|
2886 | }
|
---|
2887 | var keys$1 = keys;
|
---|
2888 | var defaultCalendar = {
|
---|
2889 | sameDay: "[Today at] LT",
|
---|
2890 | nextDay: "[Tomorrow at] LT",
|
---|
2891 | nextWeek: "dddd [at] LT",
|
---|
2892 | lastDay: "[Yesterday at] LT",
|
---|
2893 | lastWeek: "[Last] dddd [at] LT",
|
---|
2894 | sameElse: "L"
|
---|
2895 | };
|
---|
2896 |
|
---|
2897 | function calendar(key, mom, now) {
|
---|
2898 | var output = this._calendar[key] || this._calendar["sameElse"];
|
---|
2899 | return isFunction(output) ? output.call(mom, now) : output
|
---|
2900 | }
|
---|
2901 | var defaultLongDateFormat = {
|
---|
2902 | LTS: "h:mm:ss A",
|
---|
2903 | LT: "h:mm A",
|
---|
2904 | L: "MM/DD/YYYY",
|
---|
2905 | LL: "MMMM D, YYYY",
|
---|
2906 | LLL: "MMMM D, YYYY h:mm A",
|
---|
2907 | LLLL: "dddd, MMMM D, YYYY h:mm A"
|
---|
2908 | };
|
---|
2909 |
|
---|
2910 | function longDateFormat(key) {
|
---|
2911 | var format = this._longDateFormat[key],
|
---|
2912 | formatUpper = this._longDateFormat[key.toUpperCase()];
|
---|
2913 | if (format || !formatUpper) {
|
---|
2914 | return format
|
---|
2915 | }
|
---|
2916 | this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
|
---|
2917 | return val.slice(1)
|
---|
2918 | });
|
---|
2919 | return this._longDateFormat[key]
|
---|
2920 | }
|
---|
2921 | var defaultInvalidDate = "Invalid date";
|
---|
2922 |
|
---|
2923 | function invalidDate() {
|
---|
2924 | return this._invalidDate
|
---|
2925 | }
|
---|
2926 | var defaultOrdinal = "%d";
|
---|
2927 | var defaultOrdinalParse = /\d{1,2}/;
|
---|
2928 |
|
---|
2929 | function ordinal(number) {
|
---|
2930 | return this._ordinal.replace("%d", number)
|
---|
2931 | }
|
---|
2932 | var defaultRelativeTime = {
|
---|
2933 | future: "in %s",
|
---|
2934 | past: "%s ago",
|
---|
2935 | s: "a few seconds",
|
---|
2936 | m: "a minute",
|
---|
2937 | mm: "%d minutes",
|
---|
2938 | h: "an hour",
|
---|
2939 | hh: "%d hours",
|
---|
2940 | d: "a day",
|
---|
2941 | dd: "%d days",
|
---|
2942 | M: "a month",
|
---|
2943 | MM: "%d months",
|
---|
2944 | y: "a year",
|
---|
2945 | yy: "%d years"
|
---|
2946 | };
|
---|
2947 |
|
---|
2948 | function relativeTime(number, withoutSuffix, string, isFuture) {
|
---|
2949 | var output = this._relativeTime[string];
|
---|
2950 | return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number)
|
---|
2951 | }
|
---|
2952 |
|
---|
2953 | function pastFuture(diff, output) {
|
---|
2954 | var format = this._relativeTime[diff > 0 ? "future" : "past"];
|
---|
2955 | return isFunction(format) ? format(output) : format.replace(/%s/i, output)
|
---|
2956 | }
|
---|
2957 | var aliases = {};
|
---|
2958 |
|
---|
2959 | function addUnitAlias(unit, shorthand) {
|
---|
2960 | var lowerCase = unit.toLowerCase();
|
---|
2961 | aliases[lowerCase] = aliases[lowerCase + "s"] = aliases[shorthand] = unit
|
---|
2962 | }
|
---|
2963 |
|
---|
2964 | function normalizeUnits(units) {
|
---|
2965 | return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : undefined
|
---|
2966 | }
|
---|
2967 |
|
---|
2968 | function normalizeObjectUnits(inputObject) {
|
---|
2969 | var normalizedInput = {},
|
---|
2970 | normalizedProp, prop;
|
---|
2971 | for (prop in inputObject) {
|
---|
2972 | if (hasOwnProp(inputObject, prop)) {
|
---|
2973 | normalizedProp = normalizeUnits(prop);
|
---|
2974 | if (normalizedProp) {
|
---|
2975 | normalizedInput[normalizedProp] = inputObject[prop]
|
---|
2976 | }
|
---|
2977 | }
|
---|
2978 | }
|
---|
2979 | return normalizedInput
|
---|
2980 | }
|
---|
2981 | var priorities = {};
|
---|
2982 |
|
---|
2983 | function addUnitPriority(unit, priority) {
|
---|
2984 | priorities[unit] = priority
|
---|
2985 | }
|
---|
2986 |
|
---|
2987 | function getPrioritizedUnits(unitsObj) {
|
---|
2988 | var units = [];
|
---|
2989 | for (var u in unitsObj) {
|
---|
2990 | units.push({
|
---|
2991 | unit: u,
|
---|
2992 | priority: priorities[u]
|
---|
2993 | })
|
---|
2994 | }
|
---|
2995 | units.sort(function (a, b) {
|
---|
2996 | return a.priority - b.priority
|
---|
2997 | });
|
---|
2998 | return units
|
---|
2999 | }
|
---|
3000 |
|
---|
3001 | function makeGetSet(unit, keepTime) {
|
---|
3002 | return function (value) {
|
---|
3003 | if (value != null) {
|
---|
3004 | set$1(this, unit, value);
|
---|
3005 | hooks.updateOffset(this, keepTime);
|
---|
3006 | return this
|
---|
3007 | } else {
|
---|
3008 | return get(this, unit)
|
---|
3009 | }
|
---|
3010 | }
|
---|
3011 | }
|
---|
3012 |
|
---|
3013 | function get(mom, unit) {
|
---|
3014 | return mom.isValid() ? mom._d["get" + (mom._isUTC ? "UTC" : "") + unit]() : NaN
|
---|
3015 | }
|
---|
3016 |
|
---|
3017 | function set$1(mom, unit, value) {
|
---|
3018 | if (mom.isValid()) {
|
---|
3019 | mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value)
|
---|
3020 | }
|
---|
3021 | }
|
---|
3022 |
|
---|
3023 | function stringGet(units) {
|
---|
3024 | units = normalizeUnits(units);
|
---|
3025 | if (isFunction(this[units])) {
|
---|
3026 | return this[units]()
|
---|
3027 | }
|
---|
3028 | return this
|
---|
3029 | }
|
---|
3030 |
|
---|
3031 | function stringSet(units, value) {
|
---|
3032 | if (typeof units === "object") {
|
---|
3033 | units = normalizeObjectUnits(units);
|
---|
3034 | var prioritized = getPrioritizedUnits(units);
|
---|
3035 | for (var i = 0; i < prioritized.length; i++) {
|
---|
3036 | this[prioritized[i].unit](units[prioritized[i].unit])
|
---|
3037 | }
|
---|
3038 | } else {
|
---|
3039 | units = normalizeUnits(units);
|
---|
3040 | if (isFunction(this[units])) {
|
---|
3041 | return this[units](value)
|
---|
3042 | }
|
---|
3043 | }
|
---|
3044 | return this
|
---|
3045 | }
|
---|
3046 |
|
---|
3047 | function zeroFill(number, targetLength, forceSign) {
|
---|
3048 | var absNumber = "" + Math.abs(number),
|
---|
3049 | zerosToFill = targetLength - absNumber.length,
|
---|
3050 | sign = number >= 0;
|
---|
3051 | return (sign ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber
|
---|
3052 | }
|
---|
3053 | var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
|
---|
3054 | var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
|
---|
3055 | var formatFunctions = {};
|
---|
3056 | var formatTokenFunctions = {};
|
---|
3057 |
|
---|
3058 | function addFormatToken(token, padded, ordinal, callback) {
|
---|
3059 | var func = callback;
|
---|
3060 | if (typeof callback === "string") {
|
---|
3061 | func = function () {
|
---|
3062 | return this[callback]()
|
---|
3063 | }
|
---|
3064 | }
|
---|
3065 | if (token) {
|
---|
3066 | formatTokenFunctions[token] = func
|
---|
3067 | }
|
---|
3068 | if (padded) {
|
---|
3069 | formatTokenFunctions[padded[0]] = function () {
|
---|
3070 | return zeroFill(func.apply(this, arguments), padded[1], padded[2])
|
---|
3071 | }
|
---|
3072 | }
|
---|
3073 | if (ordinal) {
|
---|
3074 | formatTokenFunctions[ordinal] = function () {
|
---|
3075 | return this.localeData().ordinal(func.apply(this, arguments), token)
|
---|
3076 | }
|
---|
3077 | }
|
---|
3078 | }
|
---|
3079 |
|
---|
3080 | function removeFormattingTokens(input) {
|
---|
3081 | if (input.match(/\[[\s\S]/)) {
|
---|
3082 | return input.replace(/^\[|\]$/g, "")
|
---|
3083 | }
|
---|
3084 | return input.replace(/\\/g, "")
|
---|
3085 | }
|
---|
3086 |
|
---|
3087 | function makeFormatFunction(format) {
|
---|
3088 | var array = format.match(formattingTokens),
|
---|
3089 | i, length;
|
---|
3090 | for (i = 0, length = array.length; i < length; i++) {
|
---|
3091 | if (formatTokenFunctions[array[i]]) {
|
---|
3092 | array[i] = formatTokenFunctions[array[i]]
|
---|
3093 | } else {
|
---|
3094 | array[i] = removeFormattingTokens(array[i])
|
---|
3095 | }
|
---|
3096 | }
|
---|
3097 | return function (mom) {
|
---|
3098 | var output = "",
|
---|
3099 | i;
|
---|
3100 | for (i = 0; i < length; i++) {
|
---|
3101 | output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]
|
---|
3102 | }
|
---|
3103 | return output
|
---|
3104 | }
|
---|
3105 | }
|
---|
3106 |
|
---|
3107 | function formatMoment(m, format) {
|
---|
3108 | if (!m.isValid()) {
|
---|
3109 | return m.localeData().invalidDate()
|
---|
3110 | }
|
---|
3111 | format = expandFormat(format, m.localeData());
|
---|
3112 | formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
|
---|
3113 | return formatFunctions[format](m)
|
---|
3114 | }
|
---|
3115 |
|
---|
3116 | function expandFormat(format, locale) {
|
---|
3117 | var i = 5;
|
---|
3118 |
|
---|
3119 | function replaceLongDateFormatTokens(input) {
|
---|
3120 | return locale.longDateFormat(input) || input
|
---|
3121 | }
|
---|
3122 | localFormattingTokens.lastIndex = 0;
|
---|
3123 | while (i >= 0 && localFormattingTokens.test(format)) {
|
---|
3124 | format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
|
---|
3125 | localFormattingTokens.lastIndex = 0;
|
---|
3126 | i -= 1
|
---|
3127 | }
|
---|
3128 | return format
|
---|
3129 | }
|
---|
3130 | var match1 = /\d/;
|
---|
3131 | var match2 = /\d\d/;
|
---|
3132 | var match3 = /\d{3}/;
|
---|
3133 | var match4 = /\d{4}/;
|
---|
3134 | var match6 = /[+-]?\d{6}/;
|
---|
3135 | var match1to2 = /\d\d?/;
|
---|
3136 | var match3to4 = /\d\d\d\d?/;
|
---|
3137 | var match5to6 = /\d\d\d\d\d\d?/;
|
---|
3138 | var match1to3 = /\d{1,3}/;
|
---|
3139 | var match1to4 = /\d{1,4}/;
|
---|
3140 | var match1to6 = /[+-]?\d{1,6}/;
|
---|
3141 | var matchUnsigned = /\d+/;
|
---|
3142 | var matchSigned = /[+-]?\d+/;
|
---|
3143 | var matchOffset = /Z|[+-]\d\d:?\d\d/gi;
|
---|
3144 | var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi;
|
---|
3145 | var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/;
|
---|
3146 | var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
|
---|
3147 | var regexes = {};
|
---|
3148 |
|
---|
3149 | function addRegexToken(token, regex, strictRegex) {
|
---|
3150 | regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
|
---|
3151 | return isStrict && strictRegex ? strictRegex : regex
|
---|
3152 | }
|
---|
3153 | }
|
---|
3154 |
|
---|
3155 | function getParseRegexForToken(token, config) {
|
---|
3156 | if (!hasOwnProp(regexes, token)) {
|
---|
3157 | return new RegExp(unescapeFormat(token))
|
---|
3158 | }
|
---|
3159 | return regexes[token](config._strict, config._locale)
|
---|
3160 | }
|
---|
3161 |
|
---|
3162 | function unescapeFormat(s) {
|
---|
3163 | return regexEscape(s.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
|
---|
3164 | return p1 || p2 || p3 || p4
|
---|
3165 | }))
|
---|
3166 | }
|
---|
3167 |
|
---|
3168 | function regexEscape(s) {
|
---|
3169 | return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
|
---|
3170 | }
|
---|
3171 | var tokens = {};
|
---|
3172 |
|
---|
3173 | function addParseToken(token, callback) {
|
---|
3174 | var i, func = callback;
|
---|
3175 | if (typeof token === "string") {
|
---|
3176 | token = [token]
|
---|
3177 | }
|
---|
3178 | if (isNumber(callback)) {
|
---|
3179 | func = function (input, array) {
|
---|
3180 | array[callback] = toInt(input)
|
---|
3181 | }
|
---|
3182 | }
|
---|
3183 | for (i = 0; i < token.length; i++) {
|
---|
3184 | tokens[token[i]] = func
|
---|
3185 | }
|
---|
3186 | }
|
---|
3187 |
|
---|
3188 | function addWeekParseToken(token, callback) {
|
---|
3189 | addParseToken(token, function (input, array, config, token) {
|
---|
3190 | config._w = config._w || {};
|
---|
3191 | callback(input, config._w, config, token)
|
---|
3192 | })
|
---|
3193 | }
|
---|
3194 |
|
---|
3195 | function addTimeToArrayFromToken(token, input, config) {
|
---|
3196 | if (input != null && hasOwnProp(tokens, token)) {
|
---|
3197 | tokens[token](input, config._a, config, token)
|
---|
3198 | }
|
---|
3199 | }
|
---|
3200 | var YEAR = 0;
|
---|
3201 | var MONTH = 1;
|
---|
3202 | var DATE = 2;
|
---|
3203 | var HOUR = 3;
|
---|
3204 | var MINUTE = 4;
|
---|
3205 | var SECOND = 5;
|
---|
3206 | var MILLISECOND = 6;
|
---|
3207 | var WEEK = 7;
|
---|
3208 | var WEEKDAY = 8;
|
---|
3209 | var indexOf;
|
---|
3210 | if (Array.prototype.indexOf) {
|
---|
3211 | indexOf = Array.prototype.indexOf
|
---|
3212 | } else {
|
---|
3213 | indexOf = function (o) {
|
---|
3214 | var i;
|
---|
3215 | for (i = 0; i < this.length; ++i) {
|
---|
3216 | if (this[i] === o) {
|
---|
3217 | return i
|
---|
3218 | }
|
---|
3219 | }
|
---|
3220 | return -1
|
---|
3221 | }
|
---|
3222 | }
|
---|
3223 | var indexOf$1 = indexOf;
|
---|
3224 |
|
---|
3225 | function daysInMonth(year, month) {
|
---|
3226 | return new Date(Date.UTC(year, month + 1, 0)).getUTCDate()
|
---|
3227 | }
|
---|
3228 | addFormatToken("M", ["MM", 2], "Mo", function () {
|
---|
3229 | return this.month() + 1
|
---|
3230 | });
|
---|
3231 | addFormatToken("MMM", 0, 0, function (format) {
|
---|
3232 | return this.localeData().monthsShort(this, format)
|
---|
3233 | });
|
---|
3234 | addFormatToken("MMMM", 0, 0, function (format) {
|
---|
3235 | return this.localeData().months(this, format)
|
---|
3236 | });
|
---|
3237 | addUnitAlias("month", "M");
|
---|
3238 | addUnitPriority("month", 8);
|
---|
3239 | addRegexToken("M", match1to2);
|
---|
3240 | addRegexToken("MM", match1to2, match2);
|
---|
3241 | addRegexToken("MMM", function (isStrict, locale) {
|
---|
3242 | return locale.monthsShortRegex(isStrict)
|
---|
3243 | });
|
---|
3244 | addRegexToken("MMMM", function (isStrict, locale) {
|
---|
3245 | return locale.monthsRegex(isStrict)
|
---|
3246 | });
|
---|
3247 | addParseToken(["M", "MM"], function (input, array) {
|
---|
3248 | array[MONTH] = toInt(input) - 1
|
---|
3249 | });
|
---|
3250 | addParseToken(["MMM", "MMMM"], function (input, array, config, token) {
|
---|
3251 | var month = config._locale.monthsParse(input, token, config._strict);
|
---|
3252 | if (month != null) {
|
---|
3253 | array[MONTH] = month
|
---|
3254 | } else {
|
---|
3255 | getParsingFlags(config).invalidMonth = input
|
---|
3256 | }
|
---|
3257 | });
|
---|
3258 | var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
|
---|
3259 | var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split("_");
|
---|
3260 |
|
---|
3261 | function localeMonths(m, format) {
|
---|
3262 | if (!m) {
|
---|
3263 | return this._months
|
---|
3264 | }
|
---|
3265 | return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? "format" : "standalone"][m.month()]
|
---|
3266 | }
|
---|
3267 | var defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");
|
---|
3268 |
|
---|
3269 | function localeMonthsShort(m, format) {
|
---|
3270 | if (!m) {
|
---|
3271 | return this._monthsShort
|
---|
3272 | }
|
---|
3273 | return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? "format" : "standalone"][m.month()]
|
---|
3274 | }
|
---|
3275 |
|
---|
3276 | function handleStrictParse(monthName, format, strict) {
|
---|
3277 | var i, ii, mom, llc = monthName.toLocaleLowerCase();
|
---|
3278 | if (!this._monthsParse) {
|
---|
3279 | this._monthsParse = [];
|
---|
3280 | this._longMonthsParse = [];
|
---|
3281 | this._shortMonthsParse = [];
|
---|
3282 | for (i = 0; i < 12; ++i) {
|
---|
3283 | mom = createUTC([2e3, i]);
|
---|
3284 | this._shortMonthsParse[i] = this.monthsShort(mom, "").toLocaleLowerCase();
|
---|
3285 | this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase()
|
---|
3286 | }
|
---|
3287 | }
|
---|
3288 | if (strict) {
|
---|
3289 | if (format === "MMM") {
|
---|
3290 | ii = indexOf$1.call(this._shortMonthsParse, llc);
|
---|
3291 | return ii !== -1 ? ii : null
|
---|
3292 | } else {
|
---|
3293 | ii = indexOf$1.call(this._longMonthsParse, llc);
|
---|
3294 | return ii !== -1 ? ii : null
|
---|
3295 | }
|
---|
3296 | } else {
|
---|
3297 | if (format === "MMM") {
|
---|
3298 | ii = indexOf$1.call(this._shortMonthsParse, llc);
|
---|
3299 | if (ii !== -1) {
|
---|
3300 | return ii
|
---|
3301 | }
|
---|
3302 | ii = indexOf$1.call(this._longMonthsParse, llc);
|
---|
3303 | return ii !== -1 ? ii : null
|
---|
3304 | } else {
|
---|
3305 | ii = indexOf$1.call(this._longMonthsParse, llc);
|
---|
3306 | if (ii !== -1) {
|
---|
3307 | return ii
|
---|
3308 | }
|
---|
3309 | ii = indexOf$1.call(this._shortMonthsParse, llc);
|
---|
3310 | return ii !== -1 ? ii : null
|
---|
3311 | }
|
---|
3312 | }
|
---|
3313 | }
|
---|
3314 |
|
---|
3315 | function localeMonthsParse(monthName, format, strict) {
|
---|
3316 | var i, mom, regex;
|
---|
3317 | if (this._monthsParseExact) {
|
---|
3318 | return handleStrictParse.call(this, monthName, format, strict)
|
---|
3319 | }
|
---|
3320 | if (!this._monthsParse) {
|
---|
3321 | this._monthsParse = [];
|
---|
3322 | this._longMonthsParse = [];
|
---|
3323 | this._shortMonthsParse = []
|
---|
3324 | }
|
---|
3325 | for (i = 0; i < 12; i++) {
|
---|
3326 | mom = createUTC([2e3, i]);
|
---|
3327 | if (strict && !this._longMonthsParse[i]) {
|
---|
3328 | this._longMonthsParse[i] = new RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i");
|
---|
3329 | this._shortMonthsParse[i] = new RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i")
|
---|
3330 | }
|
---|
3331 | if (!strict && !this._monthsParse[i]) {
|
---|
3332 | regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
|
---|
3333 | this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i")
|
---|
3334 | }
|
---|
3335 | if (strict && format === "MMMM" && this._longMonthsParse[i].test(monthName)) {
|
---|
3336 | return i
|
---|
3337 | } else if (strict && format === "MMM" && this._shortMonthsParse[i].test(monthName)) {
|
---|
3338 | return i
|
---|
3339 | } else if (!strict && this._monthsParse[i].test(monthName)) {
|
---|
3340 | return i
|
---|
3341 | }
|
---|
3342 | }
|
---|
3343 | }
|
---|
3344 |
|
---|
3345 | function setMonth(mom, value) {
|
---|
3346 | var dayOfMonth;
|
---|
3347 | if (!mom.isValid()) {
|
---|
3348 | return mom
|
---|
3349 | }
|
---|
3350 | if (typeof value === "string") {
|
---|
3351 | if (/^\d+$/.test(value)) {
|
---|
3352 | value = toInt(value)
|
---|
3353 | } else {
|
---|
3354 | value = mom.localeData().monthsParse(value);
|
---|
3355 | if (!isNumber(value)) {
|
---|
3356 | return mom
|
---|
3357 | }
|
---|
3358 | }
|
---|
3359 | }
|
---|
3360 | dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
|
---|
3361 | mom._d["set" + (mom._isUTC ? "UTC" : "") + "Month"](value, dayOfMonth);
|
---|
3362 | return mom
|
---|
3363 | }
|
---|
3364 |
|
---|
3365 | function getSetMonth(value) {
|
---|
3366 | if (value != null) {
|
---|
3367 | setMonth(this, value);
|
---|
3368 | hooks.updateOffset(this, true);
|
---|
3369 | return this
|
---|
3370 | } else {
|
---|
3371 | return get(this, "Month")
|
---|
3372 | }
|
---|
3373 | }
|
---|
3374 |
|
---|
3375 | function getDaysInMonth() {
|
---|
3376 | return daysInMonth(this.year(), this.month())
|
---|
3377 | }
|
---|
3378 | var defaultMonthsShortRegex = matchWord;
|
---|
3379 |
|
---|
3380 | function monthsShortRegex(isStrict) {
|
---|
3381 | if (this._monthsParseExact) {
|
---|
3382 | if (!hasOwnProp(this, "_monthsRegex")) {
|
---|
3383 | computeMonthsParse.call(this)
|
---|
3384 | }
|
---|
3385 | if (isStrict) {
|
---|
3386 | return this._monthsShortStrictRegex
|
---|
3387 | } else {
|
---|
3388 | return this._monthsShortRegex
|
---|
3389 | }
|
---|
3390 | } else {
|
---|
3391 | if (!hasOwnProp(this, "_monthsShortRegex")) {
|
---|
3392 | this._monthsShortRegex = defaultMonthsShortRegex
|
---|
3393 | }
|
---|
3394 | return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex
|
---|
3395 | }
|
---|
3396 | }
|
---|
3397 | var defaultMonthsRegex = matchWord;
|
---|
3398 |
|
---|
3399 | function monthsRegex(isStrict) {
|
---|
3400 | if (this._monthsParseExact) {
|
---|
3401 | if (!hasOwnProp(this, "_monthsRegex")) {
|
---|
3402 | computeMonthsParse.call(this)
|
---|
3403 | }
|
---|
3404 | if (isStrict) {
|
---|
3405 | return this._monthsStrictRegex
|
---|
3406 | } else {
|
---|
3407 | return this._monthsRegex
|
---|
3408 | }
|
---|
3409 | } else {
|
---|
3410 | if (!hasOwnProp(this, "_monthsRegex")) {
|
---|
3411 | this._monthsRegex = defaultMonthsRegex
|
---|
3412 | }
|
---|
3413 | return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex
|
---|
3414 | }
|
---|
3415 | }
|
---|
3416 |
|
---|
3417 | function computeMonthsParse() {
|
---|
3418 | function cmpLenRev(a, b) {
|
---|
3419 | return b.length - a.length
|
---|
3420 | }
|
---|
3421 | var shortPieces = [],
|
---|
3422 | longPieces = [],
|
---|
3423 | mixedPieces = [],
|
---|
3424 | i, mom;
|
---|
3425 | for (i = 0; i < 12; i++) {
|
---|
3426 | mom = createUTC([2e3, i]);
|
---|
3427 | shortPieces.push(this.monthsShort(mom, ""));
|
---|
3428 | longPieces.push(this.months(mom, ""));
|
---|
3429 | mixedPieces.push(this.months(mom, ""));
|
---|
3430 | mixedPieces.push(this.monthsShort(mom, ""))
|
---|
3431 | }
|
---|
3432 | shortPieces.sort(cmpLenRev);
|
---|
3433 | longPieces.sort(cmpLenRev);
|
---|
3434 | mixedPieces.sort(cmpLenRev);
|
---|
3435 | for (i = 0; i < 12; i++) {
|
---|
3436 | shortPieces[i] = regexEscape(shortPieces[i]);
|
---|
3437 | longPieces[i] = regexEscape(longPieces[i])
|
---|
3438 | }
|
---|
3439 | for (i = 0; i < 24; i++) {
|
---|
3440 | mixedPieces[i] = regexEscape(mixedPieces[i])
|
---|
3441 | }
|
---|
3442 | this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
|
---|
3443 | this._monthsShortRegex = this._monthsRegex;
|
---|
3444 | this._monthsStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i");
|
---|
3445 | this._monthsShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i")
|
---|
3446 | }
|
---|
3447 | addFormatToken("Y", 0, 0, function () {
|
---|
3448 | var y = this.year();
|
---|
3449 | return y <= 9999 ? "" + y : "+" + y
|
---|
3450 | });
|
---|
3451 | addFormatToken(0, ["YY", 2], 0, function () {
|
---|
3452 | return this.year() % 100
|
---|
3453 | });
|
---|
3454 | addFormatToken(0, ["YYYY", 4], 0, "year");
|
---|
3455 | addFormatToken(0, ["YYYYY", 5], 0, "year");
|
---|
3456 | addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
|
---|
3457 | addUnitAlias("year", "y");
|
---|
3458 | addUnitPriority("year", 1);
|
---|
3459 | addRegexToken("Y", matchSigned);
|
---|
3460 | addRegexToken("YY", match1to2, match2);
|
---|
3461 | addRegexToken("YYYY", match1to4, match4);
|
---|
3462 | addRegexToken("YYYYY", match1to6, match6);
|
---|
3463 | addRegexToken("YYYYYY", match1to6, match6);
|
---|
3464 | addParseToken(["YYYYY", "YYYYYY"], YEAR);
|
---|
3465 | addParseToken("YYYY", function (input, array) {
|
---|
3466 | array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input)
|
---|
3467 | });
|
---|
3468 | addParseToken("YY", function (input, array) {
|
---|
3469 | array[YEAR] = hooks.parseTwoDigitYear(input)
|
---|
3470 | });
|
---|
3471 | addParseToken("Y", function (input, array) {
|
---|
3472 | array[YEAR] = parseInt(input, 10)
|
---|
3473 | });
|
---|
3474 |
|
---|
3475 | function daysInYear(year) {
|
---|
3476 | return isLeapYear(year) ? 366 : 365
|
---|
3477 | }
|
---|
3478 |
|
---|
3479 | function isLeapYear(year) {
|
---|
3480 | return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0
|
---|
3481 | }
|
---|
3482 | hooks.parseTwoDigitYear = function (input) {
|
---|
3483 | return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3)
|
---|
3484 | };
|
---|
3485 | var getSetYear = makeGetSet("FullYear", true);
|
---|
3486 |
|
---|
3487 | function getIsLeapYear() {
|
---|
3488 | return isLeapYear(this.year())
|
---|
3489 | }
|
---|
3490 |
|
---|
3491 | function createDate(y, m, d, h, M, s, ms) {
|
---|
3492 | var date = new Date(y, m, d, h, M, s, ms);
|
---|
3493 | if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
|
---|
3494 | date.setFullYear(y)
|
---|
3495 | }
|
---|
3496 | return date
|
---|
3497 | }
|
---|
3498 |
|
---|
3499 | function createUTCDate(y) {
|
---|
3500 | var date = new Date(Date.UTC.apply(null, arguments));
|
---|
3501 | if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
|
---|
3502 | date.setUTCFullYear(y)
|
---|
3503 | }
|
---|
3504 | return date
|
---|
3505 | }
|
---|
3506 |
|
---|
3507 | function firstWeekOffset(year, dow, doy) {
|
---|
3508 | var fwd = 7 + dow - doy,
|
---|
3509 | fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
|
---|
3510 | return -fwdlw + fwd - 1
|
---|
3511 | }
|
---|
3512 |
|
---|
3513 | function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
|
---|
3514 | var localWeekday = (7 + weekday - dow) % 7,
|
---|
3515 | weekOffset = firstWeekOffset(year, dow, doy),
|
---|
3516 | dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
|
---|
3517 | resYear, resDayOfYear;
|
---|
3518 | if (dayOfYear <= 0) {
|
---|
3519 | resYear = year - 1;
|
---|
3520 | resDayOfYear = daysInYear(resYear) + dayOfYear
|
---|
3521 | } else if (dayOfYear > daysInYear(year)) {
|
---|
3522 | resYear = year + 1;
|
---|
3523 | resDayOfYear = dayOfYear - daysInYear(year)
|
---|
3524 | } else {
|
---|
3525 | resYear = year;
|
---|
3526 | resDayOfYear = dayOfYear
|
---|
3527 | }
|
---|
3528 | return {
|
---|
3529 | year: resYear,
|
---|
3530 | dayOfYear: resDayOfYear
|
---|
3531 | }
|
---|
3532 | }
|
---|
3533 |
|
---|
3534 | function weekOfYear(mom, dow, doy) {
|
---|
3535 | var weekOffset = firstWeekOffset(mom.year(), dow, doy),
|
---|
3536 | week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
|
---|
3537 | resWeek, resYear;
|
---|
3538 | if (week < 1) {
|
---|
3539 | resYear = mom.year() - 1;
|
---|
3540 | resWeek = week + weeksInYear(resYear, dow, doy)
|
---|
3541 | } else if (week > weeksInYear(mom.year(), dow, doy)) {
|
---|
3542 | resWeek = week - weeksInYear(mom.year(), dow, doy);
|
---|
3543 | resYear = mom.year() + 1
|
---|
3544 | } else {
|
---|
3545 | resYear = mom.year();
|
---|
3546 | resWeek = week
|
---|
3547 | }
|
---|
3548 | return {
|
---|
3549 | week: resWeek,
|
---|
3550 | year: resYear
|
---|
3551 | }
|
---|
3552 | }
|
---|
3553 |
|
---|
3554 | function weeksInYear(year, dow, doy) {
|
---|
3555 | var weekOffset = firstWeekOffset(year, dow, doy),
|
---|
3556 | weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
|
---|
3557 | return (daysInYear(year) - weekOffset + weekOffsetNext) / 7
|
---|
3558 | }
|
---|
3559 | addFormatToken("w", ["ww", 2], "wo", "week");
|
---|
3560 | addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
|
---|
3561 | addUnitAlias("week", "w");
|
---|
3562 | addUnitAlias("isoWeek", "W");
|
---|
3563 | addUnitPriority("week", 5);
|
---|
3564 | addUnitPriority("isoWeek", 5);
|
---|
3565 | addRegexToken("w", match1to2);
|
---|
3566 | addRegexToken("ww", match1to2, match2);
|
---|
3567 | addRegexToken("W", match1to2);
|
---|
3568 | addRegexToken("WW", match1to2, match2);
|
---|
3569 | addWeekParseToken(["w", "ww", "W", "WW"], function (input, week, config, token) {
|
---|
3570 | week[token.substr(0, 1)] = toInt(input)
|
---|
3571 | });
|
---|
3572 |
|
---|
3573 | function localeWeek(mom) {
|
---|
3574 | return weekOfYear(mom, this._week.dow, this._week.doy).week
|
---|
3575 | }
|
---|
3576 | var defaultLocaleWeek = {
|
---|
3577 | dow: 0,
|
---|
3578 | doy: 6
|
---|
3579 | };
|
---|
3580 |
|
---|
3581 | function localeFirstDayOfWeek() {
|
---|
3582 | return this._week.dow
|
---|
3583 | }
|
---|
3584 |
|
---|
3585 | function localeFirstDayOfYear() {
|
---|
3586 | return this._week.doy
|
---|
3587 | }
|
---|
3588 |
|
---|
3589 | function getSetWeek(input) {
|
---|
3590 | var week = this.localeData().week(this);
|
---|
3591 | return input == null ? week : this.add((input - week) * 7, "d")
|
---|
3592 | }
|
---|
3593 |
|
---|
3594 | function getSetISOWeek(input) {
|
---|
3595 | var week = weekOfYear(this, 1, 4).week;
|
---|
3596 | return input == null ? week : this.add((input - week) * 7, "d")
|
---|
3597 | }
|
---|
3598 | addFormatToken("d", 0, "do", "day");
|
---|
3599 | addFormatToken("dd", 0, 0, function (format) {
|
---|
3600 | return this.localeData().weekdaysMin(this, format)
|
---|
3601 | });
|
---|
3602 | addFormatToken("ddd", 0, 0, function (format) {
|
---|
3603 | return this.localeData().weekdaysShort(this, format)
|
---|
3604 | });
|
---|
3605 | addFormatToken("dddd", 0, 0, function (format) {
|
---|
3606 | return this.localeData().weekdays(this, format)
|
---|
3607 | });
|
---|
3608 | addFormatToken("e", 0, 0, "weekday");
|
---|
3609 | addFormatToken("E", 0, 0, "isoWeekday");
|
---|
3610 | addUnitAlias("day", "d");
|
---|
3611 | addUnitAlias("weekday", "e");
|
---|
3612 | addUnitAlias("isoWeekday", "E");
|
---|
3613 | addUnitPriority("day", 11);
|
---|
3614 | addUnitPriority("weekday", 11);
|
---|
3615 | addUnitPriority("isoWeekday", 11);
|
---|
3616 | addRegexToken("d", match1to2);
|
---|
3617 | addRegexToken("e", match1to2);
|
---|
3618 | addRegexToken("E", match1to2);
|
---|
3619 | addRegexToken("dd", function (isStrict, locale) {
|
---|
3620 | return locale.weekdaysMinRegex(isStrict)
|
---|
3621 | });
|
---|
3622 | addRegexToken("ddd", function (isStrict, locale) {
|
---|
3623 | return locale.weekdaysShortRegex(isStrict)
|
---|
3624 | });
|
---|
3625 | addRegexToken("dddd", function (isStrict, locale) {
|
---|
3626 | return locale.weekdaysRegex(isStrict)
|
---|
3627 | });
|
---|
3628 | addWeekParseToken(["dd", "ddd", "dddd"], function (input, week, config, token) {
|
---|
3629 | var weekday = config._locale.weekdaysParse(input, token, config._strict);
|
---|
3630 | if (weekday != null) {
|
---|
3631 | week.d = weekday
|
---|
3632 | } else {
|
---|
3633 | getParsingFlags(config).invalidWeekday = input
|
---|
3634 | }
|
---|
3635 | });
|
---|
3636 | addWeekParseToken(["d", "e", "E"], function (input, week, config, token) {
|
---|
3637 | week[token] = toInt(input)
|
---|
3638 | });
|
---|
3639 |
|
---|
3640 | function parseWeekday(input, locale) {
|
---|
3641 | if (typeof input !== "string") {
|
---|
3642 | return input
|
---|
3643 | }
|
---|
3644 | if (!isNaN(input)) {
|
---|
3645 | return parseInt(input, 10)
|
---|
3646 | }
|
---|
3647 | input = locale.weekdaysParse(input);
|
---|
3648 | if (typeof input === "number") {
|
---|
3649 | return input
|
---|
3650 | }
|
---|
3651 | return null
|
---|
3652 | }
|
---|
3653 |
|
---|
3654 | function parseIsoWeekday(input, locale) {
|
---|
3655 | if (typeof input === "string") {
|
---|
3656 | return locale.weekdaysParse(input) % 7 || 7
|
---|
3657 | }
|
---|
3658 | return isNaN(input) ? null : input
|
---|
3659 | }
|
---|
3660 | var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");
|
---|
3661 |
|
---|
3662 | function localeWeekdays(m, format) {
|
---|
3663 | if (!m) {
|
---|
3664 | return this._weekdays
|
---|
3665 | }
|
---|
3666 | return isArray(this._weekdays) ? this._weekdays[m.day()] : this._weekdays[this._weekdays.isFormat.test(format) ? "format" : "standalone"][m.day()]
|
---|
3667 | }
|
---|
3668 | var defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");
|
---|
3669 |
|
---|
3670 | function localeWeekdaysShort(m) {
|
---|
3671 | return m ? this._weekdaysShort[m.day()] : this._weekdaysShort
|
---|
3672 | }
|
---|
3673 | var defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_");
|
---|
3674 |
|
---|
3675 | function localeWeekdaysMin(m) {
|
---|
3676 | return m ? this._weekdaysMin[m.day()] : this._weekdaysMin
|
---|
3677 | }
|
---|
3678 |
|
---|
3679 | function handleStrictParse$1(weekdayName, format, strict) {
|
---|
3680 | var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
|
---|
3681 | if (!this._weekdaysParse) {
|
---|
3682 | this._weekdaysParse = [];
|
---|
3683 | this._shortWeekdaysParse = [];
|
---|
3684 | this._minWeekdaysParse = [];
|
---|
3685 | for (i = 0; i < 7; ++i) {
|
---|
3686 | mom = createUTC([2e3, 1]).day(i);
|
---|
3687 | this._minWeekdaysParse[i] = this.weekdaysMin(mom, "").toLocaleLowerCase();
|
---|
3688 | this._shortWeekdaysParse[i] = this.weekdaysShort(mom, "").toLocaleLowerCase();
|
---|
3689 | this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase()
|
---|
3690 | }
|
---|
3691 | }
|
---|
3692 | if (strict) {
|
---|
3693 | if (format === "dddd") {
|
---|
3694 | ii = indexOf$1.call(this._weekdaysParse, llc);
|
---|
3695 | return ii !== -1 ? ii : null
|
---|
3696 | } else if (format === "ddd") {
|
---|
3697 | ii = indexOf$1.call(this._shortWeekdaysParse, llc);
|
---|
3698 | return ii !== -1 ? ii : null
|
---|
3699 | } else {
|
---|
3700 | ii = indexOf$1.call(this._minWeekdaysParse, llc);
|
---|
3701 | return ii !== -1 ? ii : null
|
---|
3702 | }
|
---|
3703 | } else {
|
---|
3704 | if (format === "dddd") {
|
---|
3705 | ii = indexOf$1.call(this._weekdaysParse, llc);
|
---|
3706 | if (ii !== -1) {
|
---|
3707 | return ii
|
---|
3708 | }
|
---|
3709 | ii = indexOf$1.call(this._shortWeekdaysParse, llc);
|
---|
3710 | if (ii !== -1) {
|
---|
3711 | return ii
|
---|
3712 | }
|
---|
3713 | ii = indexOf$1.call(this._minWeekdaysParse, llc);
|
---|
3714 | return ii !== -1 ? ii : null
|
---|
3715 | } else if (format === "ddd") {
|
---|
3716 | ii = indexOf$1.call(this._shortWeekdaysParse, llc);
|
---|
3717 | if (ii !== -1) {
|
---|
3718 | return ii
|
---|
3719 | }
|
---|
3720 | ii = indexOf$1.call(this._weekdaysParse, llc);
|
---|
3721 | if (ii !== -1) {
|
---|
3722 | return ii
|
---|
3723 | }
|
---|
3724 | ii = indexOf$1.call(this._minWeekdaysParse, llc);
|
---|
3725 | return ii !== -1 ? ii : null
|
---|
3726 | } else {
|
---|
3727 | ii = indexOf$1.call(this._minWeekdaysParse, llc);
|
---|
3728 | if (ii !== -1) {
|
---|
3729 | return ii
|
---|
3730 | }
|
---|
3731 | ii = indexOf$1.call(this._weekdaysParse, llc);
|
---|
3732 | if (ii !== -1) {
|
---|
3733 | return ii
|
---|
3734 | }
|
---|
3735 | ii = indexOf$1.call(this._shortWeekdaysParse, llc);
|
---|
3736 | return ii !== -1 ? ii : null
|
---|
3737 | }
|
---|
3738 | }
|
---|
3739 | }
|
---|
3740 |
|
---|
3741 | function localeWeekdaysParse(weekdayName, format, strict) {
|
---|
3742 | var i, mom, regex;
|
---|
3743 | if (this._weekdaysParseExact) {
|
---|
3744 | return handleStrictParse$1.call(this, weekdayName, format, strict)
|
---|
3745 | }
|
---|
3746 | if (!this._weekdaysParse) {
|
---|
3747 | this._weekdaysParse = [];
|
---|
3748 | this._minWeekdaysParse = [];
|
---|
3749 | this._shortWeekdaysParse = [];
|
---|
3750 | this._fullWeekdaysParse = []
|
---|
3751 | }
|
---|
3752 | for (i = 0; i < 7; i++) {
|
---|
3753 | mom = createUTC([2e3, 1]).day(i);
|
---|
3754 | if (strict && !this._fullWeekdaysParse[i]) {
|
---|
3755 | this._fullWeekdaysParse[i] = new RegExp("^" + this.weekdays(mom, "").replace(".", ".?") + "$", "i");
|
---|
3756 | this._shortWeekdaysParse[i] = new RegExp("^" + this.weekdaysShort(mom, "").replace(".", ".?") + "$", "i");
|
---|
3757 | this._minWeekdaysParse[i] = new RegExp("^" + this.weekdaysMin(mom, "").replace(".", ".?") + "$", "i")
|
---|
3758 | }
|
---|
3759 | if (!this._weekdaysParse[i]) {
|
---|
3760 | regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
|
---|
3761 | this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i")
|
---|
3762 | }
|
---|
3763 | if (strict && format === "dddd" && this._fullWeekdaysParse[i].test(weekdayName)) {
|
---|
3764 | return i
|
---|
3765 | } else if (strict && format === "ddd" && this._shortWeekdaysParse[i].test(weekdayName)) {
|
---|
3766 | return i
|
---|
3767 | } else if (strict && format === "dd" && this._minWeekdaysParse[i].test(weekdayName)) {
|
---|
3768 | return i
|
---|
3769 | } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
|
---|
3770 | return i
|
---|
3771 | }
|
---|
3772 | }
|
---|
3773 | }
|
---|
3774 |
|
---|
3775 | function getSetDayOfWeek(input) {
|
---|
3776 | if (!this.isValid()) {
|
---|
3777 | return input != null ? this : NaN
|
---|
3778 | }
|
---|
3779 | var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
|
---|
3780 | if (input != null) {
|
---|
3781 | input = parseWeekday(input, this.localeData());
|
---|
3782 | return this.add(input - day, "d")
|
---|
3783 | } else {
|
---|
3784 | return day
|
---|
3785 | }
|
---|
3786 | }
|
---|
3787 |
|
---|
3788 | function getSetLocaleDayOfWeek(input) {
|
---|
3789 | if (!this.isValid()) {
|
---|
3790 | return input != null ? this : NaN
|
---|
3791 | }
|
---|
3792 | var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
|
---|
3793 | return input == null ? weekday : this.add(input - weekday, "d")
|
---|
3794 | }
|
---|
3795 |
|
---|
3796 | function getSetISODayOfWeek(input) {
|
---|
3797 | if (!this.isValid()) {
|
---|
3798 | return input != null ? this : NaN
|
---|
3799 | }
|
---|
3800 | if (input != null) {
|
---|
3801 | var weekday = parseIsoWeekday(input, this.localeData());
|
---|
3802 | return this.day(this.day() % 7 ? weekday : weekday - 7)
|
---|
3803 | } else {
|
---|
3804 | return this.day() || 7
|
---|
3805 | }
|
---|
3806 | }
|
---|
3807 | var defaultWeekdaysRegex = matchWord;
|
---|
3808 |
|
---|
3809 | function weekdaysRegex(isStrict) {
|
---|
3810 | if (this._weekdaysParseExact) {
|
---|
3811 | if (!hasOwnProp(this, "_weekdaysRegex")) {
|
---|
3812 | computeWeekdaysParse.call(this)
|
---|
3813 | }
|
---|
3814 | if (isStrict) {
|
---|
3815 | return this._weekdaysStrictRegex
|
---|
3816 | } else {
|
---|
3817 | return this._weekdaysRegex
|
---|
3818 | }
|
---|
3819 | } else {
|
---|
3820 | if (!hasOwnProp(this, "_weekdaysRegex")) {
|
---|
3821 | this._weekdaysRegex = defaultWeekdaysRegex
|
---|
3822 | }
|
---|
3823 | return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex
|
---|
3824 | }
|
---|
3825 | }
|
---|
3826 | var defaultWeekdaysShortRegex = matchWord;
|
---|
3827 |
|
---|
3828 | function weekdaysShortRegex(isStrict) {
|
---|
3829 | if (this._weekdaysParseExact) {
|
---|
3830 | if (!hasOwnProp(this, "_weekdaysRegex")) {
|
---|
3831 | computeWeekdaysParse.call(this)
|
---|
3832 | }
|
---|
3833 | if (isStrict) {
|
---|
3834 | return this._weekdaysShortStrictRegex
|
---|
3835 | } else {
|
---|
3836 | return this._weekdaysShortRegex
|
---|
3837 | }
|
---|
3838 | } else {
|
---|
3839 | if (!hasOwnProp(this, "_weekdaysShortRegex")) {
|
---|
3840 | this._weekdaysShortRegex = defaultWeekdaysShortRegex
|
---|
3841 | }
|
---|
3842 | return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex
|
---|
3843 | }
|
---|
3844 | }
|
---|
3845 | var defaultWeekdaysMinRegex = matchWord;
|
---|
3846 |
|
---|
3847 | function weekdaysMinRegex(isStrict) {
|
---|
3848 | if (this._weekdaysParseExact) {
|
---|
3849 | if (!hasOwnProp(this, "_weekdaysRegex")) {
|
---|
3850 | computeWeekdaysParse.call(this)
|
---|
3851 | }
|
---|
3852 | if (isStrict) {
|
---|
3853 | return this._weekdaysMinStrictRegex
|
---|
3854 | } else {
|
---|
3855 | return this._weekdaysMinRegex
|
---|
3856 | }
|
---|
3857 | } else {
|
---|
3858 | if (!hasOwnProp(this, "_weekdaysMinRegex")) {
|
---|
3859 | this._weekdaysMinRegex = defaultWeekdaysMinRegex
|
---|
3860 | }
|
---|
3861 | return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex
|
---|
3862 | }
|
---|
3863 | }
|
---|
3864 |
|
---|
3865 | function computeWeekdaysParse() {
|
---|
3866 | function cmpLenRev(a, b) {
|
---|
3867 | return b.length - a.length
|
---|
3868 | }
|
---|
3869 | var minPieces = [],
|
---|
3870 | shortPieces = [],
|
---|
3871 | longPieces = [],
|
---|
3872 | mixedPieces = [],
|
---|
3873 | i, mom, minp, shortp, longp;
|
---|
3874 | for (i = 0; i < 7; i++) {
|
---|
3875 | mom = createUTC([2e3, 1]).day(i);
|
---|
3876 | minp = this.weekdaysMin(mom, "");
|
---|
3877 | shortp = this.weekdaysShort(mom, "");
|
---|
3878 | longp = this.weekdays(mom, "");
|
---|
3879 | minPieces.push(minp);
|
---|
3880 | shortPieces.push(shortp);
|
---|
3881 | longPieces.push(longp);
|
---|
3882 | mixedPieces.push(minp);
|
---|
3883 | mixedPieces.push(shortp);
|
---|
3884 | mixedPieces.push(longp)
|
---|
3885 | }
|
---|
3886 | minPieces.sort(cmpLenRev);
|
---|
3887 | shortPieces.sort(cmpLenRev);
|
---|
3888 | longPieces.sort(cmpLenRev);
|
---|
3889 | mixedPieces.sort(cmpLenRev);
|
---|
3890 | for (i = 0; i < 7; i++) {
|
---|
3891 | shortPieces[i] = regexEscape(shortPieces[i]);
|
---|
3892 | longPieces[i] = regexEscape(longPieces[i]);
|
---|
3893 | mixedPieces[i] = regexEscape(mixedPieces[i])
|
---|
3894 | }
|
---|
3895 | this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
|
---|
3896 | this._weekdaysShortRegex = this._weekdaysRegex;
|
---|
3897 | this._weekdaysMinRegex = this._weekdaysRegex;
|
---|
3898 | this._weekdaysStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i");
|
---|
3899 | this._weekdaysShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i");
|
---|
3900 | this._weekdaysMinStrictRegex = new RegExp("^(" + minPieces.join("|") + ")", "i")
|
---|
3901 | }
|
---|
3902 |
|
---|
3903 | function hFormat() {
|
---|
3904 | return this.hours() % 12 || 12
|
---|
3905 | }
|
---|
3906 |
|
---|
3907 | function kFormat() {
|
---|
3908 | return this.hours() || 24
|
---|
3909 | }
|
---|
3910 | addFormatToken("H", ["HH", 2], 0, "hour");
|
---|
3911 | addFormatToken("h", ["hh", 2], 0, hFormat);
|
---|
3912 | addFormatToken("k", ["kk", 2], 0, kFormat);
|
---|
3913 | addFormatToken("hmm", 0, 0, function () {
|
---|
3914 | return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2)
|
---|
3915 | });
|
---|
3916 | addFormatToken("hmmss", 0, 0, function () {
|
---|
3917 | return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2)
|
---|
3918 | });
|
---|
3919 | addFormatToken("Hmm", 0, 0, function () {
|
---|
3920 | return "" + this.hours() + zeroFill(this.minutes(), 2)
|
---|
3921 | });
|
---|
3922 | addFormatToken("Hmmss", 0, 0, function () {
|
---|
3923 | return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2)
|
---|
3924 | });
|
---|
3925 |
|
---|
3926 | function meridiem(token, lowercase) {
|
---|
3927 | addFormatToken(token, 0, 0, function () {
|
---|
3928 | return this.localeData().meridiem(this.hours(), this.minutes(), lowercase)
|
---|
3929 | })
|
---|
3930 | }
|
---|
3931 | meridiem("a", true);
|
---|
3932 | meridiem("A", false);
|
---|
3933 | addUnitAlias("hour", "h");
|
---|
3934 | addUnitPriority("hour", 13);
|
---|
3935 |
|
---|
3936 | function matchMeridiem(isStrict, locale) {
|
---|
3937 | return locale._meridiemParse
|
---|
3938 | }
|
---|
3939 | addRegexToken("a", matchMeridiem);
|
---|
3940 | addRegexToken("A", matchMeridiem);
|
---|
3941 | addRegexToken("H", match1to2);
|
---|
3942 | addRegexToken("h", match1to2);
|
---|
3943 | addRegexToken("HH", match1to2, match2);
|
---|
3944 | addRegexToken("hh", match1to2, match2);
|
---|
3945 | addRegexToken("hmm", match3to4);
|
---|
3946 | addRegexToken("hmmss", match5to6);
|
---|
3947 | addRegexToken("Hmm", match3to4);
|
---|
3948 | addRegexToken("Hmmss", match5to6);
|
---|
3949 | addParseToken(["H", "HH"], HOUR);
|
---|
3950 | addParseToken(["a", "A"], function (input, array, config) {
|
---|
3951 | config._isPm = config._locale.isPM(input);
|
---|
3952 | config._meridiem = input
|
---|
3953 | });
|
---|
3954 | addParseToken(["h", "hh"], function (input, array, config) {
|
---|
3955 | array[HOUR] = toInt(input);
|
---|
3956 | getParsingFlags(config).bigHour = true
|
---|
3957 | });
|
---|
3958 | addParseToken("hmm", function (input, array, config) {
|
---|
3959 | var pos = input.length - 2;
|
---|
3960 | array[HOUR] = toInt(input.substr(0, pos));
|
---|
3961 | array[MINUTE] = toInt(input.substr(pos));
|
---|
3962 | getParsingFlags(config).bigHour = true
|
---|
3963 | });
|
---|
3964 | addParseToken("hmmss", function (input, array, config) {
|
---|
3965 | var pos1 = input.length - 4;
|
---|
3966 | var pos2 = input.length - 2;
|
---|
3967 | array[HOUR] = toInt(input.substr(0, pos1));
|
---|
3968 | array[MINUTE] = toInt(input.substr(pos1, 2));
|
---|
3969 | array[SECOND] = toInt(input.substr(pos2));
|
---|
3970 | getParsingFlags(config).bigHour = true
|
---|
3971 | });
|
---|
3972 | addParseToken("Hmm", function (input, array, config) {
|
---|
3973 | var pos = input.length - 2;
|
---|
3974 | array[HOUR] = toInt(input.substr(0, pos));
|
---|
3975 | array[MINUTE] = toInt(input.substr(pos))
|
---|
3976 | });
|
---|
3977 | addParseToken("Hmmss", function (input, array, config) {
|
---|
3978 | var pos1 = input.length - 4;
|
---|
3979 | var pos2 = input.length - 2;
|
---|
3980 | array[HOUR] = toInt(input.substr(0, pos1));
|
---|
3981 | array[MINUTE] = toInt(input.substr(pos1, 2));
|
---|
3982 | array[SECOND] = toInt(input.substr(pos2))
|
---|
3983 | });
|
---|
3984 |
|
---|
3985 | function localeIsPM(input) {
|
---|
3986 | return (input + "").toLowerCase().charAt(0) === "p"
|
---|
3987 | }
|
---|
3988 | var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
|
---|
3989 |
|
---|
3990 | function localeMeridiem(hours, minutes, isLower) {
|
---|
3991 | if (hours > 11) {
|
---|
3992 | return isLower ? "pm" : "PM"
|
---|
3993 | } else {
|
---|
3994 | return isLower ? "am" : "AM"
|
---|
3995 | }
|
---|
3996 | }
|
---|
3997 | var getSetHour = makeGetSet("Hours", true);
|
---|
3998 | var baseConfig = {
|
---|
3999 | calendar: defaultCalendar,
|
---|
4000 | longDateFormat: defaultLongDateFormat,
|
---|
4001 | invalidDate: defaultInvalidDate,
|
---|
4002 | ordinal: defaultOrdinal,
|
---|
4003 | ordinalParse: defaultOrdinalParse,
|
---|
4004 | relativeTime: defaultRelativeTime,
|
---|
4005 | months: defaultLocaleMonths,
|
---|
4006 | monthsShort: defaultLocaleMonthsShort,
|
---|
4007 | week: defaultLocaleWeek,
|
---|
4008 | weekdays: defaultLocaleWeekdays,
|
---|
4009 | weekdaysMin: defaultLocaleWeekdaysMin,
|
---|
4010 | weekdaysShort: defaultLocaleWeekdaysShort,
|
---|
4011 | meridiemParse: defaultLocaleMeridiemParse
|
---|
4012 | };
|
---|
4013 | var locales = {};
|
---|
4014 | var localeFamilies = {};
|
---|
4015 | var globalLocale;
|
---|
4016 |
|
---|
4017 | function normalizeLocale(key) {
|
---|
4018 | return key ? key.toLowerCase().replace("_", "-") : key
|
---|
4019 | }
|
---|
4020 |
|
---|
4021 | function chooseLocale(names) {
|
---|
4022 | var i = 0,
|
---|
4023 | j, next, locale, split;
|
---|
4024 | while (i < names.length) {
|
---|
4025 | split = normalizeLocale(names[i]).split("-");
|
---|
4026 | j = split.length;
|
---|
4027 | next = normalizeLocale(names[i + 1]);
|
---|
4028 | next = next ? next.split("-") : null;
|
---|
4029 | while (j > 0) {
|
---|
4030 | locale = loadLocale(split.slice(0, j).join("-"));
|
---|
4031 | if (locale) {
|
---|
4032 | return locale
|
---|
4033 | }
|
---|
4034 | if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
|
---|
4035 | break
|
---|
4036 | }
|
---|
4037 | j--
|
---|
4038 | }
|
---|
4039 | i++
|
---|
4040 | }
|
---|
4041 | return null
|
---|
4042 | }
|
---|
4043 |
|
---|
4044 | function loadLocale(name) {
|
---|
4045 | var oldLocale = null;
|
---|
4046 | if (!locales[name] && typeof module !== "undefined" && module && module.exports) {
|
---|
4047 | try {
|
---|
4048 | oldLocale = globalLocale._abbr;
|
---|
4049 | require("./locale/" + name);
|
---|
4050 | getSetGlobalLocale(oldLocale)
|
---|
4051 | } catch (e) {
|
---|
4052 | }
|
---|
4053 | }
|
---|
4054 | return locales[name]
|
---|
4055 | }
|
---|
4056 |
|
---|
4057 | function getSetGlobalLocale(key, values) {
|
---|
4058 | var data;
|
---|
4059 | if (key) {
|
---|
4060 | if (isUndefined(values)) {
|
---|
4061 | data = getLocale(key)
|
---|
4062 | } else {
|
---|
4063 | data = defineLocale(key, values)
|
---|
4064 | }
|
---|
4065 | if (data) {
|
---|
4066 | globalLocale = data
|
---|
4067 | }
|
---|
4068 | }
|
---|
4069 | return globalLocale._abbr
|
---|
4070 | }
|
---|
4071 |
|
---|
4072 | function defineLocale(name, config) {
|
---|
4073 | if (config !== null) {
|
---|
4074 | var parentConfig = baseConfig;
|
---|
4075 | config.abbr = name;
|
---|
4076 | if (locales[name] != null) {
|
---|
4077 | deprecateSimple("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change " + "an existing locale. moment.defineLocale(localeName, " + "config) should only be used for creating a new locale " + "See http://momentjs.com/guides/#/warnings/define-locale/ for more info.");
|
---|
4078 | parentConfig = locales[name]._config
|
---|
4079 | } else if (config.parentLocale != null) {
|
---|
4080 | if (locales[config.parentLocale] != null) {
|
---|
4081 | parentConfig = locales[config.parentLocale]._config
|
---|
4082 | } else {
|
---|
4083 | if (!localeFamilies[config.parentLocale]) {
|
---|
4084 | localeFamilies[config.parentLocale] = []
|
---|
4085 | }
|
---|
4086 | localeFamilies[config.parentLocale].push({
|
---|
4087 | name: name,
|
---|
4088 | config: config
|
---|
4089 | });
|
---|
4090 | return null
|
---|
4091 | }
|
---|
4092 | }
|
---|
4093 | locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
---|
4094 | if (localeFamilies[name]) {
|
---|
4095 | localeFamilies[name].forEach(function (x) {
|
---|
4096 | defineLocale(x.name, x.config)
|
---|
4097 | })
|
---|
4098 | }
|
---|
4099 | getSetGlobalLocale(name);
|
---|
4100 | return locales[name]
|
---|
4101 | } else {
|
---|
4102 | delete locales[name];
|
---|
4103 | return null
|
---|
4104 | }
|
---|
4105 | }
|
---|
4106 |
|
---|
4107 | function updateLocale(name, config) {
|
---|
4108 | if (config != null) {
|
---|
4109 | var locale, parentConfig = baseConfig;
|
---|
4110 | if (locales[name] != null) {
|
---|
4111 | parentConfig = locales[name]._config
|
---|
4112 | }
|
---|
4113 | config = mergeConfigs(parentConfig, config);
|
---|
4114 | locale = new Locale(config);
|
---|
4115 | locale.parentLocale = locales[name];
|
---|
4116 | locales[name] = locale;
|
---|
4117 | getSetGlobalLocale(name)
|
---|
4118 | } else {
|
---|
4119 | if (locales[name] != null) {
|
---|
4120 | if (locales[name].parentLocale != null) {
|
---|
4121 | locales[name] = locales[name].parentLocale
|
---|
4122 | } else if (locales[name] != null) {
|
---|
4123 | delete locales[name]
|
---|
4124 | }
|
---|
4125 | }
|
---|
4126 | }
|
---|
4127 | return locales[name]
|
---|
4128 | }
|
---|
4129 |
|
---|
4130 | function getLocale(key) {
|
---|
4131 | var locale;
|
---|
4132 | if (key && key._locale && key._locale._abbr) {
|
---|
4133 | key = key._locale._abbr
|
---|
4134 | }
|
---|
4135 | if (!key) {
|
---|
4136 | return globalLocale
|
---|
4137 | }
|
---|
4138 | if (!isArray(key)) {
|
---|
4139 | locale = loadLocale(key);
|
---|
4140 | if (locale) {
|
---|
4141 | return locale
|
---|
4142 | }
|
---|
4143 | key = [key]
|
---|
4144 | }
|
---|
4145 | return chooseLocale(key)
|
---|
4146 | }
|
---|
4147 |
|
---|
4148 | function listLocales() {
|
---|
4149 | return keys$1(locales)
|
---|
4150 | }
|
---|
4151 |
|
---|
4152 | function checkOverflow(m) {
|
---|
4153 | var overflow;
|
---|
4154 | var a = m._a;
|
---|
4155 | if (a && getParsingFlags(m).overflow === -2) {
|
---|
4156 | overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;
|
---|
4157 | if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
---|
4158 | overflow = DATE
|
---|
4159 | }
|
---|
4160 | if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
|
---|
4161 | overflow = WEEK
|
---|
4162 | }
|
---|
4163 | if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
|
---|
4164 | overflow = WEEKDAY
|
---|
4165 | }
|
---|
4166 | getParsingFlags(m).overflow = overflow
|
---|
4167 | }
|
---|
4168 | return m
|
---|
4169 | }
|
---|
4170 | var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
|
---|
4171 | var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
|
---|
4172 | var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
|
---|
4173 | var isoDates = [
|
---|
4174 | ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
|
---|
4175 | ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
|
---|
4176 | ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
|
---|
4177 | ["GGGG-[W]WW", /\d{4}-W\d\d/, false],
|
---|
4178 | ["YYYY-DDD", /\d{4}-\d{3}/],
|
---|
4179 | ["YYYY-MM", /\d{4}-\d\d/, false],
|
---|
4180 | ["YYYYYYMMDD", /[+-]\d{10}/],
|
---|
4181 | ["YYYYMMDD", /\d{8}/],
|
---|
4182 | ["GGGG[W]WWE", /\d{4}W\d{3}/],
|
---|
4183 | ["GGGG[W]WW", /\d{4}W\d{2}/, false],
|
---|
4184 | ["YYYYDDD", /\d{7}/]
|
---|
4185 | ];
|
---|
4186 | var isoTimes = [
|
---|
4187 | ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
|
---|
4188 | ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
|
---|
4189 | ["HH:mm:ss", /\d\d:\d\d:\d\d/],
|
---|
4190 | ["HH:mm", /\d\d:\d\d/],
|
---|
4191 | ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
|
---|
4192 | ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
|
---|
4193 | ["HHmmss", /\d\d\d\d\d\d/],
|
---|
4194 | ["HHmm", /\d\d\d\d/],
|
---|
4195 | ["HH", /\d\d/]
|
---|
4196 | ];
|
---|
4197 | var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
|
---|
4198 |
|
---|
4199 | function configFromISO(config) {
|
---|
4200 | var i, l, string = config._i,
|
---|
4201 | match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
|
---|
4202 | allowTime, dateFormat, timeFormat, tzFormat;
|
---|
4203 | if (match) {
|
---|
4204 | getParsingFlags(config).iso = true;
|
---|
4205 | for (i = 0, l = isoDates.length; i < l; i++) {
|
---|
4206 | if (isoDates[i][1].exec(match[1])) {
|
---|
4207 | dateFormat = isoDates[i][0];
|
---|
4208 | allowTime = isoDates[i][2] !== false;
|
---|
4209 | break
|
---|
4210 | }
|
---|
4211 | }
|
---|
4212 | if (dateFormat == null) {
|
---|
4213 | config._isValid = false;
|
---|
4214 | return
|
---|
4215 | }
|
---|
4216 | if (match[3]) {
|
---|
4217 | for (i = 0, l = isoTimes.length; i < l; i++) {
|
---|
4218 | if (isoTimes[i][1].exec(match[3])) {
|
---|
4219 | timeFormat = (match[2] || " ") + isoTimes[i][0];
|
---|
4220 | break
|
---|
4221 | }
|
---|
4222 | }
|
---|
4223 | if (timeFormat == null) {
|
---|
4224 | config._isValid = false;
|
---|
4225 | return
|
---|
4226 | }
|
---|
4227 | }
|
---|
4228 | if (!allowTime && timeFormat != null) {
|
---|
4229 | config._isValid = false;
|
---|
4230 | return
|
---|
4231 | }
|
---|
4232 | if (match[4]) {
|
---|
4233 | if (tzRegex.exec(match[4])) {
|
---|
4234 | tzFormat = "Z"
|
---|
4235 | } else {
|
---|
4236 | config._isValid = false;
|
---|
4237 | return
|
---|
4238 | }
|
---|
4239 | }
|
---|
4240 | config._f = dateFormat + (timeFormat || "") + (tzFormat || "");
|
---|
4241 | configFromStringAndFormat(config)
|
---|
4242 | } else {
|
---|
4243 | config._isValid = false
|
---|
4244 | }
|
---|
4245 | }
|
---|
4246 |
|
---|
4247 | function configFromString(config) {
|
---|
4248 | var matched = aspNetJsonRegex.exec(config._i);
|
---|
4249 | if (matched !== null) {
|
---|
4250 | config._d = new Date(+matched[1]);
|
---|
4251 | return
|
---|
4252 | }
|
---|
4253 | configFromISO(config);
|
---|
4254 | if (config._isValid === false) {
|
---|
4255 | delete config._isValid;
|
---|
4256 | hooks.createFromInputFallback(config)
|
---|
4257 | }
|
---|
4258 | }
|
---|
4259 | hooks.createFromInputFallback = deprecate("value provided is not in a recognized ISO format. moment construction falls back to js Date(), " + "which is not reliable across all browsers and versions. Non ISO date formats are " + "discouraged and will be removed in an upcoming major release. Please refer to " + "http://momentjs.com/guides/#/warnings/js-date/ for more info.", function (config) {
|
---|
4260 | config._d = new Date(config._i + (config._useUTC ? " UTC" : ""))
|
---|
4261 | });
|
---|
4262 |
|
---|
4263 | function defaults(a, b, c) {
|
---|
4264 | if (a != null) {
|
---|
4265 | return a
|
---|
4266 | }
|
---|
4267 | if (b != null) {
|
---|
4268 | return b
|
---|
4269 | }
|
---|
4270 | return c
|
---|
4271 | }
|
---|
4272 |
|
---|
4273 | function currentDateArray(config) {
|
---|
4274 | var nowValue = new Date(hooks.now());
|
---|
4275 | if (config._useUTC) {
|
---|
4276 | return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]
|
---|
4277 | }
|
---|
4278 | return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]
|
---|
4279 | }
|
---|
4280 |
|
---|
4281 | function configFromArray(config) {
|
---|
4282 | var i, date, input = [],
|
---|
4283 | currentDate, yearToUse;
|
---|
4284 | if (config._d) {
|
---|
4285 | return
|
---|
4286 | }
|
---|
4287 | currentDate = currentDateArray(config);
|
---|
4288 | if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
|
---|
4289 | dayOfYearFromWeekInfo(config)
|
---|
4290 | }
|
---|
4291 | if (config._dayOfYear) {
|
---|
4292 | yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
|
---|
4293 | if (config._dayOfYear > daysInYear(yearToUse)) {
|
---|
4294 | getParsingFlags(config)._overflowDayOfYear = true
|
---|
4295 | }
|
---|
4296 | date = createUTCDate(yearToUse, 0, config._dayOfYear);
|
---|
4297 | config._a[MONTH] = date.getUTCMonth();
|
---|
4298 | config._a[DATE] = date.getUTCDate()
|
---|
4299 | }
|
---|
4300 | for (i = 0; i < 3 && config._a[i] == null; ++i) {
|
---|
4301 | config._a[i] = input[i] = currentDate[i]
|
---|
4302 | }
|
---|
4303 | for (; i < 7; i++) {
|
---|
4304 | config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i]
|
---|
4305 | }
|
---|
4306 | if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
|
---|
4307 | config._nextDay = true;
|
---|
4308 | config._a[HOUR] = 0
|
---|
4309 | }
|
---|
4310 | config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
|
---|
4311 | if (config._tzm != null) {
|
---|
4312 | config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm)
|
---|
4313 | }
|
---|
4314 | if (config._nextDay) {
|
---|
4315 | config._a[HOUR] = 24
|
---|
4316 | }
|
---|
4317 | }
|
---|
4318 |
|
---|
4319 | function dayOfYearFromWeekInfo(config) {
|
---|
4320 | var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
|
---|
4321 | w = config._w;
|
---|
4322 | if (w.GG != null || w.W != null || w.E != null) {
|
---|
4323 | dow = 1;
|
---|
4324 | doy = 4;
|
---|
4325 | weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
|
---|
4326 | week = defaults(w.W, 1);
|
---|
4327 | weekday = defaults(w.E, 1);
|
---|
4328 | if (weekday < 1 || weekday > 7) {
|
---|
4329 | weekdayOverflow = true
|
---|
4330 | }
|
---|
4331 | } else {
|
---|
4332 | dow = config._locale._week.dow;
|
---|
4333 | doy = config._locale._week.doy;
|
---|
4334 | var curWeek = weekOfYear(createLocal(), dow, doy);
|
---|
4335 | weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
|
---|
4336 | week = defaults(w.w, curWeek.week);
|
---|
4337 | if (w.d != null) {
|
---|
4338 | weekday = w.d;
|
---|
4339 | if (weekday < 0 || weekday > 6) {
|
---|
4340 | weekdayOverflow = true
|
---|
4341 | }
|
---|
4342 | } else if (w.e != null) {
|
---|
4343 | weekday = w.e + dow;
|
---|
4344 | if (w.e < 0 || w.e > 6) {
|
---|
4345 | weekdayOverflow = true
|
---|
4346 | }
|
---|
4347 | } else {
|
---|
4348 | weekday = dow
|
---|
4349 | }
|
---|
4350 | }
|
---|
4351 | if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
|
---|
4352 | getParsingFlags(config)._overflowWeeks = true
|
---|
4353 | } else if (weekdayOverflow != null) {
|
---|
4354 | getParsingFlags(config)._overflowWeekday = true
|
---|
4355 | } else {
|
---|
4356 | temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
|
---|
4357 | config._a[YEAR] = temp.year;
|
---|
4358 | config._dayOfYear = temp.dayOfYear
|
---|
4359 | }
|
---|
4360 | }
|
---|
4361 | hooks.ISO_8601 = function () {};
|
---|
4362 |
|
---|
4363 | function configFromStringAndFormat(config) {
|
---|
4364 | if (config._f === hooks.ISO_8601) {
|
---|
4365 | configFromISO(config);
|
---|
4366 | return
|
---|
4367 | }
|
---|
4368 | config._a = [];
|
---|
4369 | getParsingFlags(config).empty = true;
|
---|
4370 | var string = "" + config._i,
|
---|
4371 | i, parsedInput, tokens, token, skipped, stringLength = string.length,
|
---|
4372 | totalParsedInputLength = 0;
|
---|
4373 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
|
---|
4374 | for (i = 0; i < tokens.length; i++) {
|
---|
4375 | token = tokens[i];
|
---|
4376 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
|
---|
4377 | if (parsedInput) {
|
---|
4378 | skipped = string.substr(0, string.indexOf(parsedInput));
|
---|
4379 | if (skipped.length > 0) {
|
---|
4380 | getParsingFlags(config).unusedInput.push(skipped)
|
---|
4381 | }
|
---|
4382 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
|
---|
4383 | totalParsedInputLength += parsedInput.length
|
---|
4384 | }
|
---|
4385 | if (formatTokenFunctions[token]) {
|
---|
4386 | if (parsedInput) {
|
---|
4387 | getParsingFlags(config).empty = false
|
---|
4388 | } else {
|
---|
4389 | getParsingFlags(config).unusedTokens.push(token)
|
---|
4390 | }
|
---|
4391 | addTimeToArrayFromToken(token, parsedInput, config)
|
---|
4392 | } else if (config._strict && !parsedInput) {
|
---|
4393 | getParsingFlags(config).unusedTokens.push(token)
|
---|
4394 | }
|
---|
4395 | }
|
---|
4396 | getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
|
---|
4397 | if (string.length > 0) {
|
---|
4398 | getParsingFlags(config).unusedInput.push(string)
|
---|
4399 | }
|
---|
4400 | if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
|
---|
4401 | getParsingFlags(config).bigHour = undefined
|
---|
4402 | }
|
---|
4403 | getParsingFlags(config).parsedDateParts = config._a.slice(0);
|
---|
4404 | getParsingFlags(config).meridiem = config._meridiem;
|
---|
4405 | config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
|
---|
4406 | configFromArray(config);
|
---|
4407 | checkOverflow(config)
|
---|
4408 | }
|
---|
4409 |
|
---|
4410 | function meridiemFixWrap(locale, hour, meridiem) {
|
---|
4411 | var isPm;
|
---|
4412 | if (meridiem == null) {
|
---|
4413 | return hour
|
---|
4414 | }
|
---|
4415 | if (locale.meridiemHour != null) {
|
---|
4416 | return locale.meridiemHour(hour, meridiem)
|
---|
4417 | } else if (locale.isPM != null) {
|
---|
4418 | isPm = locale.isPM(meridiem);
|
---|
4419 | if (isPm && hour < 12) {
|
---|
4420 | hour += 12
|
---|
4421 | }
|
---|
4422 | if (!isPm && hour === 12) {
|
---|
4423 | hour = 0
|
---|
4424 | }
|
---|
4425 | return hour
|
---|
4426 | } else {
|
---|
4427 | return hour
|
---|
4428 | }
|
---|
4429 | }
|
---|
4430 |
|
---|
4431 | function configFromStringAndArray(config) {
|
---|
4432 | var tempConfig, bestMoment, scoreToBeat, i, currentScore;
|
---|
4433 | if (config._f.length === 0) {
|
---|
4434 | getParsingFlags(config).invalidFormat = true;
|
---|
4435 | config._d = new Date(NaN);
|
---|
4436 | return
|
---|
4437 | }
|
---|
4438 | for (i = 0; i < config._f.length; i++) {
|
---|
4439 | currentScore = 0;
|
---|
4440 | tempConfig = copyConfig({}, config);
|
---|
4441 | if (config._useUTC != null) {
|
---|
4442 | tempConfig._useUTC = config._useUTC
|
---|
4443 | }
|
---|
4444 | tempConfig._f = config._f[i];
|
---|
4445 | configFromStringAndFormat(tempConfig);
|
---|
4446 | if (!isValid(tempConfig)) {
|
---|
4447 | continue
|
---|
4448 | }
|
---|
4449 | currentScore += getParsingFlags(tempConfig).charsLeftOver;
|
---|
4450 | currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
|
---|
4451 | getParsingFlags(tempConfig).score = currentScore;
|
---|
4452 | if (scoreToBeat == null || currentScore < scoreToBeat) {
|
---|
4453 | scoreToBeat = currentScore;
|
---|
4454 | bestMoment = tempConfig
|
---|
4455 | }
|
---|
4456 | }
|
---|
4457 | extend(config, bestMoment || tempConfig)
|
---|
4458 | }
|
---|
4459 |
|
---|
4460 | function configFromObject(config) {
|
---|
4461 | if (config._d) {
|
---|
4462 | return
|
---|
4463 | }
|
---|
4464 | var i = normalizeObjectUnits(config._i);
|
---|
4465 | config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
|
---|
4466 | return obj && parseInt(obj, 10)
|
---|
4467 | });
|
---|
4468 | configFromArray(config)
|
---|
4469 | }
|
---|
4470 |
|
---|
4471 | function createFromConfig(config) {
|
---|
4472 | var res = new Moment(checkOverflow(prepareConfig(config)));
|
---|
4473 | if (res._nextDay) {
|
---|
4474 | res.add(1, "d");
|
---|
4475 | res._nextDay = undefined
|
---|
4476 | }
|
---|
4477 | return res
|
---|
4478 | }
|
---|
4479 |
|
---|
4480 | function prepareConfig(config) {
|
---|
4481 | var input = config._i,
|
---|
4482 | format = config._f;
|
---|
4483 | config._locale = config._locale || getLocale(config._l);
|
---|
4484 | if (input === null || format === undefined && input === "") {
|
---|
4485 | return createInvalid({
|
---|
4486 | nullInput: true
|
---|
4487 | })
|
---|
4488 | }
|
---|
4489 | if (typeof input === "string") {
|
---|
4490 | config._i = input = config._locale.preparse(input)
|
---|
4491 | }
|
---|
4492 | if (isMoment(input)) {
|
---|
4493 | return new Moment(checkOverflow(input))
|
---|
4494 | } else if (isDate(input)) {
|
---|
4495 | config._d = input
|
---|
4496 | } else if (isArray(format)) {
|
---|
4497 | configFromStringAndArray(config)
|
---|
4498 | } else if (format) {
|
---|
4499 | configFromStringAndFormat(config)
|
---|
4500 | } else {
|
---|
4501 | configFromInput(config)
|
---|
4502 | }
|
---|
4503 | if (!isValid(config)) {
|
---|
4504 | config._d = null
|
---|
4505 | }
|
---|
4506 | return config
|
---|
4507 | }
|
---|
4508 |
|
---|
4509 | function configFromInput(config) {
|
---|
4510 | var input = config._i;
|
---|
4511 | if (input === undefined) {
|
---|
4512 | config._d = new Date(hooks.now())
|
---|
4513 | } else if (isDate(input)) {
|
---|
4514 | config._d = new Date(input.valueOf())
|
---|
4515 | } else if (typeof input === "string") {
|
---|
4516 | configFromString(config)
|
---|
4517 | } else if (isArray(input)) {
|
---|
4518 | config._a = map(input.slice(0), function (obj) {
|
---|
4519 | return parseInt(obj, 10)
|
---|
4520 | });
|
---|
4521 | configFromArray(config)
|
---|
4522 | } else if (typeof input === "object") {
|
---|
4523 | configFromObject(config)
|
---|
4524 | } else if (isNumber(input)) {
|
---|
4525 | config._d = new Date(input)
|
---|
4526 | } else {
|
---|
4527 | hooks.createFromInputFallback(config)
|
---|
4528 | }
|
---|
4529 | }
|
---|
4530 |
|
---|
4531 | function createLocalOrUTC(input, format, locale, strict, isUTC) {
|
---|
4532 | var c = {};
|
---|
4533 | if (locale === true || locale === false) {
|
---|
4534 | strict = locale;
|
---|
4535 | locale = undefined
|
---|
4536 | }
|
---|
4537 | if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {
|
---|
4538 | input = undefined
|
---|
4539 | } // https://github.com/moment/moment/issues/1423
|
---|
4540 | c._isAMomentObject = true;
|
---|
4541 | c._useUTC = c._isUTC = isUTC;
|
---|
4542 | c._l = locale;
|
---|
4543 | c._i = input;
|
---|
4544 | c._f = format;
|
---|
4545 | c._strict = strict;
|
---|
4546 | return createFromConfig(c)
|
---|
4547 | }
|
---|
4548 |
|
---|
4549 | function createLocal(input, format, locale, strict) {
|
---|
4550 | return createLocalOrUTC(input, format, locale, strict, false)
|
---|
4551 | }
|
---|
4552 | var prototypeMin = deprecate("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function () {
|
---|
4553 | var other = createLocal.apply(null, arguments);
|
---|
4554 | if (this.isValid() && other.isValid()) {
|
---|
4555 | return other < this ? this : other
|
---|
4556 | } else {
|
---|
4557 | return createInvalid()
|
---|
4558 | }
|
---|
4559 | });
|
---|
4560 | var prototypeMax = deprecate("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function () {
|
---|
4561 | var other = createLocal.apply(null, arguments);
|
---|
4562 | if (this.isValid() && other.isValid()) {
|
---|
4563 | return other > this ? this : other
|
---|
4564 | } else {
|
---|
4565 | return createInvalid()
|
---|
4566 | }
|
---|
4567 | });
|
---|
4568 |
|
---|
4569 | function pickBy(fn, moments) {
|
---|
4570 | var res, i;
|
---|
4571 | if (moments.length === 1 && isArray(moments[0])) {
|
---|
4572 | moments = moments[0]
|
---|
4573 | }
|
---|
4574 | if (!moments.length) {
|
---|
4575 | return createLocal()
|
---|
4576 | }
|
---|
4577 | res = moments[0];
|
---|
4578 | for (i = 1; i < moments.length; ++i) {
|
---|
4579 | if (!moments[i].isValid() || moments[i][fn](res)) {
|
---|
4580 | res = moments[i]
|
---|
4581 | }
|
---|
4582 | }
|
---|
4583 | return res
|
---|
4584 | }
|
---|
4585 |
|
---|
4586 | function min() {
|
---|
4587 | var args = [].slice.call(arguments, 0);
|
---|
4588 | return pickBy("isBefore", args)
|
---|
4589 | }
|
---|
4590 |
|
---|
4591 | function max() {
|
---|
4592 | var args = [].slice.call(arguments, 0);
|
---|
4593 | return pickBy("isAfter", args)
|
---|
4594 | }
|
---|
4595 | var now = function () {
|
---|
4596 | return Date.now ? Date.now() : +new Date
|
---|
4597 | };
|
---|
4598 |
|
---|
4599 | function Duration(duration) {
|
---|
4600 | var normalizedInput = normalizeObjectUnits(duration),
|
---|
4601 | years = normalizedInput.year || 0,
|
---|
4602 | quarters = normalizedInput.quarter || 0,
|
---|
4603 | months = normalizedInput.month || 0,
|
---|
4604 | weeks = normalizedInput.week || 0,
|
---|
4605 | days = normalizedInput.day || 0,
|
---|
4606 | hours = normalizedInput.hour || 0,
|
---|
4607 | minutes = normalizedInput.minute || 0,
|
---|
4608 | seconds = normalizedInput.second || 0,
|
---|
4609 | milliseconds = normalizedInput.millisecond || 0;
|
---|
4610 | this._milliseconds = +milliseconds + seconds * 1e3 + minutes * 6e4 + hours * 1e3 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
|
---|
4611 | this._days = +days + weeks * 7;
|
---|
4612 | this._months = +months + quarters * 3 + years * 12;
|
---|
4613 | this._data = {};
|
---|
4614 | this._locale = getLocale();
|
---|
4615 | this._bubble()
|
---|
4616 | }
|
---|
4617 |
|
---|
4618 | function isDuration(obj) {
|
---|
4619 | return obj instanceof Duration
|
---|
4620 | }
|
---|
4621 |
|
---|
4622 | function absRound(number) {
|
---|
4623 | if (number < 0) {
|
---|
4624 | return Math.round(-1 * number) * -1
|
---|
4625 | } else {
|
---|
4626 | return Math.round(number)
|
---|
4627 | }
|
---|
4628 | }
|
---|
4629 |
|
---|
4630 | function offset(token, separator) {
|
---|
4631 | addFormatToken(token, 0, 0, function () {
|
---|
4632 | var offset = this.utcOffset();
|
---|
4633 | var sign = "+";
|
---|
4634 | if (offset < 0) {
|
---|
4635 | offset = -offset;
|
---|
4636 | sign = "-"
|
---|
4637 | }
|
---|
4638 | return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2)
|
---|
4639 | })
|
---|
4640 | }
|
---|
4641 | offset("Z", ":");
|
---|
4642 | offset("ZZ", "");
|
---|
4643 | addRegexToken("Z", matchShortOffset);
|
---|
4644 | addRegexToken("ZZ", matchShortOffset);
|
---|
4645 | addParseToken(["Z", "ZZ"], function (input, array, config) {
|
---|
4646 | config._useUTC = true;
|
---|
4647 | config._tzm = offsetFromString(matchShortOffset, input)
|
---|
4648 | });
|
---|
4649 | var chunkOffset = /([\+\-]|\d\d)/gi;
|
---|
4650 |
|
---|
4651 | function offsetFromString(matcher, string) {
|
---|
4652 | var matches = (string || "").match(matcher);
|
---|
4653 | if (matches === null) {
|
---|
4654 | return null
|
---|
4655 | }
|
---|
4656 | var chunk = matches[matches.length - 1] || [];
|
---|
4657 | var parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
|
---|
4658 | var minutes = +(parts[1] * 60) + toInt(parts[2]);
|
---|
4659 | return minutes === 0 ? 0 : parts[0] === "+" ? minutes : -minutes
|
---|
4660 | }
|
---|
4661 |
|
---|
4662 | function cloneWithOffset(input, model) {
|
---|
4663 | var res, diff;
|
---|
4664 | if (model._isUTC) {
|
---|
4665 | res = model.clone();
|
---|
4666 | diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
|
---|
4667 | res._d.setTime(res._d.valueOf() + diff);
|
---|
4668 | hooks.updateOffset(res, false);
|
---|
4669 | return res
|
---|
4670 | } else {
|
---|
4671 | return createLocal(input).local()
|
---|
4672 | }
|
---|
4673 | }
|
---|
4674 |
|
---|
4675 | function getDateOffset(m) { // https://github.com/moment/moment/pull/1871
|
---|
4676 | return -Math.round(m._d.getTimezoneOffset() / 15) * 15
|
---|
4677 | }
|
---|
4678 | hooks.updateOffset = function () {};
|
---|
4679 |
|
---|
4680 | function getSetOffset(input, keepLocalTime) {
|
---|
4681 | var offset = this._offset || 0,
|
---|
4682 | localAdjust;
|
---|
4683 | if (!this.isValid()) {
|
---|
4684 | return input != null ? this : NaN
|
---|
4685 | }
|
---|
4686 | if (input != null) {
|
---|
4687 | if (typeof input === "string") {
|
---|
4688 | input = offsetFromString(matchShortOffset, input);
|
---|
4689 | if (input === null) {
|
---|
4690 | return this
|
---|
4691 | }
|
---|
4692 | } else if (Math.abs(input) < 16) {
|
---|
4693 | input = input * 60
|
---|
4694 | }
|
---|
4695 | if (!this._isUTC && keepLocalTime) {
|
---|
4696 | localAdjust = getDateOffset(this)
|
---|
4697 | }
|
---|
4698 | this._offset = input;
|
---|
4699 | this._isUTC = true;
|
---|
4700 | if (localAdjust != null) {
|
---|
4701 | this.add(localAdjust, "m")
|
---|
4702 | }
|
---|
4703 | if (offset !== input) {
|
---|
4704 | if (!keepLocalTime || this._changeInProgress) {
|
---|
4705 | addSubtract(this, createDuration(input - offset, "m"), 1, false)
|
---|
4706 | } else if (!this._changeInProgress) {
|
---|
4707 | this._changeInProgress = true;
|
---|
4708 | hooks.updateOffset(this, true);
|
---|
4709 | this._changeInProgress = null
|
---|
4710 | }
|
---|
4711 | }
|
---|
4712 | return this
|
---|
4713 | } else {
|
---|
4714 | return this._isUTC ? offset : getDateOffset(this)
|
---|
4715 | }
|
---|
4716 | }
|
---|
4717 |
|
---|
4718 | function getSetZone(input, keepLocalTime) {
|
---|
4719 | if (input != null) {
|
---|
4720 | if (typeof input !== "string") {
|
---|
4721 | input = -input
|
---|
4722 | }
|
---|
4723 | this.utcOffset(input, keepLocalTime);
|
---|
4724 | return this
|
---|
4725 | } else {
|
---|
4726 | return -this.utcOffset()
|
---|
4727 | }
|
---|
4728 | }
|
---|
4729 |
|
---|
4730 | function setOffsetToUTC(keepLocalTime) {
|
---|
4731 | return this.utcOffset(0, keepLocalTime)
|
---|
4732 | }
|
---|
4733 |
|
---|
4734 | function setOffsetToLocal(keepLocalTime) {
|
---|
4735 | if (this._isUTC) {
|
---|
4736 | this.utcOffset(0, keepLocalTime);
|
---|
4737 | this._isUTC = false;
|
---|
4738 | if (keepLocalTime) {
|
---|
4739 | this.subtract(getDateOffset(this), "m")
|
---|
4740 | }
|
---|
4741 | }
|
---|
4742 | return this
|
---|
4743 | }
|
---|
4744 |
|
---|
4745 | function setOffsetToParsedOffset() {
|
---|
4746 | if (this._tzm != null) {
|
---|
4747 | this.utcOffset(this._tzm)
|
---|
4748 | } else if (typeof this._i === "string") {
|
---|
4749 | var tZone = offsetFromString(matchOffset, this._i);
|
---|
4750 | if (tZone != null) {
|
---|
4751 | this.utcOffset(tZone)
|
---|
4752 | } else {
|
---|
4753 | this.utcOffset(0, true)
|
---|
4754 | }
|
---|
4755 | }
|
---|
4756 | return this
|
---|
4757 | }
|
---|
4758 |
|
---|
4759 | function hasAlignedHourOffset(input) {
|
---|
4760 | if (!this.isValid()) {
|
---|
4761 | return false
|
---|
4762 | }
|
---|
4763 | input = input ? createLocal(input).utcOffset() : 0;
|
---|
4764 | return (this.utcOffset() - input) % 60 === 0
|
---|
4765 | }
|
---|
4766 |
|
---|
4767 | function isDaylightSavingTime() {
|
---|
4768 | return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset()
|
---|
4769 | }
|
---|
4770 |
|
---|
4771 | function isDaylightSavingTimeShifted() {
|
---|
4772 | if (!isUndefined(this._isDSTShifted)) {
|
---|
4773 | return this._isDSTShifted
|
---|
4774 | }
|
---|
4775 | var c = {};
|
---|
4776 | copyConfig(c, this);
|
---|
4777 | c = prepareConfig(c);
|
---|
4778 | if (c._a) {
|
---|
4779 | var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
|
---|
4780 | this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0
|
---|
4781 | } else {
|
---|
4782 | this._isDSTShifted = false
|
---|
4783 | }
|
---|
4784 | return this._isDSTShifted
|
---|
4785 | }
|
---|
4786 |
|
---|
4787 | function isLocal() {
|
---|
4788 | return this.isValid() ? !this._isUTC : false
|
---|
4789 | }
|
---|
4790 |
|
---|
4791 | function isUtcOffset() {
|
---|
4792 | return this.isValid() ? this._isUTC : false
|
---|
4793 | }
|
---|
4794 |
|
---|
4795 | function isUtc() {
|
---|
4796 | return this.isValid() ? this._isUTC && this._offset === 0 : false
|
---|
4797 | }
|
---|
4798 | var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
|
---|
4799 | var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
|
---|
4800 |
|
---|
4801 | function createDuration(input, key) {
|
---|
4802 | var duration = input,
|
---|
4803 | match = null,
|
---|
4804 | sign, ret, diffRes;
|
---|
4805 | if (isDuration(input)) {
|
---|
4806 | duration = {
|
---|
4807 | ms: input._milliseconds,
|
---|
4808 | d: input._days,
|
---|
4809 | M: input._months
|
---|
4810 | }
|
---|
4811 | } else if (isNumber(input)) {
|
---|
4812 | duration = {};
|
---|
4813 | if (key) {
|
---|
4814 | duration[key] = input
|
---|
4815 | } else {
|
---|
4816 | duration.milliseconds = input
|
---|
4817 | }
|
---|
4818 | } else if (!!(match = aspNetRegex.exec(input))) {
|
---|
4819 | sign = match[1] === "-" ? -1 : 1;
|
---|
4820 | duration = {
|
---|
4821 | y: 0,
|
---|
4822 | d: toInt(match[DATE]) * sign,
|
---|
4823 | h: toInt(match[HOUR]) * sign,
|
---|
4824 | m: toInt(match[MINUTE]) * sign,
|
---|
4825 | s: toInt(match[SECOND]) * sign,
|
---|
4826 | ms: toInt(absRound(match[MILLISECOND] * 1e3)) * sign
|
---|
4827 | }
|
---|
4828 | } else if (!!(match = isoRegex.exec(input))) {
|
---|
4829 | sign = match[1] === "-" ? -1 : 1;
|
---|
4830 | duration = {
|
---|
4831 | y: parseIso(match[2], sign),
|
---|
4832 | M: parseIso(match[3], sign),
|
---|
4833 | w: parseIso(match[4], sign),
|
---|
4834 | d: parseIso(match[5], sign),
|
---|
4835 | h: parseIso(match[6], sign),
|
---|
4836 | m: parseIso(match[7], sign),
|
---|
4837 | s: parseIso(match[8], sign)
|
---|
4838 | }
|
---|
4839 | } else if (duration == null) {
|
---|
4840 | duration = {}
|
---|
4841 | } else if (typeof duration === "object" && ("from" in duration || "to" in duration)) {
|
---|
4842 | diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
|
---|
4843 | duration = {};
|
---|
4844 | duration.ms = diffRes.milliseconds;
|
---|
4845 | duration.M = diffRes.months
|
---|
4846 | }
|
---|
4847 | ret = new Duration(duration);
|
---|
4848 | if (isDuration(input) && hasOwnProp(input, "_locale")) {
|
---|
4849 | ret._locale = input._locale
|
---|
4850 | }
|
---|
4851 | return ret
|
---|
4852 | }
|
---|
4853 | createDuration.fn = Duration.prototype;
|
---|
4854 |
|
---|
4855 | function parseIso(inp, sign) {
|
---|
4856 | var res = inp && parseFloat(inp.replace(",", "."));
|
---|
4857 | return (isNaN(res) ? 0 : res) * sign
|
---|
4858 | }
|
---|
4859 |
|
---|
4860 | function positiveMomentsDifference(base, other) {
|
---|
4861 | var res = {
|
---|
4862 | milliseconds: 0,
|
---|
4863 | months: 0
|
---|
4864 | };
|
---|
4865 | res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
|
---|
4866 | if (base.clone().add(res.months, "M").isAfter(other)) {
|
---|
4867 | --res.months
|
---|
4868 | }
|
---|
4869 | res.milliseconds = +other - +base.clone().add(res.months, "M");
|
---|
4870 | return res
|
---|
4871 | }
|
---|
4872 |
|
---|
4873 | function momentsDifference(base, other) {
|
---|
4874 | var res;
|
---|
4875 | if (!(base.isValid() && other.isValid())) {
|
---|
4876 | return {
|
---|
4877 | milliseconds: 0,
|
---|
4878 | months: 0
|
---|
4879 | }
|
---|
4880 | }
|
---|
4881 | other = cloneWithOffset(other, base);
|
---|
4882 | if (base.isBefore(other)) {
|
---|
4883 | res = positiveMomentsDifference(base, other)
|
---|
4884 | } else {
|
---|
4885 | res = positiveMomentsDifference(other, base);
|
---|
4886 | res.milliseconds = -res.milliseconds;
|
---|
4887 | res.months = -res.months
|
---|
4888 | }
|
---|
4889 | return res
|
---|
4890 | }
|
---|
4891 |
|
---|
4892 | function createAdder(direction, name) {
|
---|
4893 | return function (val, period) {
|
---|
4894 | var dur, tmp;
|
---|
4895 | if (period !== null && !isNaN(+period)) {
|
---|
4896 | deprecateSimple(name, "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). " + "See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.");
|
---|
4897 | tmp = val;
|
---|
4898 | val = period;
|
---|
4899 | period = tmp
|
---|
4900 | }
|
---|
4901 | val = typeof val === "string" ? +val : val;
|
---|
4902 | dur = createDuration(val, period);
|
---|
4903 | addSubtract(this, dur, direction);
|
---|
4904 | return this
|
---|
4905 | }
|
---|
4906 | }
|
---|
4907 |
|
---|
4908 | function addSubtract(mom, duration, isAdding, updateOffset) {
|
---|
4909 | var milliseconds = duration._milliseconds,
|
---|
4910 | days = absRound(duration._days),
|
---|
4911 | months = absRound(duration._months);
|
---|
4912 | if (!mom.isValid()) {
|
---|
4913 | return
|
---|
4914 | }
|
---|
4915 | updateOffset = updateOffset == null ? true : updateOffset;
|
---|
4916 | if (milliseconds) {
|
---|
4917 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding)
|
---|
4918 | }
|
---|
4919 | if (days) {
|
---|
4920 | set$1(mom, "Date", get(mom, "Date") + days * isAdding)
|
---|
4921 | }
|
---|
4922 | if (months) {
|
---|
4923 | setMonth(mom, get(mom, "Month") + months * isAdding)
|
---|
4924 | }
|
---|
4925 | if (updateOffset) {
|
---|
4926 | hooks.updateOffset(mom, days || months)
|
---|
4927 | }
|
---|
4928 | }
|
---|
4929 | var add = createAdder(1, "add");
|
---|
4930 | var subtract = createAdder(-1, "subtract");
|
---|
4931 |
|
---|
4932 | function getCalendarFormat(myMoment, now) {
|
---|
4933 | var diff = myMoment.diff(now, "days", true);
|
---|
4934 | return diff < -6 ? "sameElse" : diff < -1 ? "lastWeek" : diff < 0 ? "lastDay" : diff < 1 ? "sameDay" : diff < 2 ? "nextDay" : diff < 7 ? "nextWeek" : "sameElse"
|
---|
4935 | }
|
---|
4936 |
|
---|
4937 | function calendar$1(time, formats) {
|
---|
4938 | var now = time || createLocal(),
|
---|
4939 | sod = cloneWithOffset(now, this).startOf("day"),
|
---|
4940 | format = hooks.calendarFormat(this, sod) || "sameElse";
|
---|
4941 | var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
|
---|
4942 | return this.format(output || this.localeData().calendar(format, this, createLocal(now)))
|
---|
4943 | }
|
---|
4944 |
|
---|
4945 | function clone() {
|
---|
4946 | return new Moment(this)
|
---|
4947 | }
|
---|
4948 |
|
---|
4949 | function isAfter(input, units) {
|
---|
4950 | var localInput = isMoment(input) ? input : createLocal(input);
|
---|
4951 | if (!(this.isValid() && localInput.isValid())) {
|
---|
4952 | return false
|
---|
4953 | }
|
---|
4954 | units = normalizeUnits(!isUndefined(units) ? units : "millisecond");
|
---|
4955 | if (units === "millisecond") {
|
---|
4956 | return this.valueOf() > localInput.valueOf()
|
---|
4957 | } else {
|
---|
4958 | return localInput.valueOf() < this.clone().startOf(units).valueOf()
|
---|
4959 | }
|
---|
4960 | }
|
---|
4961 |
|
---|
4962 | function isBefore(input, units) {
|
---|
4963 | var localInput = isMoment(input) ? input : createLocal(input);
|
---|
4964 | if (!(this.isValid() && localInput.isValid())) {
|
---|
4965 | return false
|
---|
4966 | }
|
---|
4967 | units = normalizeUnits(!isUndefined(units) ? units : "millisecond");
|
---|
4968 | if (units === "millisecond") {
|
---|
4969 | return this.valueOf() < localInput.valueOf()
|
---|
4970 | } else {
|
---|
4971 | return this.clone().endOf(units).valueOf() < localInput.valueOf()
|
---|
4972 | }
|
---|
4973 | }
|
---|
4974 |
|
---|
4975 | function isBetween(from, to, units, inclusivity) {
|
---|
4976 | inclusivity = inclusivity || "()";
|
---|
4977 | return (inclusivity[0] === "(" ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ")" ? this.isBefore(to, units) : !this.isAfter(to, units))
|
---|
4978 | }
|
---|
4979 |
|
---|
4980 | function isSame(input, units) {
|
---|
4981 | var localInput = isMoment(input) ? input : createLocal(input),
|
---|
4982 | inputMs;
|
---|
4983 | if (!(this.isValid() && localInput.isValid())) {
|
---|
4984 | return false
|
---|
4985 | }
|
---|
4986 | units = normalizeUnits(units || "millisecond");
|
---|
4987 | if (units === "millisecond") {
|
---|
4988 | return this.valueOf() === localInput.valueOf()
|
---|
4989 | } else {
|
---|
4990 | inputMs = localInput.valueOf();
|
---|
4991 | return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf()
|
---|
4992 | }
|
---|
4993 | }
|
---|
4994 |
|
---|
4995 | function isSameOrAfter(input, units) {
|
---|
4996 | return this.isSame(input, units) || this.isAfter(input, units)
|
---|
4997 | }
|
---|
4998 |
|
---|
4999 | function isSameOrBefore(input, units) {
|
---|
5000 | return this.isSame(input, units) || this.isBefore(input, units)
|
---|
5001 | }
|
---|
5002 |
|
---|
5003 | function diff(input, units, asFloat) {
|
---|
5004 | var that, zoneDelta, delta, output;
|
---|
5005 | if (!this.isValid()) {
|
---|
5006 | return NaN
|
---|
5007 | }
|
---|
5008 | that = cloneWithOffset(input, this);
|
---|
5009 | if (!that.isValid()) {
|
---|
5010 | return NaN
|
---|
5011 | }
|
---|
5012 | zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
|
---|
5013 | units = normalizeUnits(units);
|
---|
5014 | if (units === "year" || units === "month" || units === "quarter") {
|
---|
5015 | output = monthDiff(this, that);
|
---|
5016 | if (units === "quarter") {
|
---|
5017 | output = output / 3
|
---|
5018 | } else if (units === "year") {
|
---|
5019 | output = output / 12
|
---|
5020 | }
|
---|
5021 | } else {
|
---|
5022 | delta = this - that;
|
---|
5023 | output = units === "second" ? delta / 1e3 : units === "minute" ? delta / 6e4 : units === "hour" ? delta / 36e5 : units === "day" ? (delta - zoneDelta) / 864e5 : units === "week" ? (delta - zoneDelta) / 6048e5 : delta
|
---|
5024 | }
|
---|
5025 | return asFloat ? output : absFloor(output)
|
---|
5026 | }
|
---|
5027 |
|
---|
5028 | function monthDiff(a, b) {
|
---|
5029 | var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
|
---|
5030 | anchor = a.clone().add(wholeMonthDiff, "months"),
|
---|
5031 | anchor2, adjust;
|
---|
5032 | if (b - anchor < 0) {
|
---|
5033 | anchor2 = a.clone().add(wholeMonthDiff - 1, "months");
|
---|
5034 | adjust = (b - anchor) / (anchor - anchor2)
|
---|
5035 | } else {
|
---|
5036 | anchor2 = a.clone().add(wholeMonthDiff + 1, "months");
|
---|
5037 | adjust = (b - anchor) / (anchor2 - anchor)
|
---|
5038 | }
|
---|
5039 | return -(wholeMonthDiff + adjust) || 0
|
---|
5040 | }
|
---|
5041 | hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
|
---|
5042 | hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
|
---|
5043 |
|
---|
5044 | function toString() {
|
---|
5045 | return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")
|
---|
5046 | }
|
---|
5047 |
|
---|
5048 | function toISOString() {
|
---|
5049 | var m = this.clone().utc();
|
---|
5050 | if (0 < m.year() && m.year() <= 9999) {
|
---|
5051 | if (isFunction(Date.prototype.toISOString)) {
|
---|
5052 | return this.toDate().toISOString()
|
---|
5053 | } else {
|
---|
5054 | return formatMoment(m, "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")
|
---|
5055 | }
|
---|
5056 | } else {
|
---|
5057 | return formatMoment(m, "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")
|
---|
5058 | }
|
---|
5059 | }
|
---|
5060 |
|
---|
5061 | function inspect() {
|
---|
5062 | if (!this.isValid()) {
|
---|
5063 | return "moment.invalid(/* " + this._i + " */)"
|
---|
5064 | }
|
---|
5065 | var func = "moment";
|
---|
5066 | var zone = "";
|
---|
5067 | if (!this.isLocal()) {
|
---|
5068 | func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
|
---|
5069 | zone = "Z"
|
---|
5070 | }
|
---|
5071 | var prefix = "[" + func + '("]';
|
---|
5072 | var year = 0 < this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
|
---|
5073 | var datetime = "-MM-DD[T]HH:mm:ss.SSS";
|
---|
5074 | var suffix = zone + '[")]';
|
---|
5075 | return this.format(prefix + year + datetime + suffix)
|
---|
5076 | }
|
---|
5077 |
|
---|
5078 | function format(inputString) {
|
---|
5079 | if (!inputString) {
|
---|
5080 | inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat
|
---|
5081 | }
|
---|
5082 | var output = formatMoment(this, inputString);
|
---|
5083 | return this.localeData().postformat(output)
|
---|
5084 | }
|
---|
5085 |
|
---|
5086 | function from(time, withoutSuffix) {
|
---|
5087 | if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
|
---|
5088 | return createDuration({
|
---|
5089 | to: this,
|
---|
5090 | from: time
|
---|
5091 | }).locale(this.locale()).humanize(!withoutSuffix)
|
---|
5092 | } else {
|
---|
5093 | return this.localeData().invalidDate()
|
---|
5094 | }
|
---|
5095 | }
|
---|
5096 |
|
---|
5097 | function fromNow(withoutSuffix) {
|
---|
5098 | return this.from(createLocal(), withoutSuffix)
|
---|
5099 | }
|
---|
5100 |
|
---|
5101 | function to(time, withoutSuffix) {
|
---|
5102 | if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
|
---|
5103 | return createDuration({
|
---|
5104 | from: this,
|
---|
5105 | to: time
|
---|
5106 | }).locale(this.locale()).humanize(!withoutSuffix)
|
---|
5107 | } else {
|
---|
5108 | return this.localeData().invalidDate()
|
---|
5109 | }
|
---|
5110 | }
|
---|
5111 |
|
---|
5112 | function toNow(withoutSuffix) {
|
---|
5113 | return this.to(createLocal(), withoutSuffix)
|
---|
5114 | }
|
---|
5115 |
|
---|
5116 | function locale(key) {
|
---|
5117 | var newLocaleData;
|
---|
5118 | if (key === undefined) {
|
---|
5119 | return this._locale._abbr
|
---|
5120 | } else {
|
---|
5121 | newLocaleData = getLocale(key);
|
---|
5122 | if (newLocaleData != null) {
|
---|
5123 | this._locale = newLocaleData
|
---|
5124 | }
|
---|
5125 | return this
|
---|
5126 | }
|
---|
5127 | }
|
---|
5128 | var lang = deprecate("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function (key) {
|
---|
5129 | if (key === undefined) {
|
---|
5130 | return this.localeData()
|
---|
5131 | } else {
|
---|
5132 | return this.locale(key)
|
---|
5133 | }
|
---|
5134 | });
|
---|
5135 |
|
---|
5136 | function localeData() {
|
---|
5137 | return this._locale
|
---|
5138 | }
|
---|
5139 |
|
---|
5140 | function startOf(units) {
|
---|
5141 | units = normalizeUnits(units);
|
---|
5142 | switch (units) {
|
---|
5143 | case "year":
|
---|
5144 | this.month(0);
|
---|
5145 | case "quarter":
|
---|
5146 | case "month":
|
---|
5147 | this.date(1);
|
---|
5148 | case "week":
|
---|
5149 | case "isoWeek":
|
---|
5150 | case "day":
|
---|
5151 | case "date":
|
---|
5152 | this.hours(0);
|
---|
5153 | case "hour":
|
---|
5154 | this.minutes(0);
|
---|
5155 | case "minute":
|
---|
5156 | this.seconds(0);
|
---|
5157 | case "second":
|
---|
5158 | this.milliseconds(0)
|
---|
5159 | }
|
---|
5160 | if (units === "week") {
|
---|
5161 | this.weekday(0)
|
---|
5162 | }
|
---|
5163 | if (units === "isoWeek") {
|
---|
5164 | this.isoWeekday(1)
|
---|
5165 | }
|
---|
5166 | if (units === "quarter") {
|
---|
5167 | this.month(Math.floor(this.month() / 3) * 3)
|
---|
5168 | }
|
---|
5169 | return this
|
---|
5170 | }
|
---|
5171 |
|
---|
5172 | function endOf(units) {
|
---|
5173 | units = normalizeUnits(units);
|
---|
5174 | if (units === undefined || units === "millisecond") {
|
---|
5175 | return this
|
---|
5176 | }
|
---|
5177 | if (units === "date") {
|
---|
5178 | units = "day"
|
---|
5179 | }
|
---|
5180 | return this.startOf(units).add(1, units === "isoWeek" ? "week" : units).subtract(1, "ms")
|
---|
5181 | }
|
---|
5182 |
|
---|
5183 | function valueOf() {
|
---|
5184 | return this._d.valueOf() - (this._offset || 0) * 6e4
|
---|
5185 | }
|
---|
5186 |
|
---|
5187 | function unix() {
|
---|
5188 | return Math.floor(this.valueOf() / 1e3)
|
---|
5189 | }
|
---|
5190 |
|
---|
5191 | function toDate() {
|
---|
5192 | return new Date(this.valueOf())
|
---|
5193 | }
|
---|
5194 |
|
---|
5195 | function toArray() {
|
---|
5196 | var m = this;
|
---|
5197 | return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]
|
---|
5198 | }
|
---|
5199 |
|
---|
5200 | function toObject() {
|
---|
5201 | var m = this;
|
---|
5202 | return {
|
---|
5203 | years: m.year(),
|
---|
5204 | months: m.month(),
|
---|
5205 | date: m.date(),
|
---|
5206 | hours: m.hours(),
|
---|
5207 | minutes: m.minutes(),
|
---|
5208 | seconds: m.seconds(),
|
---|
5209 | milliseconds: m.milliseconds()
|
---|
5210 | }
|
---|
5211 | }
|
---|
5212 |
|
---|
5213 | function toJSON() {
|
---|
5214 | return this.isValid() ? this.toISOString() : null
|
---|
5215 | }
|
---|
5216 |
|
---|
5217 | function isValid$1() {
|
---|
5218 | return isValid(this)
|
---|
5219 | }
|
---|
5220 |
|
---|
5221 | function parsingFlags() {
|
---|
5222 | return extend({}, getParsingFlags(this))
|
---|
5223 | }
|
---|
5224 |
|
---|
5225 | function invalidAt() {
|
---|
5226 | return getParsingFlags(this).overflow
|
---|
5227 | }
|
---|
5228 |
|
---|
5229 | function creationData() {
|
---|
5230 | return {
|
---|
5231 | input: this._i,
|
---|
5232 | format: this._f,
|
---|
5233 | locale: this._locale,
|
---|
5234 | isUTC: this._isUTC,
|
---|
5235 | strict: this._strict
|
---|
5236 | }
|
---|
5237 | }
|
---|
5238 | addFormatToken(0, ["gg", 2], 0, function () {
|
---|
5239 | return this.weekYear() % 100
|
---|
5240 | });
|
---|
5241 | addFormatToken(0, ["GG", 2], 0, function () {
|
---|
5242 | return this.isoWeekYear() % 100
|
---|
5243 | });
|
---|
5244 |
|
---|
5245 | function addWeekYearFormatToken(token, getter) {
|
---|
5246 | addFormatToken(0, [token, token.length], 0, getter)
|
---|
5247 | }
|
---|
5248 | addWeekYearFormatToken("gggg", "weekYear");
|
---|
5249 | addWeekYearFormatToken("ggggg", "weekYear");
|
---|
5250 | addWeekYearFormatToken("GGGG", "isoWeekYear");
|
---|
5251 | addWeekYearFormatToken("GGGGG", "isoWeekYear");
|
---|
5252 | addUnitAlias("weekYear", "gg");
|
---|
5253 | addUnitAlias("isoWeekYear", "GG");
|
---|
5254 | addUnitPriority("weekYear", 1);
|
---|
5255 | addUnitPriority("isoWeekYear", 1);
|
---|
5256 | addRegexToken("G", matchSigned);
|
---|
5257 | addRegexToken("g", matchSigned);
|
---|
5258 | addRegexToken("GG", match1to2, match2);
|
---|
5259 | addRegexToken("gg", match1to2, match2);
|
---|
5260 | addRegexToken("GGGG", match1to4, match4);
|
---|
5261 | addRegexToken("gggg", match1to4, match4);
|
---|
5262 | addRegexToken("GGGGG", match1to6, match6);
|
---|
5263 | addRegexToken("ggggg", match1to6, match6);
|
---|
5264 | addWeekParseToken(["gggg", "ggggg", "GGGG", "GGGGG"], function (input, week, config, token) {
|
---|
5265 | week[token.substr(0, 2)] = toInt(input)
|
---|
5266 | });
|
---|
5267 | addWeekParseToken(["gg", "GG"], function (input, week, config, token) {
|
---|
5268 | week[token] = hooks.parseTwoDigitYear(input)
|
---|
5269 | });
|
---|
5270 |
|
---|
5271 | function getSetWeekYear(input) {
|
---|
5272 | return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy)
|
---|
5273 | }
|
---|
5274 |
|
---|
5275 | function getSetISOWeekYear(input) {
|
---|
5276 | return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4)
|
---|
5277 | }
|
---|
5278 |
|
---|
5279 | function getISOWeeksInYear() {
|
---|
5280 | return weeksInYear(this.year(), 1, 4)
|
---|
5281 | }
|
---|
5282 |
|
---|
5283 | function getWeeksInYear() {
|
---|
5284 | var weekInfo = this.localeData()._week;
|
---|
5285 | return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy)
|
---|
5286 | }
|
---|
5287 |
|
---|
5288 | function getSetWeekYearHelper(input, week, weekday, dow, doy) {
|
---|
5289 | var weeksTarget;
|
---|
5290 | if (input == null) {
|
---|
5291 | return weekOfYear(this, dow, doy).year
|
---|
5292 | } else {
|
---|
5293 | weeksTarget = weeksInYear(input, dow, doy);
|
---|
5294 | if (week > weeksTarget) {
|
---|
5295 | week = weeksTarget
|
---|
5296 | }
|
---|
5297 | return setWeekAll.call(this, input, week, weekday, dow, doy)
|
---|
5298 | }
|
---|
5299 | }
|
---|
5300 |
|
---|
5301 | function setWeekAll(weekYear, week, weekday, dow, doy) {
|
---|
5302 | var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
|
---|
5303 | date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
|
---|
5304 | this.year(date.getUTCFullYear());
|
---|
5305 | this.month(date.getUTCMonth());
|
---|
5306 | this.date(date.getUTCDate());
|
---|
5307 | return this
|
---|
5308 | }
|
---|
5309 | addFormatToken("Q", 0, "Qo", "quarter");
|
---|
5310 | addUnitAlias("quarter", "Q");
|
---|
5311 | addUnitPriority("quarter", 7);
|
---|
5312 | addRegexToken("Q", match1);
|
---|
5313 | addParseToken("Q", function (input, array) {
|
---|
5314 | array[MONTH] = (toInt(input) - 1) * 3
|
---|
5315 | });
|
---|
5316 |
|
---|
5317 | function getSetQuarter(input) {
|
---|
5318 | return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3)
|
---|
5319 | }
|
---|
5320 | addFormatToken("D", ["DD", 2], "Do", "date");
|
---|
5321 | addUnitAlias("date", "D");
|
---|
5322 | addUnitPriority("date", 9);
|
---|
5323 | addRegexToken("D", match1to2);
|
---|
5324 | addRegexToken("DD", match1to2, match2);
|
---|
5325 | addRegexToken("Do", function (isStrict, locale) {
|
---|
5326 | return isStrict ? locale._ordinalParse : locale._ordinalParseLenient
|
---|
5327 | });
|
---|
5328 | addParseToken(["D", "DD"], DATE);
|
---|
5329 | addParseToken("Do", function (input, array) {
|
---|
5330 | array[DATE] = toInt(input.match(match1to2)[0], 10)
|
---|
5331 | });
|
---|
5332 | var getSetDayOfMonth = makeGetSet("Date", true);
|
---|
5333 | addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
|
---|
5334 | addUnitAlias("dayOfYear", "DDD");
|
---|
5335 | addUnitPriority("dayOfYear", 4);
|
---|
5336 | addRegexToken("DDD", match1to3);
|
---|
5337 | addRegexToken("DDDD", match3);
|
---|
5338 | addParseToken(["DDD", "DDDD"], function (input, array, config) {
|
---|
5339 | config._dayOfYear = toInt(input)
|
---|
5340 | });
|
---|
5341 |
|
---|
5342 | function getSetDayOfYear(input) {
|
---|
5343 | var dayOfYear = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1;
|
---|
5344 | return input == null ? dayOfYear : this.add(input - dayOfYear, "d")
|
---|
5345 | }
|
---|
5346 | addFormatToken("m", ["mm", 2], 0, "minute");
|
---|
5347 | addUnitAlias("minute", "m");
|
---|
5348 | addUnitPriority("minute", 14);
|
---|
5349 | addRegexToken("m", match1to2);
|
---|
5350 | addRegexToken("mm", match1to2, match2);
|
---|
5351 | addParseToken(["m", "mm"], MINUTE);
|
---|
5352 | var getSetMinute = makeGetSet("Minutes", false);
|
---|
5353 | addFormatToken("s", ["ss", 2], 0, "second");
|
---|
5354 | addUnitAlias("second", "s");
|
---|
5355 | addUnitPriority("second", 15);
|
---|
5356 | addRegexToken("s", match1to2);
|
---|
5357 | addRegexToken("ss", match1to2, match2);
|
---|
5358 | addParseToken(["s", "ss"], SECOND);
|
---|
5359 | var getSetSecond = makeGetSet("Seconds", false);
|
---|
5360 | addFormatToken("S", 0, 0, function () {
|
---|
5361 | return ~~(this.millisecond() / 100)
|
---|
5362 | });
|
---|
5363 | addFormatToken(0, ["SS", 2], 0, function () {
|
---|
5364 | return ~~(this.millisecond() / 10)
|
---|
5365 | });
|
---|
5366 | addFormatToken(0, ["SSS", 3], 0, "millisecond");
|
---|
5367 | addFormatToken(0, ["SSSS", 4], 0, function () {
|
---|
5368 | return this.millisecond() * 10
|
---|
5369 | });
|
---|
5370 | addFormatToken(0, ["SSSSS", 5], 0, function () {
|
---|
5371 | return this.millisecond() * 100
|
---|
5372 | });
|
---|
5373 | addFormatToken(0, ["SSSSSS", 6], 0, function () {
|
---|
5374 | return this.millisecond() * 1e3
|
---|
5375 | });
|
---|
5376 | addFormatToken(0, ["SSSSSSS", 7], 0, function () {
|
---|
5377 | return this.millisecond() * 1e4
|
---|
5378 | });
|
---|
5379 | addFormatToken(0, ["SSSSSSSS", 8], 0, function () {
|
---|
5380 | return this.millisecond() * 1e5
|
---|
5381 | });
|
---|
5382 | addFormatToken(0, ["SSSSSSSSS", 9], 0, function () {
|
---|
5383 | return this.millisecond() * 1e6
|
---|
5384 | });
|
---|
5385 | addUnitAlias("millisecond", "ms");
|
---|
5386 | addUnitPriority("millisecond", 16);
|
---|
5387 | addRegexToken("S", match1to3, match1);
|
---|
5388 | addRegexToken("SS", match1to3, match2);
|
---|
5389 | addRegexToken("SSS", match1to3, match3);
|
---|
5390 | var token;
|
---|
5391 | for (token = "SSSS"; token.length <= 9; token += "S") {
|
---|
5392 | addRegexToken(token, matchUnsigned)
|
---|
5393 | }
|
---|
5394 |
|
---|
5395 | function parseMs(input, array) {
|
---|
5396 | array[MILLISECOND] = toInt(("0." + input) * 1e3)
|
---|
5397 | }
|
---|
5398 | for (token = "S"; token.length <= 9; token += "S") {
|
---|
5399 | addParseToken(token, parseMs)
|
---|
5400 | }
|
---|
5401 | var getSetMillisecond = makeGetSet("Milliseconds", false);
|
---|
5402 | addFormatToken("z", 0, 0, "zoneAbbr");
|
---|
5403 | addFormatToken("zz", 0, 0, "zoneName");
|
---|
5404 |
|
---|
5405 | function getZoneAbbr() {
|
---|
5406 | return this._isUTC ? "UTC" : ""
|
---|
5407 | }
|
---|
5408 |
|
---|
5409 | function getZoneName() {
|
---|
5410 | return this._isUTC ? "Coordinated Universal Time" : ""
|
---|
5411 | }
|
---|
5412 | var proto = Moment.prototype;
|
---|
5413 | proto.add = add;
|
---|
5414 | proto.calendar = calendar$1;
|
---|
5415 | proto.clone = clone;
|
---|
5416 | proto.diff = diff;
|
---|
5417 | proto.endOf = endOf;
|
---|
5418 | proto.format = format;
|
---|
5419 | proto.from = from;
|
---|
5420 | proto.fromNow = fromNow;
|
---|
5421 | proto.to = to;
|
---|
5422 | proto.toNow = toNow;
|
---|
5423 | proto.get = stringGet;
|
---|
5424 | proto.invalidAt = invalidAt;
|
---|
5425 | proto.isAfter = isAfter;
|
---|
5426 | proto.isBefore = isBefore;
|
---|
5427 | proto.isBetween = isBetween;
|
---|
5428 | proto.isSame = isSame;
|
---|
5429 | proto.isSameOrAfter = isSameOrAfter;
|
---|
5430 | proto.isSameOrBefore = isSameOrBefore;
|
---|
5431 | proto.isValid = isValid$1;
|
---|
5432 | proto.lang = lang;
|
---|
5433 | proto.locale = locale;
|
---|
5434 | proto.localeData = localeData;
|
---|
5435 | proto.max = prototypeMax;
|
---|
5436 | proto.min = prototypeMin;
|
---|
5437 | proto.parsingFlags = parsingFlags;
|
---|
5438 | proto.set = stringSet;
|
---|
5439 | proto.startOf = startOf;
|
---|
5440 | proto.subtract = subtract;
|
---|
5441 | proto.toArray = toArray;
|
---|
5442 | proto.toObject = toObject;
|
---|
5443 | proto.toDate = toDate;
|
---|
5444 | proto.toISOString = toISOString;
|
---|
5445 | proto.inspect = inspect;
|
---|
5446 | proto.toJSON = toJSON;
|
---|
5447 | proto.toString = toString;
|
---|
5448 | proto.unix = unix;
|
---|
5449 | proto.valueOf = valueOf;
|
---|
5450 | proto.creationData = creationData;
|
---|
5451 | proto.year = getSetYear;
|
---|
5452 | proto.isLeapYear = getIsLeapYear;
|
---|
5453 | proto.weekYear = getSetWeekYear;
|
---|
5454 | proto.isoWeekYear = getSetISOWeekYear;
|
---|
5455 | proto.quarter = proto.quarters = getSetQuarter;
|
---|
5456 | proto.month = getSetMonth;
|
---|
5457 | proto.daysInMonth = getDaysInMonth;
|
---|
5458 | proto.week = proto.weeks = getSetWeek;
|
---|
5459 | proto.isoWeek = proto.isoWeeks = getSetISOWeek;
|
---|
5460 | proto.weeksInYear = getWeeksInYear;
|
---|
5461 | proto.isoWeeksInYear = getISOWeeksInYear;
|
---|
5462 | proto.date = getSetDayOfMonth;
|
---|
5463 | proto.day = proto.days = getSetDayOfWeek;
|
---|
5464 | proto.weekday = getSetLocaleDayOfWeek;
|
---|
5465 | proto.isoWeekday = getSetISODayOfWeek;
|
---|
5466 | proto.dayOfYear = getSetDayOfYear;
|
---|
5467 | proto.hour = proto.hours = getSetHour;
|
---|
5468 | proto.minute = proto.minutes = getSetMinute;
|
---|
5469 | proto.second = proto.seconds = getSetSecond;
|
---|
5470 | proto.millisecond = proto.milliseconds = getSetMillisecond;
|
---|
5471 | proto.utcOffset = getSetOffset;
|
---|
5472 | proto.utc = setOffsetToUTC;
|
---|
5473 | proto.local = setOffsetToLocal;
|
---|
5474 | proto.parseZone = setOffsetToParsedOffset;
|
---|
5475 | proto.hasAlignedHourOffset = hasAlignedHourOffset;
|
---|
5476 | proto.isDST = isDaylightSavingTime;
|
---|
5477 | proto.isLocal = isLocal;
|
---|
5478 | proto.isUtcOffset = isUtcOffset;
|
---|
5479 | proto.isUtc = isUtc;
|
---|
5480 | proto.isUTC = isUtc;
|
---|
5481 | proto.zoneAbbr = getZoneAbbr;
|
---|
5482 | proto.zoneName = getZoneName;
|
---|
5483 | proto.dates = deprecate("dates accessor is deprecated. Use date instead.", getSetDayOfMonth);
|
---|
5484 | proto.months = deprecate("months accessor is deprecated. Use month instead", getSetMonth);
|
---|
5485 | proto.years = deprecate("years accessor is deprecated. Use year instead", getSetYear);
|
---|
5486 | proto.zone = deprecate("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", getSetZone);
|
---|
5487 | proto.isDSTShifted = deprecate("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", isDaylightSavingTimeShifted);
|
---|
5488 |
|
---|
5489 | function createUnix(input) {
|
---|
5490 | return createLocal(input * 1e3)
|
---|
5491 | }
|
---|
5492 |
|
---|
5493 | function createInZone() {
|
---|
5494 | return createLocal.apply(null, arguments).parseZone()
|
---|
5495 | }
|
---|
5496 |
|
---|
5497 | function preParsePostFormat(string) {
|
---|
5498 | return string
|
---|
5499 | }
|
---|
5500 | var proto$1 = Locale.prototype;
|
---|
5501 | proto$1.calendar = calendar;
|
---|
5502 | proto$1.longDateFormat = longDateFormat;
|
---|
5503 | proto$1.invalidDate = invalidDate;
|
---|
5504 | proto$1.ordinal = ordinal;
|
---|
5505 | proto$1.preparse = preParsePostFormat;
|
---|
5506 | proto$1.postformat = preParsePostFormat;
|
---|
5507 | proto$1.relativeTime = relativeTime;
|
---|
5508 | proto$1.pastFuture = pastFuture;
|
---|
5509 | proto$1.set = set;
|
---|
5510 | proto$1.months = localeMonths;
|
---|
5511 | proto$1.monthsShort = localeMonthsShort;
|
---|
5512 | proto$1.monthsParse = localeMonthsParse;
|
---|
5513 | proto$1.monthsRegex = monthsRegex;
|
---|
5514 | proto$1.monthsShortRegex = monthsShortRegex;
|
---|
5515 | proto$1.week = localeWeek;
|
---|
5516 | proto$1.firstDayOfYear = localeFirstDayOfYear;
|
---|
5517 | proto$1.firstDayOfWeek = localeFirstDayOfWeek;
|
---|
5518 | proto$1.weekdays = localeWeekdays;
|
---|
5519 | proto$1.weekdaysMin = localeWeekdaysMin;
|
---|
5520 | proto$1.weekdaysShort = localeWeekdaysShort;
|
---|
5521 | proto$1.weekdaysParse = localeWeekdaysParse;
|
---|
5522 | proto$1.weekdaysRegex = weekdaysRegex;
|
---|
5523 | proto$1.weekdaysShortRegex = weekdaysShortRegex;
|
---|
5524 | proto$1.weekdaysMinRegex = weekdaysMinRegex;
|
---|
5525 | proto$1.isPM = localeIsPM;
|
---|
5526 | proto$1.meridiem = localeMeridiem;
|
---|
5527 |
|
---|
5528 | function get$1(format, index, field, setter) {
|
---|
5529 | var locale = getLocale();
|
---|
5530 | var utc = createUTC().set(setter, index);
|
---|
5531 | return locale[field](utc, format)
|
---|
5532 | }
|
---|
5533 |
|
---|
5534 | function listMonthsImpl(format, index, field) {
|
---|
5535 | if (isNumber(format)) {
|
---|
5536 | index = format;
|
---|
5537 | format = undefined
|
---|
5538 | }
|
---|
5539 | format = format || "";
|
---|
5540 | if (index != null) {
|
---|
5541 | return get$1(format, index, field, "month")
|
---|
5542 | }
|
---|
5543 | var i;
|
---|
5544 | var out = [];
|
---|
5545 | for (i = 0; i < 12; i++) {
|
---|
5546 | out[i] = get$1(format, i, field, "month")
|
---|
5547 | }
|
---|
5548 | return out
|
---|
5549 | }
|
---|
5550 |
|
---|
5551 | function listWeekdaysImpl(localeSorted, format, index, field) {
|
---|
5552 | if (typeof localeSorted === "boolean") {
|
---|
5553 | if (isNumber(format)) {
|
---|
5554 | index = format;
|
---|
5555 | format = undefined
|
---|
5556 | }
|
---|
5557 | format = format || ""
|
---|
5558 | } else {
|
---|
5559 | format = localeSorted;
|
---|
5560 | index = format;
|
---|
5561 | localeSorted = false;
|
---|
5562 | if (isNumber(format)) {
|
---|
5563 | index = format;
|
---|
5564 | format = undefined
|
---|
5565 | }
|
---|
5566 | format = format || ""
|
---|
5567 | }
|
---|
5568 | var locale = getLocale(),
|
---|
5569 | shift = localeSorted ? locale._week.dow : 0;
|
---|
5570 | if (index != null) {
|
---|
5571 | return get$1(format, (index + shift) % 7, field, "day")
|
---|
5572 | }
|
---|
5573 | var i;
|
---|
5574 | var out = [];
|
---|
5575 | for (i = 0; i < 7; i++) {
|
---|
5576 | out[i] = get$1(format, (i + shift) % 7, field, "day")
|
---|
5577 | }
|
---|
5578 | return out
|
---|
5579 | }
|
---|
5580 |
|
---|
5581 | function listMonths(format, index) {
|
---|
5582 | return listMonthsImpl(format, index, "months")
|
---|
5583 | }
|
---|
5584 |
|
---|
5585 | function listMonthsShort(format, index) {
|
---|
5586 | return listMonthsImpl(format, index, "monthsShort")
|
---|
5587 | }
|
---|
5588 |
|
---|
5589 | function listWeekdays(localeSorted, format, index) {
|
---|
5590 | return listWeekdaysImpl(localeSorted, format, index, "weekdays")
|
---|
5591 | }
|
---|
5592 |
|
---|
5593 | function listWeekdaysShort(localeSorted, format, index) {
|
---|
5594 | return listWeekdaysImpl(localeSorted, format, index, "weekdaysShort")
|
---|
5595 | }
|
---|
5596 |
|
---|
5597 | function listWeekdaysMin(localeSorted, format, index) {
|
---|
5598 | return listWeekdaysImpl(localeSorted, format, index, "weekdaysMin")
|
---|
5599 | }
|
---|
5600 | getSetGlobalLocale("en", {
|
---|
5601 | ordinalParse: /\d{1,2}(th|st|nd|rd)/,
|
---|
5602 | ordinal: function (number) {
|
---|
5603 | var b = number % 10,
|
---|
5604 | output = toInt(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
|
---|
5605 | return number + output
|
---|
5606 | }
|
---|
5607 | });
|
---|
5608 | hooks.lang = deprecate("moment.lang is deprecated. Use moment.locale instead.", getSetGlobalLocale);
|
---|
5609 | hooks.langData = deprecate("moment.langData is deprecated. Use moment.localeData instead.", getLocale);
|
---|
5610 | var mathAbs = Math.abs;
|
---|
5611 |
|
---|
5612 | function abs() {
|
---|
5613 | var data = this._data;
|
---|
5614 | this._milliseconds = mathAbs(this._milliseconds);
|
---|
5615 | this._days = mathAbs(this._days);
|
---|
5616 | this._months = mathAbs(this._months);
|
---|
5617 | data.milliseconds = mathAbs(data.milliseconds);
|
---|
5618 | data.seconds = mathAbs(data.seconds);
|
---|
5619 | data.minutes = mathAbs(data.minutes);
|
---|
5620 | data.hours = mathAbs(data.hours);
|
---|
5621 | data.months = mathAbs(data.months);
|
---|
5622 | data.years = mathAbs(data.years);
|
---|
5623 | return this
|
---|
5624 | }
|
---|
5625 |
|
---|
5626 | function addSubtract$1(duration, input, value, direction) {
|
---|
5627 | var other = createDuration(input, value);
|
---|
5628 | duration._milliseconds += direction * other._milliseconds;
|
---|
5629 | duration._days += direction * other._days;
|
---|
5630 | duration._months += direction * other._months;
|
---|
5631 | return duration._bubble()
|
---|
5632 | }
|
---|
5633 |
|
---|
5634 | function add$1(input, value) {
|
---|
5635 | return addSubtract$1(this, input, value, 1)
|
---|
5636 | }
|
---|
5637 |
|
---|
5638 | function subtract$1(input, value) {
|
---|
5639 | return addSubtract$1(this, input, value, -1)
|
---|
5640 | }
|
---|
5641 |
|
---|
5642 | function absCeil(number) {
|
---|
5643 | if (number < 0) {
|
---|
5644 | return Math.floor(number)
|
---|
5645 | } else {
|
---|
5646 | return Math.ceil(number)
|
---|
5647 | }
|
---|
5648 | }
|
---|
5649 |
|
---|
5650 | function bubble() {
|
---|
5651 | var milliseconds = this._milliseconds;
|
---|
5652 | var days = this._days;
|
---|
5653 | var months = this._months;
|
---|
5654 | var data = this._data;
|
---|
5655 | var seconds, minutes, hours, years, monthsFromDays; // check: https://github.com/moment/moment/issues/2166
|
---|
5656 | if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) {
|
---|
5657 | milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
|
---|
5658 | days = 0;
|
---|
5659 | months = 0
|
---|
5660 | }
|
---|
5661 | data.milliseconds = milliseconds % 1e3;
|
---|
5662 | seconds = absFloor(milliseconds / 1e3);
|
---|
5663 | data.seconds = seconds % 60;
|
---|
5664 | minutes = absFloor(seconds / 60);
|
---|
5665 | data.minutes = minutes % 60;
|
---|
5666 | hours = absFloor(minutes / 60);
|
---|
5667 | data.hours = hours % 24;
|
---|
5668 | days += absFloor(hours / 24);
|
---|
5669 | monthsFromDays = absFloor(daysToMonths(days));
|
---|
5670 | months += monthsFromDays;
|
---|
5671 | days -= absCeil(monthsToDays(monthsFromDays));
|
---|
5672 | years = absFloor(months / 12);
|
---|
5673 | months %= 12;
|
---|
5674 | data.days = days;
|
---|
5675 | data.months = months;
|
---|
5676 | data.years = years;
|
---|
5677 | return this
|
---|
5678 | }
|
---|
5679 |
|
---|
5680 | function daysToMonths(days) {
|
---|
5681 | return days * 4800 / 146097
|
---|
5682 | }
|
---|
5683 |
|
---|
5684 | function monthsToDays(months) {
|
---|
5685 | return months * 146097 / 4800
|
---|
5686 | }
|
---|
5687 |
|
---|
5688 | function as(units) {
|
---|
5689 | var days;
|
---|
5690 | var months;
|
---|
5691 | var milliseconds = this._milliseconds;
|
---|
5692 | units = normalizeUnits(units);
|
---|
5693 | if (units === "month" || units === "year") {
|
---|
5694 | days = this._days + milliseconds / 864e5;
|
---|
5695 | months = this._months + daysToMonths(days);
|
---|
5696 | return units === "month" ? months : months / 12
|
---|
5697 | } else {
|
---|
5698 | days = this._days + Math.round(monthsToDays(this._months));
|
---|
5699 | switch (units) {
|
---|
5700 | case "week":
|
---|
5701 | return days / 7 + milliseconds / 6048e5;
|
---|
5702 | case "day":
|
---|
5703 | return days + milliseconds / 864e5;
|
---|
5704 | case "hour":
|
---|
5705 | return days * 24 + milliseconds / 36e5;
|
---|
5706 | case "minute":
|
---|
5707 | return days * 1440 + milliseconds / 6e4;
|
---|
5708 | case "second":
|
---|
5709 | return days * 86400 + milliseconds / 1e3;
|
---|
5710 | case "millisecond":
|
---|
5711 | return Math.floor(days * 864e5) + milliseconds;
|
---|
5712 | default:
|
---|
5713 | throw new Error("Unknown unit " + units)
|
---|
5714 | }
|
---|
5715 | }
|
---|
5716 | }
|
---|
5717 |
|
---|
5718 | function valueOf$1() {
|
---|
5719 | return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6
|
---|
5720 | }
|
---|
5721 |
|
---|
5722 | function makeAs(alias) {
|
---|
5723 | return function () {
|
---|
5724 | return this.as(alias)
|
---|
5725 | }
|
---|
5726 | }
|
---|
5727 | var asMilliseconds = makeAs("ms");
|
---|
5728 | var asSeconds = makeAs("s");
|
---|
5729 | var asMinutes = makeAs("m");
|
---|
5730 | var asHours = makeAs("h");
|
---|
5731 | var asDays = makeAs("d");
|
---|
5732 | var asWeeks = makeAs("w");
|
---|
5733 | var asMonths = makeAs("M");
|
---|
5734 | var asYears = makeAs("y");
|
---|
5735 |
|
---|
5736 | function get$2(units) {
|
---|
5737 | units = normalizeUnits(units);
|
---|
5738 | return this[units + "s"]()
|
---|
5739 | }
|
---|
5740 |
|
---|
5741 | function makeGetter(name) {
|
---|
5742 | return function () {
|
---|
5743 | return this._data[name]
|
---|
5744 | }
|
---|
5745 | }
|
---|
5746 | var milliseconds = makeGetter("milliseconds");
|
---|
5747 | var seconds = makeGetter("seconds");
|
---|
5748 | var minutes = makeGetter("minutes");
|
---|
5749 | var hours = makeGetter("hours");
|
---|
5750 | var days = makeGetter("days");
|
---|
5751 | var months = makeGetter("months");
|
---|
5752 | var years = makeGetter("years");
|
---|
5753 |
|
---|
5754 | function weeks() {
|
---|
5755 | return absFloor(this.days() / 7)
|
---|
5756 | }
|
---|
5757 | var round = Math.round;
|
---|
5758 | var thresholds = {
|
---|
5759 | s: 45,
|
---|
5760 | m: 45,
|
---|
5761 | h: 22,
|
---|
5762 | d: 26,
|
---|
5763 | M: 11
|
---|
5764 | };
|
---|
5765 |
|
---|
5766 | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
|
---|
5767 | return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture)
|
---|
5768 | }
|
---|
5769 |
|
---|
5770 | function relativeTime$1(posNegDuration, withoutSuffix, locale) {
|
---|
5771 | var duration = createDuration(posNegDuration).abs();
|
---|
5772 | var seconds = round(duration.as("s"));
|
---|
5773 | var minutes = round(duration.as("m"));
|
---|
5774 | var hours = round(duration.as("h"));
|
---|
5775 | var days = round(duration.as("d"));
|
---|
5776 | var months = round(duration.as("M"));
|
---|
5777 | var years = round(duration.as("y"));
|
---|
5778 | var a = seconds < thresholds.s && ["s", seconds] || minutes <= 1 && ["m"] || minutes < thresholds.m && ["mm", minutes] || hours <= 1 && ["h"] || hours < thresholds.h && ["hh", hours] || days <= 1 && ["d"] || days < thresholds.d && ["dd", days] || months <= 1 && ["M"] || months < thresholds.M && ["MM", months] || years <= 1 && ["y"] || ["yy", years];
|
---|
5779 | a[2] = withoutSuffix;
|
---|
5780 | a[3] = +posNegDuration > 0;
|
---|
5781 | a[4] = locale;
|
---|
5782 | return substituteTimeAgo.apply(null, a)
|
---|
5783 | }
|
---|
5784 |
|
---|
5785 | function getSetRelativeTimeRounding(roundingFunction) {
|
---|
5786 | if (roundingFunction === undefined) {
|
---|
5787 | return round
|
---|
5788 | }
|
---|
5789 | if (typeof roundingFunction === "function") {
|
---|
5790 | round = roundingFunction;
|
---|
5791 | return true
|
---|
5792 | }
|
---|
5793 | return false
|
---|
5794 | }
|
---|
5795 |
|
---|
5796 | function getSetRelativeTimeThreshold(threshold, limit) {
|
---|
5797 | if (thresholds[threshold] === undefined) {
|
---|
5798 | return false
|
---|
5799 | }
|
---|
5800 | if (limit === undefined) {
|
---|
5801 | return thresholds[threshold]
|
---|
5802 | }
|
---|
5803 | thresholds[threshold] = limit;
|
---|
5804 | return true
|
---|
5805 | }
|
---|
5806 |
|
---|
5807 | function humanize(withSuffix) {
|
---|
5808 | var locale = this.localeData();
|
---|
5809 | var output = relativeTime$1(this, !withSuffix, locale);
|
---|
5810 | if (withSuffix) {
|
---|
5811 | output = locale.pastFuture(+this, output)
|
---|
5812 | }
|
---|
5813 | return locale.postformat(output)
|
---|
5814 | }
|
---|
5815 | var abs$1 = Math.abs;
|
---|
5816 |
|
---|
5817 | function toISOString$1() {
|
---|
5818 | var seconds = abs$1(this._milliseconds) / 1e3;
|
---|
5819 | var days = abs$1(this._days);
|
---|
5820 | var months = abs$1(this._months);
|
---|
5821 | var minutes, hours, years;
|
---|
5822 | minutes = absFloor(seconds / 60);
|
---|
5823 | hours = absFloor(minutes / 60);
|
---|
5824 | seconds %= 60;
|
---|
5825 | minutes %= 60;
|
---|
5826 | years = absFloor(months / 12);
|
---|
5827 | months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
|
---|
5828 | var Y = years;
|
---|
5829 | var M = months;
|
---|
5830 | var D = days;
|
---|
5831 | var h = hours;
|
---|
5832 | var m = minutes;
|
---|
5833 | var s = seconds;
|
---|
5834 | var total = this.asSeconds();
|
---|
5835 | if (!total) {
|
---|
5836 | return "P0D"
|
---|
5837 | }
|
---|
5838 | return (total < 0 ? "-" : "") + "P" + (Y ? Y + "Y" : "") + (M ? M + "M" : "") + (D ? D + "D" : "") + (h || m || s ? "T" : "") + (h ? h + "H" : "") + (m ? m + "M" : "") + (s ? s + "S" : "")
|
---|
5839 | }
|
---|
5840 | var proto$2 = Duration.prototype;
|
---|
5841 | proto$2.abs = abs;
|
---|
5842 | proto$2.add = add$1;
|
---|
5843 | proto$2.subtract = subtract$1;
|
---|
5844 | proto$2.as = as;
|
---|
5845 | proto$2.asMilliseconds = asMilliseconds;
|
---|
5846 | proto$2.asSeconds = asSeconds;
|
---|
5847 | proto$2.asMinutes = asMinutes;
|
---|
5848 | proto$2.asHours = asHours;
|
---|
5849 | proto$2.asDays = asDays;
|
---|
5850 | proto$2.asWeeks = asWeeks;
|
---|
5851 | proto$2.asMonths = asMonths;
|
---|
5852 | proto$2.asYears = asYears;
|
---|
5853 | proto$2.valueOf = valueOf$1;
|
---|
5854 | proto$2._bubble = bubble;
|
---|
5855 | proto$2.get = get$2;
|
---|
5856 | proto$2.milliseconds = milliseconds;
|
---|
5857 | proto$2.seconds = seconds;
|
---|
5858 | proto$2.minutes = minutes;
|
---|
5859 | proto$2.hours = hours;
|
---|
5860 | proto$2.days = days;
|
---|
5861 | proto$2.weeks = weeks;
|
---|
5862 | proto$2.months = months;
|
---|
5863 | proto$2.years = years;
|
---|
5864 | proto$2.humanize = humanize;
|
---|
5865 | proto$2.toISOString = toISOString$1;
|
---|
5866 | proto$2.toString = toISOString$1;
|
---|
5867 | proto$2.toJSON = toISOString$1;
|
---|
5868 | proto$2.locale = locale;
|
---|
5869 | proto$2.localeData = localeData;
|
---|
5870 | proto$2.toIsoString = deprecate("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", toISOString$1);
|
---|
5871 | proto$2.lang = lang;
|
---|
5872 | addFormatToken("X", 0, 0, "unix");
|
---|
5873 | addFormatToken("x", 0, 0, "valueOf");
|
---|
5874 | addRegexToken("x", matchSigned);
|
---|
5875 | addRegexToken("X", matchTimestamp);
|
---|
5876 | addParseToken("X", function (input, array, config) {
|
---|
5877 | config._d = new Date(parseFloat(input, 10) * 1e3)
|
---|
5878 | });
|
---|
5879 | addParseToken("x", function (input, array, config) {
|
---|
5880 | config._d = new Date(toInt(input))
|
---|
5881 | });
|
---|
5882 | hooks.version = "2.17.1";
|
---|
5883 | setHookCallback(createLocal);
|
---|
5884 | hooks.fn = proto;
|
---|
5885 | hooks.min = min;
|
---|
5886 | hooks.max = max;
|
---|
5887 | hooks.now = now;
|
---|
5888 | hooks.utc = createUTC;
|
---|
5889 | hooks.unix = createUnix;
|
---|
5890 | hooks.months = listMonths;
|
---|
5891 | hooks.isDate = isDate;
|
---|
5892 | hooks.locale = getSetGlobalLocale;
|
---|
5893 | hooks.invalid = createInvalid;
|
---|
5894 | hooks.duration = createDuration;
|
---|
5895 | hooks.isMoment = isMoment;
|
---|
5896 | hooks.weekdays = listWeekdays;
|
---|
5897 | hooks.parseZone = createInZone;
|
---|
5898 | hooks.localeData = getLocale;
|
---|
5899 | hooks.isDuration = isDuration;
|
---|
5900 | hooks.monthsShort = listMonthsShort;
|
---|
5901 | hooks.weekdaysMin = listWeekdaysMin;
|
---|
5902 | hooks.defineLocale = defineLocale;
|
---|
5903 | hooks.updateLocale = updateLocale;
|
---|
5904 | hooks.locales = listLocales;
|
---|
5905 | hooks.weekdaysShort = listWeekdaysShort;
|
---|
5906 | hooks.normalizeUnits = normalizeUnits;
|
---|
5907 | hooks.relativeTimeRounding = getSetRelativeTimeRounding;
|
---|
5908 | hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
|
---|
5909 | hooks.calendarFormat = getCalendarFormat;
|
---|
5910 | hooks.prototype = proto;
|
---|
5911 | return hooks
|
---|
5912 | })
|
---|
5913 | }, {}],
|
---|
5914 | opening_hours: [function (require, module, exports) {
|
---|
5915 | /*
|
---|
5916 | * @source: https://github.com/opening-hours/opening_hours.js/blob/master/opening_hours.js
|
---|
5917 | * @source: ./opening_hours.js
|
---|
5918 | * @license: LGPL-3.0
|
---|
5919 | *
|
---|
5920 | * Copyright (C) 2012-2013 Dmitry Marakasov
|
---|
5921 | * Copyright (C) 2013-2016 Robin `ypid` Schneider
|
---|
5922 | *
|
---|
5923 | * opening_hours.js is free software; you can redistribute it and/or modify it
|
---|
5924 | * under the terms of the GNU Lesser General Public License as published by the
|
---|
5925 | * Free Software Foundation, version 3 of the License.
|
---|
5926 | *
|
---|
5927 | * opening_hours.js is distributed in the hope that it will be useful,
|
---|
5928 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
5929 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
5930 | * Lesser General Public License for more details.
|
---|
5931 | *
|
---|
5932 | * You should have received a copy of the GNU Lesser General Public
|
---|
5933 | * License along with opening_hours.js; if not, see
|
---|
5934 | * <https://www.gnu.org/licenses/>.
|
---|
5935 | * For information see https://github.com/opening-hours/opening_hours.js
|
---|
5936 | * and the docs directory which contains internal documentation and design.
|
---|
5937 | *
|
---|
5938 | * ---------------
|
---|
5939 | * Copyright (C) 2012-2013 Dmitry Marakasov
|
---|
5940 | *
|
---|
5941 | * All work done by Dmitry Marakasov is additionally published under the New (2-clause) BSD license.
|
---|
5942 | * Refer to the README.md and the reversion control history for more details.
|
---|
5943 | */
|
---|
5944 | (function (root, factory) {
|
---|
5945 | "use strict";
|
---|
5946 | var holiday_definitions = {
|
---|
5947 | nl: {
|
---|
5948 | PH: {
|
---|
5949 | Nieuwjaarsdag: [1, 1],
|
---|
5950 | "Goede vrijdag": ["easter", -2],
|
---|
5951 | "Tweede Paasdag": ["easter", 1],
|
---|
5952 | Koningsdag: [4, 27],
|
---|
5953 | Bevreidingsdag: [5, 5],
|
---|
5954 | Hemelvaartsdag: ["easter", 39],
|
---|
5955 | "Tweede Pinksterdag": ["easter", 50],
|
---|
5956 | "Eerste Kerstdag": [12, 25],
|
---|
5957 | "Tweede Kerstdag": [12, 26]
|
---|
5958 | }
|
---|
5959 | },
|
---|
5960 | be: {
|
---|
5961 | PH: {
|
---|
5962 | "Nieuwjaar - Jour de l'an": [1, 1],
|
---|
5963 | "Paasmaandag - Lundi de Pâques": ["easter", 1],
|
---|
5964 | "Dag van de Arbeid - Fête du Travail": [5, 1],
|
---|
5965 | "Onze-Lieve-Heer-Hemelvaart - Jeudi de l'Ascensionn": ["easter", 39],
|
---|
5966 | "Pinkstermaandag - Lundi de Pentecôte": ["easter", 50],
|
---|
5967 | "Nationale feestdag van België - Fête nationale": [7, 21],
|
---|
5968 | "Onze-Lieve-Vrouw-Hemelvaart - Assomption": [8, 15],
|
---|
5969 | "Allerheiligen - Toussaint": [11, 1],
|
---|
5970 | "Wapenstilstand - Armistice": [11, 11],
|
---|
5971 | "Kerstmis - Noël": [12, 25]
|
---|
5972 | }
|
---|
5973 | },
|
---|
5974 | pl: {
|
---|
5975 | _nominatim_url: "https://nominatim.openstreetmap.org/reverse?format=json&lat=53.4825&lon=18.75823&zoom=18&addressdetails=1&accept-language=pl,en",
|
---|
5976 | PH: {
|
---|
5977 | "Nowy Rok": [1, 1],
|
---|
5978 | "Święto Trzech Króli": [1, 6],
|
---|
5979 | Wielkanoc: ["easter", 0],
|
---|
5980 | "Lany Poniedziałek - drugi dzień Wielkiej Nocy": ["easter", 1],
|
---|
5981 | "Pierwszy Maja": [5, 1],
|
---|
5982 | "Trzeci Maja": [5, 3],
|
---|
5983 | "Zielone Świątki": ["easter", 49],
|
---|
5984 | "Boże Ciało": ["easter", 60],
|
---|
5985 | "Wniebowzięcie Najświętszej Maryi Panny": [8, 15],
|
---|
5986 | "Wszystkich Świętych": [11, 1],
|
---|
5987 | "Święto Niepodległości": [11, 11],
|
---|
5988 | "pierwszy dzień Bożego Narodzenia": [12, 25],
|
---|
5989 | "drugi dzień Bożego Narodzenia": [12, 26]
|
---|
5990 | }
|
---|
5991 | },
|
---|
5992 | fr: {
|
---|
5993 | PH: {
|
---|
5994 | "Jour de l'an": [1, 1],
|
---|
5995 | "Vendredi saint": ["easter", -2, ["Moselle", "Bas-Rhin", "Haut-Rhin", "Guadeloupe", "Martinique", "Polynésie française"]],
|
---|
5996 | "Lundi de Pâques": ["easter", 1],
|
---|
5997 | "Saint-Pierre-Chanel": [4, 28, ["Wallis-et-Futuna"]],
|
---|
5998 | "Fête du Travail": [5, 1],
|
---|
5999 | "Fête de la Victoire": [5, 8],
|
---|
6000 | "Abolition de l'esclavage (Martinique)": [5, 22, ["Martinique"]],
|
---|
6001 | "Abolition de l'esclavage (Guadeloupe)": [5, 27, ["Guadeloupe"]],
|
---|
6002 | "Jeudi de l'Ascension": ["easter", 39],
|
---|
6003 | "Lundi de Pentecôte": ["easter", 50],
|
---|
6004 | "Abolition de l'esclavage (Guyane)": [6, 10, ["Guyane"]],
|
---|
6005 | "Fête de l'autonomie": [6, 29, ["Polynésie française"]],
|
---|
6006 | "Fête nationale": [7, 14],
|
---|
6007 | "Fête Victor Schoelcher": [7, 21, ["Guadeloupe", "Martinique"]],
|
---|
6008 | "Fête du Territoire": [7, 29, ["Wallis-et-Futuna"]],
|
---|
6009 | Assomption: [8, 15],
|
---|
6010 | "Fête de la citoyenneté": [9, 24, ["Nouvelle-Calédonie"]],
|
---|
6011 | Toussaint: [11, 1],
|
---|
6012 | Armistice: [11, 11],
|
---|
6013 | "Abolition de l'esclavage (Réunion)": [12, 20, ["Réunion"]],
|
---|
6014 | "Noël": [12, 25],
|
---|
6015 | "Saint-Étienne ": [12, 26, ["Moselle", "Bas-Rhin", "Haut-Rhin"]]
|
---|
6016 | }
|
---|
6017 | },
|
---|
6018 | de: {
|
---|
6019 | _nominatim_url: "https://nominatim.openstreetmap.org/reverse?format=json&lat=49.5487429714954&lon=9.81602098644987&zoom=18&addressdetails=1&accept-language=de,en",
|
---|
6020 | PH: {
|
---|
6021 | Neujahrstag: [1, 1],
|
---|
6022 | "Heilige Drei Könige": [1, 6, ["Baden-Württemberg", "Bayern", "Sachsen-Anhalt"]],
|
---|
6023 | "Tag der Arbeit": [5, 1],
|
---|
6024 | Karfreitag: ["easter", -2],
|
---|
6025 | Ostersonntag: ["easter", 0, ["Brandenburg"]],
|
---|
6026 | Ostermontag: ["easter", 1],
|
---|
6027 | "Christi Himmelfahrt": ["easter", 39],
|
---|
6028 | Pfingstsonntag: ["easter", 49, ["Brandenburg"]],
|
---|
6029 | Pfingstmontag: ["easter", 50],
|
---|
6030 | Fronleichnam: ["easter", 60, ["Baden-Württemberg", "Bayern", "Hessen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland"]],
|
---|
6031 | "Mariä Himmelfahrt": [8, 15, ["Saarland"]],
|
---|
6032 | "Tag der Deutschen Einheit": [10, 3],
|
---|
6033 | Reformationstag: [10, 31, ["Brandenburg", "Mecklenburg-Vorpommern", "Sachsen", "Sachsen-Anhalt", "Thüringen"]],
|
---|
6034 | Allerheiligen: [11, 1, ["Baden-Württemberg", "Bayern", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland"]],
|
---|
6035 | "Buß- und Bettag": ["nextWednesday16Nov", 0, ["Sachsen"]],
|
---|
6036 | "1. Weihnachtstag": [12, 25],
|
---|
6037 | "2. Weihnachtstag": [12, 26]
|
---|
6038 | },
|
---|
6039 | "Baden-Württemberg": {
|
---|
6040 | _nominatim_url: "https://nominatim.openstreetmap.org/reverse?format=json&lat=49.5487429714954&lon=9.81602098644987&zoom=18&addressdetails=1&accept-language=de,en",
|
---|
6041 | SH: [{
|
---|
6042 | name: "Osterferien",
|
---|
6043 | 2005: [3, 24, 3, 24, 3, 29, 4, 2],
|
---|
6044 | 2006: [4, 18, 4, 22],
|
---|
6045 | 2007: [4, 2, 4, 14],
|
---|
6046 | 2008: [3, 17, 3, 28],
|
---|
6047 | 2009: [4, 9, 4, 9, 4, 14, 4, 17],
|
---|
6048 | 2010: [4, 1, 4, 1, 4, 6, 4, 10],
|
---|
6049 | 2011: [4, 21, 4, 21, 4, 26, 4, 30],
|
---|
6050 | 2012: [4, 2, 4, 13],
|
---|
6051 | 2013: [3, 25, 4, 5],
|
---|
6052 | 2014: [4, 14, 4, 25],
|
---|
6053 | 2018: [3, 30, 4, 10],
|
---|
6054 | 2019: [3, 29, 4, 2],
|
---|
6055 | 2020: [4, 10, 4, 21]
|
---|
6056 | }, {
|
---|
6057 | name: "Pfingstferien",
|
---|
6058 | 2005: [5, 17, 5, 28],
|
---|
6059 | 2006: [5, 29, 6, 10],
|
---|
6060 | 2007: [5, 29, 6, 9],
|
---|
6061 | 2008: [5, 13, 5, 23],
|
---|
6062 | 2009: [5, 25, 6, 6],
|
---|
6063 | 2010: [5, 25, 6, 5],
|
---|
6064 | 2011: [6, 14, 6, 25],
|
---|
6065 | 2012: [5, 29, 6, 9],
|
---|
6066 | 2013: [5, 21, 6, 1],
|
---|
6067 | 2014: [6, 10, 6, 21],
|
---|
6068 | 2018: [5, 26, 6, 6],
|
---|
6069 | 2019: [5, 17, 5, 28],
|
---|
6070 | 2020: [6, 6, 6, 16]
|
---|
6071 | }, {
|
---|
6072 | name: "Sommerferien",
|
---|
6073 | 2005: [7, 28, 9, 10],
|
---|
6074 | 2006: [8, 3, 9, 16],
|
---|
6075 | 2007: [7, 26, 9, 8],
|
---|
6076 | 2008: [7, 24, 9, 6],
|
---|
6077 | 2009: [7, 30, 9, 12],
|
---|
6078 | 2010: [7, 29, 9, 11],
|
---|
6079 | 2011: [7, 28, 9, 10],
|
---|
6080 | 2012: [7, 26, 9, 8],
|
---|
6081 | 2013: [7, 25, 9, 7],
|
---|
6082 | 2014: [7, 31, 9, 13],
|
---|
6083 | 2018: [7, 30, 9, 12],
|
---|
6084 | 2019: [7, 28, 9, 10],
|
---|
6085 | 2020: [7, 27, 9, 9]
|
---|
6086 | }, {
|
---|
6087 | name: "Herbstferien",
|
---|
6088 | 2005: [11, 2, 11, 4],
|
---|
6089 | 2006: [10, 30, 11, 3],
|
---|
6090 | 2007: [10, 29, 11, 3],
|
---|
6091 | 2008: [10, 27, 10, 31],
|
---|
6092 | 2009: [10, 26, 10, 31],
|
---|
6093 | 2010: [11, 2, 11, 6],
|
---|
6094 | 2011: [10, 31, 10, 31, 11, 2, 11, 4],
|
---|
6095 | 2012: [10, 29, 11, 2],
|
---|
6096 | 2013: [10, 28, 10, 30],
|
---|
6097 | 2014: [10, 27, 10, 30],
|
---|
6098 | 2018: [11, 2, 11, 6],
|
---|
6099 | 2019: [11, 2, 11, 4]
|
---|
6100 | }, {
|
---|
6101 | name: "Weihnachtsferien",
|
---|
6102 | 2005: [12, 22, 1, 5],
|
---|
6103 | 2006: [12, 27, 1, 5],
|
---|
6104 | 2007: [12, 24, 1, 5],
|
---|
6105 | 2008: [12, 22, 1, 10],
|
---|
6106 | 2009: [12, 23, 1, 9],
|
---|
6107 | 2010: [12, 23, 1, 8],
|
---|
6108 | 2011: [12, 23, 1, 5],
|
---|
6109 | 2012: [12, 24, 1, 5],
|
---|
6110 | 2013: [12, 23, 1, 4],
|
---|
6111 | 2014: [12, 22, 1, 5],
|
---|
6112 | 2018: [12, 23, 1, 9],
|
---|
6113 | 2019: [12, 23, 1, 7]
|
---|
6114 | }]
|
---|
6115 | },
|
---|
6116 | "Mecklenburg-Vorpommern": {
|
---|
6117 | SH: [{
|
---|
6118 | name: "Winterferien",
|
---|
6119 | 2010: [2, 6, 2, 20],
|
---|
6120 | 2011: [2, 7, 2, 19],
|
---|
6121 | 2012: [2, 6, 2, 17],
|
---|
6122 | 2013: [2, 4, 2, 15],
|
---|
6123 | 2014: [2, 3, 2, 15],
|
---|
6124 | 2018: [2, 2, 2, 14],
|
---|
6125 | 2019: [2, 1, 2, 13],
|
---|
6126 | 2020: [2, 6, 2, 18]
|
---|
6127 | }, {
|
---|
6128 | name: "Osterferien",
|
---|
6129 | 2010: [3, 29, 4, 7],
|
---|
6130 | 2011: [4, 16, 4, 27],
|
---|
6131 | 2012: [4, 2, 4, 11],
|
---|
6132 | 2013: [3, 25, 4, 3],
|
---|
6133 | 2014: [4, 14, 4, 23],
|
---|
6134 | 2018: [3, 30, 4, 8],
|
---|
6135 | 2019: [3, 21, 3, 30],
|
---|
6136 | 2020: [4, 10, 4, 19]
|
---|
6137 | }, {
|
---|
6138 | name: "Pfingstferien",
|
---|
6139 | 2010: [5, 21, 5, 22],
|
---|
6140 | 2011: [6, 10, 6, 14],
|
---|
6141 | 2012: [5, 25, 5, 29],
|
---|
6142 | 2013: [5, 17, 5, 21],
|
---|
6143 | 2014: [6, 6, 6, 10],
|
---|
6144 | 2018: [5, 22, 5, 26],
|
---|
6145 | 2019: [5, 14, 5, 17],
|
---|
6146 | 2020: [6, 2, 6, 6]
|
---|
6147 | }, {
|
---|
6148 | name: "Sommerferien",
|
---|
6149 | 2010: [7, 12, 8, 21],
|
---|
6150 | 2011: [7, 4, 8, 13],
|
---|
6151 | 2012: [6, 23, 8, 4],
|
---|
6152 | 2013: [6, 22, 8, 3],
|
---|
6153 | 2014: [7, 14, 8, 23],
|
---|
6154 | 2018: [7, 20, 8, 29],
|
---|
6155 | 2019: [7, 25, 9, 3],
|
---|
6156 | 2020: [7, 24, 9, 2]
|
---|
6157 | }, {
|
---|
6158 | name: "Herbstferien",
|
---|
6159 | 2010: [10, 18, 10, 23],
|
---|
6160 | 2011: [10, 17, 10, 21],
|
---|
6161 | 2012: [10, 1, 10, 5],
|
---|
6162 | 2013: [10, 14, 10, 19],
|
---|
6163 | 2014: [10, 20, 10, 25],
|
---|
6164 | 2018: [10, 24, 10, 30],
|
---|
6165 | 2019: [10, 24, 10, 28]
|
---|
6166 | }, {
|
---|
6167 | name: "Weihnachtsferien",
|
---|
6168 | 2010: [12, 23, 12, 31],
|
---|
6169 | 2011: [12, 23, 1, 3],
|
---|
6170 | 2012: [12, 21, 1, 4],
|
---|
6171 | 2013: [12, 23, 1, 3],
|
---|
6172 | 2014: [12, 22, 1, 2],
|
---|
6173 | 2018: [12, 21, 1, 2],
|
---|
6174 | 2019: [12, 22, 1, 2]
|
---|
6175 | }]
|
---|
6176 | },
|
---|
6177 | Hessen: {
|
---|
6178 | SH: [{
|
---|
6179 | name: "Osterferien",
|
---|
6180 | 2010: [3, 29, 4, 10],
|
---|
6181 | 2011: [4, 18, 4, 30],
|
---|
6182 | 2012: [4, 2, 4, 14],
|
---|
6183 | 2013: [3, 25, 4, 6],
|
---|
6184 | 2014: [4, 14, 4, 26],
|
---|
6185 | 2018: [3, 30, 4, 11],
|
---|
6186 | 2019: [3, 29, 4, 9],
|
---|
6187 | 2020: [4, 3, 4, 15],
|
---|
6188 | 2021: [3, 26, 4, 7]
|
---|
6189 | }, {
|
---|
6190 | name: "Sommerferien",
|
---|
6191 | 2010: [7, 5, 8, 14],
|
---|
6192 | 2011: [6, 27, 8, 5],
|
---|
6193 | 2012: [7, 2, 8, 10],
|
---|
6194 | 2013: [7, 8, 8, 16],
|
---|
6195 | 2014: [7, 28, 9, 5],
|
---|
6196 | 2018: [7, 27, 9, 5],
|
---|
6197 | 2019: [7, 18, 8, 26],
|
---|
6198 | 2020: [7, 3, 8, 11]
|
---|
6199 | }, {
|
---|
6200 | name: "Herbstferien",
|
---|
6201 | 2010: [10, 11, 10, 22],
|
---|
6202 | 2011: [10, 10, 10, 22],
|
---|
6203 | 2012: [10, 15, 10, 27],
|
---|
6204 | 2013: [10, 14, 10, 26],
|
---|
6205 | 2014: [10, 20, 11, 1],
|
---|
6206 | 2018: [10, 19, 10, 31],
|
---|
6207 | 2019: [10, 17, 10, 29],
|
---|
6208 | 2020: [10, 9, 10, 21]
|
---|
6209 | }, {
|
---|
6210 | name: "Weihnachtsferien",
|
---|
6211 | 2010: [12, 20, 1, 7],
|
---|
6212 | 2011: [12, 21, 1, 6],
|
---|
6213 | 2012: [12, 24, 1, 12],
|
---|
6214 | 2013: [12, 23, 1, 11],
|
---|
6215 | 2014: [12, 22, 1, 10],
|
---|
6216 | 2018: [12, 23, 1, 9],
|
---|
6217 | 2019: [12, 22, 1, 7],
|
---|
6218 | 2020: [12, 24, 1, 13]
|
---|
6219 | }]
|
---|
6220 | },
|
---|
6221 | "Schleswig-Holstein": {
|
---|
6222 | SH: [{
|
---|
6223 | name: "Osterferien",
|
---|
6224 | 2010: [4, 3, 4, 17],
|
---|
6225 | 2011: [4, 15, 4, 30],
|
---|
6226 | 2012: [3, 30, 4, 13],
|
---|
6227 | 2013: [3, 25, 4, 9],
|
---|
6228 | 2014: [4, 16, 5, 2],
|
---|
6229 | 2018: [4, 1, 4, 17],
|
---|
6230 | 2019: [3, 24, 4, 9],
|
---|
6231 | 2020: [4, 7, 4, 21]
|
---|
6232 | }, {
|
---|
6233 | name: "Sommerferien",
|
---|
6234 | 2010: [7, 12, 8, 21],
|
---|
6235 | 2011: [7, 4, 8, 13],
|
---|
6236 | 2012: [6, 25, 8, 4],
|
---|
6237 | 2013: [6, 24, 8, 3],
|
---|
6238 | 2014: [7, 14, 8, 23],
|
---|
6239 | 2018: [7, 20, 8, 29],
|
---|
6240 | 2019: [7, 25, 9, 3],
|
---|
6241 | 2020: [7, 24, 9, 2]
|
---|
6242 | }, {
|
---|
6243 | name: "Pfingstferien",
|
---|
6244 | 2011: [6, 3, 6, 4],
|
---|
6245 | 2012: [5, 18, 5, 18],
|
---|
6246 | 2013: [5, 10, 5, 10],
|
---|
6247 | 2014: [5, 30, 5, 30],
|
---|
6248 | 2018: [5, 15, 5, 15],
|
---|
6249 | 2019: [5, 6, 5, 6],
|
---|
6250 | 2020: [5, 26, 5, 26]
|
---|
6251 | }, {
|
---|
6252 | name: "Herbstferien",
|
---|
6253 | 2010: [10, 11, 10, 23],
|
---|
6254 | 2011: [10, 10, 10, 22],
|
---|
6255 | 2012: [10, 4, 10, 19],
|
---|
6256 | 2013: [10, 4, 10, 18],
|
---|
6257 | 2014: [10, 13, 10, 25],
|
---|
6258 | 2018: [10, 19, 10, 31],
|
---|
6259 | 2019: [10, 17, 10, 29]
|
---|
6260 | }, {
|
---|
6261 | name: "Weihnachtsferien",
|
---|
6262 | 2010: [12, 23, 1, 7],
|
---|
6263 | 2011: [12, 23, 1, 6],
|
---|
6264 | 2012: [12, 24, 1, 5],
|
---|
6265 | 2013: [12, 23, 1, 6],
|
---|
6266 | 2014: [12, 22, 1, 6],
|
---|
6267 | 2018: [12, 21, 1, 6],
|
---|
6268 | 2019: [12, 23, 1, 6]
|
---|
6269 | }]
|
---|
6270 | },
|
---|
6271 | Berlin: {
|
---|
6272 | SH: [{
|
---|
6273 | name: "Winterferien",
|
---|
6274 | 2010: [2, 1, 2, 6],
|
---|
6275 | 2011: [1, 31, 2, 5],
|
---|
6276 | 2012: [1, 30, 2, 4],
|
---|
6277 | 2013: [2, 4, 2, 9],
|
---|
6278 | 2014: [2, 3, 2, 8],
|
---|
6279 | 2018: [2, 2, 2, 7],
|
---|
6280 | 2019: [2, 1, 2, 6],
|
---|
6281 | 2020: [1, 30, 2, 4]
|
---|
6282 | }, {
|
---|
6283 | name: "Osterferien",
|
---|
6284 | 2010: [3, 31, 4, 10],
|
---|
6285 | 2011: [4, 18, 4, 30],
|
---|
6286 | 2012: [4, 2, 4, 14, 4, 30, 4, 30],
|
---|
6287 | 2013: [3, 25, 4, 6],
|
---|
6288 | 2014: [4, 14, 4, 26, 5, 2, 5, 2],
|
---|
6289 | 2018: [3, 30, 4, 11],
|
---|
6290 | 2019: [3, 21, 4, 2],
|
---|
6291 | 2020: [4, 10, 4, 22]
|
---|
6292 | }, {
|
---|
6293 | name: "Pfingstferien",
|
---|
6294 | 2010: [5, 14, 5, 14, 5, 25, 5, 25],
|
---|
6295 | 2011: [6, 3, 6, 3],
|
---|
6296 | 2012: [5, 18, 5, 18],
|
---|
6297 | 2013: [5, 10, 5, 10, 5, 21, 5, 21],
|
---|
6298 | 2014: [5, 30, 5, 30],
|
---|
6299 | 2018: [5, 15, 5, 15],
|
---|
6300 | 2019: [5, 6, 5, 6, 5, 17, 5, 17],
|
---|
6301 | 2020: [5, 26, 5, 26]
|
---|
6302 | }, {
|
---|
6303 | name: "Sommerferien",
|
---|
6304 | 2010: [7, 7, 8, 21],
|
---|
6305 | 2011: [6, 29, 8, 12],
|
---|
6306 | 2012: [6, 20, 8, 3],
|
---|
6307 | 2013: [6, 19, 8, 2],
|
---|
6308 | 2014: [7, 9, 8, 22],
|
---|
6309 | 2018: [7, 15, 8, 28],
|
---|
6310 | 2019: [7, 20, 9, 2],
|
---|
6311 | 2020: [7, 19, 9, 1]
|
---|
6312 | }, {
|
---|
6313 | name: "Herbstferien",
|
---|
6314 | 2010: [10, 11, 10, 23],
|
---|
6315 | 2011: [10, 4, 10, 14],
|
---|
6316 | 2012: [10, 1, 10, 13],
|
---|
6317 | 2013: [9, 30, 10, 12],
|
---|
6318 | 2014: [10, 20, 11, 1],
|
---|
6319 | 2018: [10, 19, 10, 31],
|
---|
6320 | 2019: [10, 17, 10, 28]
|
---|
6321 | }, {
|
---|
6322 | name: "Weihnachtsferien",
|
---|
6323 | 2010: [12, 23, 1, 1],
|
---|
6324 | 2011: [12, 23, 1, 3],
|
---|
6325 | 2012: [12, 24, 1, 4],
|
---|
6326 | 2013: [12, 23, 1, 3],
|
---|
6327 | 2014: [12, 22, 1, 2],
|
---|
6328 | 2018: [12, 23, 1, 2],
|
---|
6329 | 2019: [12, 23, 1, 3]
|
---|
6330 | }]
|
---|
6331 | },
|
---|
6332 | Saarland: {
|
---|
6333 | SH: [{
|
---|
6334 | name: "Winterferien",
|
---|
6335 | 2010: [2, 15, 2, 20],
|
---|
6336 | 2011: [3, 7, 3, 12],
|
---|
6337 | 2012: [2, 20, 2, 25],
|
---|
6338 | 2013: [2, 11, 2, 16],
|
---|
6339 | 2014: [3, 3, 3, 8],
|
---|
6340 | 2018: [2, 16, 2, 21]
|
---|
6341 | }, {
|
---|
6342 | name: "Osterferien",
|
---|
6343 | 2010: [3, 29, 4, 10],
|
---|
6344 | 2011: [4, 18, 4, 30],
|
---|
6345 | 2012: [4, 2, 4, 14],
|
---|
6346 | 2013: [3, 25, 4, 6],
|
---|
6347 | 2014: [4, 14, 4, 26],
|
---|
6348 | 2018: [3, 30, 4, 11]
|
---|
6349 | }, {
|
---|
6350 | name: "Sommerferien",
|
---|
6351 | 2010: [7, 5, 8, 14],
|
---|
6352 | 2011: [6, 24, 8, 6],
|
---|
6353 | 2012: [7, 2, 8, 14],
|
---|
6354 | 2013: [7, 8, 8, 17],
|
---|
6355 | 2014: [7, 28, 9, 6],
|
---|
6356 | 2018: [7, 27, 9, 4],
|
---|
6357 | 2019: [7, 18, 8, 26],
|
---|
6358 | 2020: [7, 3, 8, 14]
|
---|
6359 | }, {
|
---|
6360 | name: "Herbstferien",
|
---|
6361 | 2010: [10, 11, 10, 23],
|
---|
6362 | 2011: [10, 4, 10, 15],
|
---|
6363 | 2012: [10, 22, 11, 3],
|
---|
6364 | 2013: [10, 21, 11, 2],
|
---|
6365 | 2014: [10, 20, 10, 31]
|
---|
6366 | }, {
|
---|
6367 | name: "Weihnachtsferien",
|
---|
6368 | 2010: [12, 20, 1, 1],
|
---|
6369 | 2011: [12, 23, 1, 4],
|
---|
6370 | 2012: [12, 24, 1, 5],
|
---|
6371 | 2013: [12, 20, 1, 4],
|
---|
6372 | 2014: [12, 22, 1, 7]
|
---|
6373 | }]
|
---|
6374 | },
|
---|
6375 | Bremen: {
|
---|
6376 | SH: [{
|
---|
6377 | name: "Winterferien",
|
---|
6378 | 2010: [2, 1, 2, 2],
|
---|
6379 | 2011: [1, 31, 2, 1],
|
---|
6380 | 2012: [1, 30, 1, 31],
|
---|
6381 | 2013: [1, 31, 2, 1],
|
---|
6382 | 2014: [1, 30, 1, 31],
|
---|
6383 | 2018: [2, 2, 2, 3],
|
---|
6384 | 2019: [1, 28, 1, 29],
|
---|
6385 | 2020: [1, 30, 1, 31]
|
---|
6386 | }, {
|
---|
6387 | name: "Osterferien",
|
---|
6388 | 2010: [3, 19, 4, 6],
|
---|
6389 | 2011: [4, 16, 4, 30],
|
---|
6390 | 2012: [3, 26, 4, 11, 4, 30, 4, 30],
|
---|
6391 | 2013: [3, 16, 4, 2],
|
---|
6392 | 2014: [4, 3, 4, 22, 5, 2, 5, 2],
|
---|
6393 | 2018: [3, 25, 4, 10],
|
---|
6394 | 2019: [3, 18, 4, 2],
|
---|
6395 | 2020: [4, 10, 4, 22]
|
---|
6396 | }, {
|
---|
6397 | name: "Pfingstferien",
|
---|
6398 | 2010: [5, 14, 5, 14, 5, 25, 5, 25],
|
---|
6399 | 2011: [6, 3, 6, 3, 6, 14, 6, 14],
|
---|
6400 | 2012: [5, 18, 5, 18, 5, 29, 5, 29],
|
---|
6401 | 2013: [5, 10, 5, 10, 5, 21, 5, 21],
|
---|
6402 | 2014: [5, 30, 5, 30, 6, 10, 6, 10],
|
---|
6403 | 2018: [5, 15, 5, 15, 5, 26, 5, 26],
|
---|
6404 | 2019: [5, 6, 5, 6, 5, 17, 5, 17],
|
---|
6405 | 2020: [5, 26, 5, 26, 6, 6, 6, 6]
|
---|
6406 | }, {
|
---|
6407 | name: "Sommerferien",
|
---|
6408 | 2010: [6, 24, 8, 4],
|
---|
6409 | 2011: [7, 7, 8, 17],
|
---|
6410 | 2012: [7, 23, 8, 31],
|
---|
6411 | 2013: [6, 27, 8, 7],
|
---|
6412 | 2014: [7, 31, 9, 10],
|
---|
6413 | 2018: [7, 23, 9, 2],
|
---|
6414 | 2019: [6, 23, 8, 3],
|
---|
6415 | 2020: [6, 22, 8, 2]
|
---|
6416 | }, {
|
---|
6417 | name: "Herbstferien",
|
---|
6418 | 2010: [10, 9, 10, 23],
|
---|
6419 | 2011: [10, 17, 10, 29],
|
---|
6420 | 2012: [10, 22, 11, 3],
|
---|
6421 | 2013: [10, 4, 10, 18],
|
---|
6422 | 2014: [10, 27, 11, 8],
|
---|
6423 | 2018: [10, 19, 10, 31],
|
---|
6424 | 2019: [10, 4, 10, 15]
|
---|
6425 | }, {
|
---|
6426 | name: "Weihnachtsferien",
|
---|
6427 | 2010: [12, 22, 1, 5],
|
---|
6428 | 2011: [12, 23, 1, 4],
|
---|
6429 | 2012: [12, 24, 1, 5],
|
---|
6430 | 2013: [12, 23, 1, 3],
|
---|
6431 | 2014: [12, 22, 1, 5],
|
---|
6432 | 2018: [12, 23, 1, 6],
|
---|
6433 | 2019: [12, 21, 1, 6]
|
---|
6434 | }]
|
---|
6435 | },
|
---|
6436 | Bayern: {
|
---|
6437 | SH: [{
|
---|
6438 | name: "Winterferien",
|
---|
6439 | 2010: [2, 15, 2, 20],
|
---|
6440 | 2011: [3, 7, 3, 11],
|
---|
6441 | 2012: [2, 20, 2, 24],
|
---|
6442 | 2013: [2, 11, 2, 15],
|
---|
6443 | 2014: [3, 3, 3, 7],
|
---|
6444 | 2018: [2, 16, 2, 20],
|
---|
6445 | 2019: [2, 8, 2, 12],
|
---|
6446 | 2020: [2, 27, 3, 3]
|
---|
6447 | }, {
|
---|
6448 | name: "Osterferien",
|
---|
6449 | 2010: [3, 29, 4, 10],
|
---|
6450 | 2011: [4, 18, 4, 30],
|
---|
6451 | 2012: [4, 2, 4, 14],
|
---|
6452 | 2013: [3, 25, 4, 6],
|
---|
6453 | 2014: [4, 14, 4, 26],
|
---|
6454 | 2018: [3, 30, 4, 11],
|
---|
6455 | 2019: [3, 21, 4, 1],
|
---|
6456 | 2020: [4, 10, 4, 22]
|
---|
6457 | }, {
|
---|
6458 | name: "Pfingstferien",
|
---|
6459 | 2010: [5, 25, 6, 5],
|
---|
6460 | 2011: [6, 14, 6, 25],
|
---|
6461 | 2012: [5, 29, 6, 9],
|
---|
6462 | 2013: [5, 21, 5, 31],
|
---|
6463 | 2014: [6, 10, 6, 21],
|
---|
6464 | 2018: [5, 26, 6, 5],
|
---|
6465 | 2019: [5, 17, 5, 28],
|
---|
6466 | 2020: [6, 6, 6, 16]
|
---|
6467 | }, {
|
---|
6468 | name: "Sommerferien",
|
---|
6469 | 2010: [8, 2, 9, 13],
|
---|
6470 | 2011: [7, 30, 9, 12],
|
---|
6471 | 2012: [8, 1, 9, 12],
|
---|
6472 | 2013: [7, 31, 9, 11],
|
---|
6473 | 2014: [7, 30, 9, 15],
|
---|
6474 | 2018: [8, 1, 9, 14],
|
---|
6475 | 2019: [7, 30, 9, 12],
|
---|
6476 | 2020: [7, 29, 9, 11]
|
---|
6477 | }, {
|
---|
6478 | name: "Herbstferien",
|
---|
6479 | 2010: [11, 2, 11, 5],
|
---|
6480 | 2011: [10, 31, 11, 5],
|
---|
6481 | 2012: [10, 29, 11, 3],
|
---|
6482 | 2013: [10, 28, 10, 31],
|
---|
6483 | 2014: [10, 27, 10, 31],
|
---|
6484 | 2018: [11, 2, 11, 7],
|
---|
6485 | 2019: [10, 31, 11, 4]
|
---|
6486 | }, {
|
---|
6487 | name: "Weihnachtsferien",
|
---|
6488 | 2010: [12, 24, 1, 7],
|
---|
6489 | 2011: [12, 27, 1, 5],
|
---|
6490 | 2012: [12, 24, 1, 5],
|
---|
6491 | 2013: [12, 23, 1, 4],
|
---|
6492 | 2014: [12, 24, 1, 5],
|
---|
6493 | 2018: [12, 24, 1, 5],
|
---|
6494 | 2019: [12, 24, 1, 5]
|
---|
6495 | }]
|
---|
6496 | },
|
---|
6497 | Niedersachsen: {
|
---|
6498 | SH: [{
|
---|
6499 | name: "Winterferien",
|
---|
6500 | 2010: [2, 1, 2, 2],
|
---|
6501 | 2011: [1, 31, 2, 1],
|
---|
6502 | 2012: [1, 30, 1, 31],
|
---|
6503 | 2013: [1, 31, 2, 1],
|
---|
6504 | 2014: [1, 30, 1, 31],
|
---|
6505 | 2018: [2, 2, 2, 3],
|
---|
6506 | 2019: [1, 28, 1, 29],
|
---|
6507 | 2020: [1, 30, 1, 31]
|
---|
6508 | }, {
|
---|
6509 | name: "Osterferien",
|
---|
6510 | 2010: [3, 19, 4, 6],
|
---|
6511 | 2011: [4, 16, 4, 30],
|
---|
6512 | 2012: [3, 26, 4, 11, 4, 30, 4, 30],
|
---|
6513 | 2013: [3, 16, 4, 2],
|
---|
6514 | 2014: [4, 3, 4, 22, 5, 2, 5, 2],
|
---|
6515 | 2018: [3, 25, 4, 10],
|
---|
6516 | 2019: [3, 18, 4, 2],
|
---|
6517 | 2020: [4, 10, 4, 22]
|
---|
6518 | }, {
|
---|
6519 | name: "Pfingstferien",
|
---|
6520 | 2010: [5, 14, 5, 14, 5, 25, 5, 25],
|
---|
6521 | 2011: [6, 3, 6, 3, 6, 14, 6, 14],
|
---|
6522 | 2012: [5, 18, 5, 18, 5, 29, 5, 29],
|
---|
6523 | 2013: [5, 10, 5, 10, 5, 21, 5, 21],
|
---|
6524 | 2014: [5, 30, 5, 30, 6, 10, 6, 10],
|
---|
6525 | 2018: [5, 15, 5, 15, 5, 26, 5, 26],
|
---|
6526 | 2019: [5, 6, 5, 6, 5, 17, 5, 17],
|
---|
6527 | 2020: [5, 26, 5, 26, 6, 6, 6, 6]
|
---|
6528 | }, {
|
---|
6529 | name: "Sommerferien",
|
---|
6530 | 2010: [6, 24, 8, 4],
|
---|
6531 | 2011: [7, 7, 8, 17],
|
---|
6532 | 2012: [7, 23, 8, 31],
|
---|
6533 | 2013: [6, 27, 8, 7],
|
---|
6534 | 2014: [7, 31, 9, 10],
|
---|
6535 | 2018: [7, 23, 9, 2],
|
---|
6536 | 2019: [6, 23, 8, 3],
|
---|
6537 | 2020: [6, 22, 8, 2]
|
---|
6538 | }, {
|
---|
6539 | name: "Herbstferien",
|
---|
6540 | 2010: [10, 9, 10, 23],
|
---|
6541 | 2011: [10, 17, 10, 29],
|
---|
6542 | 2012: [10, 22, 11, 3],
|
---|
6543 | 2013: [10, 4, 10, 18],
|
---|
6544 | 2014: [10, 27, 11, 8],
|
---|
6545 | 2018: [10, 19, 10, 31],
|
---|
6546 | 2019: [10, 4, 10, 15]
|
---|
6547 | }, {
|
---|
6548 | name: "Weihnachtsferien",
|
---|
6549 | 2010: [12, 22, 1, 5],
|
---|
6550 | 2011: [12, 23, 1, 4],
|
---|
6551 | 2012: [12, 24, 1, 5],
|
---|
6552 | 2013: [12, 23, 1, 3],
|
---|
6553 | 2014: [12, 22, 1, 5],
|
---|
6554 | 2018: [12, 23, 1, 6],
|
---|
6555 | 2019: [12, 21, 1, 6]
|
---|
6556 | }]
|
---|
6557 | },
|
---|
6558 | "Nordrhein-Westfalen": {
|
---|
6559 | SH: [{
|
---|
6560 | name: "Osterferien",
|
---|
6561 | 2010: [3, 27, 4, 10],
|
---|
6562 | 2011: [4, 18, 4, 30],
|
---|
6563 | 2012: [4, 2, 4, 14],
|
---|
6564 | 2013: [3, 25, 4, 6],
|
---|
6565 | 2014: [4, 14, 4, 26],
|
---|
6566 | 2018: [3, 30, 4, 11],
|
---|
6567 | 2019: [3, 21, 4, 2],
|
---|
6568 | 2020: [4, 10, 4, 22]
|
---|
6569 | }, {
|
---|
6570 | name: "Pfingstferien",
|
---|
6571 | 2010: [5, 25, 5, 25],
|
---|
6572 | 2012: [5, 29, 5, 29],
|
---|
6573 | 2013: [5, 21, 5, 21],
|
---|
6574 | 2014: [6, 10, 6, 10],
|
---|
6575 | 2018: [5, 26, 5, 26],
|
---|
6576 | 2019: [5, 17, 5, 17],
|
---|
6577 | 2020: [6, 6, 6, 6]
|
---|
6578 | }, {
|
---|
6579 | name: "Sommerferien",
|
---|
6580 | 2010: [7, 15, 8, 27],
|
---|
6581 | 2011: [7, 25, 9, 6],
|
---|
6582 | 2012: [7, 9, 8, 21],
|
---|
6583 | 2013: [7, 22, 9, 3],
|
---|
6584 | 2014: [7, 7, 8, 19],
|
---|
6585 | 2018: [6, 29, 8, 11],
|
---|
6586 | 2019: [7, 11, 8, 23],
|
---|
6587 | 2020: [7, 17, 8, 29]
|
---|
6588 | }, {
|
---|
6589 | name: "Herbstferien",
|
---|
6590 | 2010: [10, 11, 10, 23],
|
---|
6591 | 2011: [10, 24, 11, 5],
|
---|
6592 | 2012: [10, 8, 10, 20],
|
---|
6593 | 2013: [10, 21, 11, 2],
|
---|
6594 | 2014: [10, 6, 10, 18],
|
---|
6595 | 2018: [10, 5, 10, 17],
|
---|
6596 | 2019: [10, 10, 10, 21]
|
---|
6597 | }, {
|
---|
6598 | name: "Weihnachtsferien",
|
---|
6599 | 2010: [12, 24, 1, 8],
|
---|
6600 | 2011: [12, 23, 1, 6],
|
---|
6601 | 2012: [12, 21, 1, 4],
|
---|
6602 | 2013: [12, 23, 1, 7],
|
---|
6603 | 2014: [12, 22, 1, 6],
|
---|
6604 | 2018: [12, 23, 1, 6],
|
---|
6605 | 2019: [12, 23, 1, 6]
|
---|
6606 | }]
|
---|
6607 | },
|
---|
6608 | Sachsen: {
|
---|
6609 | SH: [{
|
---|
6610 | name: "Winterferien",
|
---|
6611 | 2010: [2, 8, 2, 20],
|
---|
6612 | 2011: [2, 12, 2, 26],
|
---|
6613 | 2012: [2, 13, 2, 25],
|
---|
6614 | 2013: [2, 4, 2, 15],
|
---|
6615 | 2014: [2, 17, 3, 1],
|
---|
6616 | 2018: [2, 9, 2, 21],
|
---|
6617 | 2019: [2, 8, 2, 20],
|
---|
6618 | 2020: [2, 13, 2, 24]
|
---|
6619 | }, {
|
---|
6620 | name: "Osterferien",
|
---|
6621 | 2010: [4, 1, 4, 10],
|
---|
6622 | 2011: [4, 22, 4, 30],
|
---|
6623 | 2012: [4, 6, 4, 14],
|
---|
6624 | 2013: [3, 29, 4, 6],
|
---|
6625 | 2014: [4, 18, 4, 26],
|
---|
6626 | 2018: [4, 2, 4, 11],
|
---|
6627 | 2019: [3, 25, 4, 2],
|
---|
6628 | 2020: [4, 13, 4, 22]
|
---|
6629 | }, {
|
---|
6630 | name: "Pfingstferien",
|
---|
6631 | 2010: [5, 14, 5, 14],
|
---|
6632 | 2011: [6, 3, 6, 3],
|
---|
6633 | 2012: [5, 18, 5, 18],
|
---|
6634 | 2013: [5, 10, 5, 10, 5, 18, 5, 22],
|
---|
6635 | 2014: [5, 30, 5, 30],
|
---|
6636 | 2018: [5, 15, 5, 15],
|
---|
6637 | 2019: [5, 6, 5, 6],
|
---|
6638 | 2020: [5, 26, 5, 26]
|
---|
6639 | }, {
|
---|
6640 | name: "Sommerferien",
|
---|
6641 | 2010: [6, 28, 8, 6],
|
---|
6642 | 2011: [7, 11, 8, 19],
|
---|
6643 | 2012: [7, 23, 8, 31],
|
---|
6644 | 2013: [7, 15, 8, 23],
|
---|
6645 | 2014: [7, 21, 8, 29],
|
---|
6646 | 2018: [7, 13, 8, 21],
|
---|
6647 | 2019: [6, 27, 8, 5],
|
---|
6648 | 2020: [6, 26, 8, 4]
|
---|
6649 | }, {
|
---|
6650 | name: "Herbstferien",
|
---|
6651 | 2010: [10, 4, 10, 16],
|
---|
6652 | 2011: [10, 17, 10, 28],
|
---|
6653 | 2012: [10, 22, 11, 2],
|
---|
6654 | 2013: [10, 21, 11, 1],
|
---|
6655 | 2014: [10, 20, 10, 31],
|
---|
6656 | 2018: [10, 12, 10, 24],
|
---|
6657 | 2019: [10, 3, 10, 15]
|
---|
6658 | }, {
|
---|
6659 | name: "Weihnachtsferien",
|
---|
6660 | 2010: [12, 23, 1, 1],
|
---|
6661 | 2011: [12, 23, 1, 2],
|
---|
6662 | 2012: [12, 22, 1, 2],
|
---|
6663 | 2013: [12, 21, 1, 3],
|
---|
6664 | 2014: [12, 22, 1, 3],
|
---|
6665 | 2018: [12, 21, 1, 2],
|
---|
6666 | 2019: [12, 23, 1, 2]
|
---|
6667 | }]
|
---|
6668 | },
|
---|
6669 | "Thüringen": {
|
---|
6670 | SH: [{
|
---|
6671 | name: "Winterferien",
|
---|
6672 | 2010: [2, 1, 2, 6],
|
---|
6673 | 2011: [1, 31, 2, 5],
|
---|
6674 | 2012: [2, 6, 2, 11],
|
---|
6675 | 2013: [2, 18, 2, 23],
|
---|
6676 | 2014: [2, 17, 2, 22],
|
---|
6677 | 2018: [2, 2, 2, 7],
|
---|
6678 | 2019: [2, 1, 2, 6],
|
---|
6679 | 2020: [2, 6, 2, 11]
|
---|
6680 | }, {
|
---|
6681 | name: "Osterferien",
|
---|
6682 | 2010: [3, 29, 4, 9],
|
---|
6683 | 2011: [4, 18, 4, 30],
|
---|
6684 | 2012: [4, 2, 4, 13],
|
---|
6685 | 2013: [3, 25, 4, 6],
|
---|
6686 | 2014: [4, 19, 5, 2],
|
---|
6687 | 2018: [3, 30, 4, 11],
|
---|
6688 | 2019: [3, 24, 4, 2],
|
---|
6689 | 2020: [4, 10, 4, 21]
|
---|
6690 | }, {
|
---|
6691 | name: "Sommerferien",
|
---|
6692 | 2010: [6, 24, 8, 4],
|
---|
6693 | 2011: [7, 11, 8, 19],
|
---|
6694 | 2012: [7, 23, 8, 31],
|
---|
6695 | 2013: [7, 15, 8, 23],
|
---|
6696 | 2014: [7, 21, 8, 29],
|
---|
6697 | 2018: [7, 13, 8, 21],
|
---|
6698 | 2019: [6, 27, 8, 10],
|
---|
6699 | 2020: [6, 26, 8, 9]
|
---|
6700 | }, {
|
---|
6701 | name: "Pfingstferien",
|
---|
6702 | 2011: [6, 11, 6, 14],
|
---|
6703 | 2012: [5, 25, 5, 29],
|
---|
6704 | 2013: [5, 10, 5, 10],
|
---|
6705 | 2014: [5, 30, 5, 30],
|
---|
6706 | 2018: [5, 15, 5, 15],
|
---|
6707 | 2019: [5, 6, 5, 6],
|
---|
6708 | 2020: [5, 26, 5, 26]
|
---|
6709 | }, {
|
---|
6710 | name: "Herbstferien",
|
---|
6711 | 2010: [10, 9, 10, 23],
|
---|
6712 | 2011: [10, 17, 10, 28],
|
---|
6713 | 2012: [10, 22, 11, 3],
|
---|
6714 | 2013: [10, 21, 11, 2],
|
---|
6715 | 2014: [10, 6, 10, 18],
|
---|
6716 | 2018: [10, 5, 10, 17],
|
---|
6717 | 2019: [10, 10, 10, 22]
|
---|
6718 | }, {
|
---|
6719 | name: "Weihnachtsferien",
|
---|
6720 | 2010: [12, 23, 1, 1],
|
---|
6721 | 2011: [12, 23, 1, 1],
|
---|
6722 | 2012: [12, 24, 1, 5],
|
---|
6723 | 2013: [12, 23, 1, 4],
|
---|
6724 | 2014: [12, 22, 1, 3],
|
---|
6725 | 2018: [12, 23, 1, 2],
|
---|
6726 | 2019: [12, 23, 12, 31]
|
---|
6727 | }]
|
---|
6728 | },
|
---|
6729 | Hamburg: {
|
---|
6730 | SH: [{
|
---|
6731 | name: "Winterferien",
|
---|
6732 | 2010: [1, 29, 1, 29],
|
---|
6733 | 2011: [1, 31, 1, 31],
|
---|
6734 | 2012: [1, 30, 1, 30],
|
---|
6735 | 2013: [2, 1, 2, 1],
|
---|
6736 | 2014: [1, 31, 1, 31],
|
---|
6737 | 2018: [1, 30, 1, 30],
|
---|
6738 | 2019: [1, 29, 1, 29],
|
---|
6739 | 2020: [1, 30, 1, 30]
|
---|
6740 | }, {
|
---|
6741 | name: "Osterferien",
|
---|
6742 | 2010: [3, 8, 3, 20],
|
---|
6743 | 2011: [3, 7, 3, 18],
|
---|
6744 | 2012: [3, 5, 3, 16],
|
---|
6745 | 2013: [3, 4, 3, 15],
|
---|
6746 | 2014: [3, 3, 3, 14],
|
---|
6747 | 2018: [3, 2, 3, 13],
|
---|
6748 | 2019: [3, 7, 3, 18],
|
---|
6749 | 2020: [3, 6, 3, 17]
|
---|
6750 | }, {
|
---|
6751 | name: "Pfingstferien",
|
---|
6752 | 2010: [5, 14, 5, 22],
|
---|
6753 | 2011: [4, 26, 4, 29, 6, 3, 6, 3],
|
---|
6754 | 2012: [4, 30, 5, 4, 5, 18, 5, 18],
|
---|
6755 | 2013: [5, 2, 5, 10],
|
---|
6756 | 2014: [4, 28, 5, 2, 5, 30, 5, 30],
|
---|
6757 | 2018: [5, 11, 5, 15],
|
---|
6758 | 2019: [5, 6, 5, 6, 5, 17, 5, 20],
|
---|
6759 | 2020: [5, 22, 5, 26]
|
---|
6760 | }, {
|
---|
6761 | name: "Sommerferien",
|
---|
6762 | 2010: [7, 8, 8, 18],
|
---|
6763 | 2011: [6, 30, 8, 10],
|
---|
6764 | 2012: [6, 21, 8, 1],
|
---|
6765 | 2013: [6, 20, 7, 31],
|
---|
6766 | 2014: [7, 10, 8, 20],
|
---|
6767 | 2018: [7, 16, 8, 26],
|
---|
6768 | 2019: [7, 21, 8, 31],
|
---|
6769 | 2020: [7, 20, 8, 30]
|
---|
6770 | }, {
|
---|
6771 | name: "Herbstferien",
|
---|
6772 | 2010: [10, 4, 10, 15],
|
---|
6773 | 2011: [10, 4, 10, 14],
|
---|
6774 | 2012: [10, 1, 10, 12],
|
---|
6775 | 2013: [9, 30, 10, 11],
|
---|
6776 | 2014: [10, 13, 10, 24],
|
---|
6777 | 2018: [10, 19, 10, 30],
|
---|
6778 | 2019: [10, 17, 10, 28]
|
---|
6779 | }, {
|
---|
6780 | name: "Weihnachtsferien",
|
---|
6781 | 2010: [12, 23, 1, 3],
|
---|
6782 | 2011: [12, 27, 1, 6],
|
---|
6783 | 2012: [12, 21, 1, 4],
|
---|
6784 | 2013: [12, 19, 1, 3],
|
---|
6785 | 2014: [12, 22, 1, 6],
|
---|
6786 | 2018: [12, 21, 1, 1],
|
---|
6787 | 2019: [12, 27, 1, 6]
|
---|
6788 | }]
|
---|
6789 | },
|
---|
6790 | "Sachsen-Anhalt": {
|
---|
6791 | SH: [{
|
---|
6792 | name: "Winterferien",
|
---|
6793 | 2010: [2, 8, 2, 13],
|
---|
6794 | 2011: [2, 5, 2, 12],
|
---|
6795 | 2012: [2, 4, 2, 11],
|
---|
6796 | 2013: [2, 1, 2, 8],
|
---|
6797 | 2014: [2, 1, 2, 12],
|
---|
6798 | 2018: [2, 2, 2, 14],
|
---|
6799 | 2019: [2, 1, 2, 10],
|
---|
6800 | 2020: [2, 4, 2, 11]
|
---|
6801 | }, {
|
---|
6802 | name: "Osterferien",
|
---|
6803 | 2010: [3, 29, 4, 9],
|
---|
6804 | 2011: [4, 18, 4, 27],
|
---|
6805 | 2012: [4, 2, 4, 7],
|
---|
6806 | 2013: [3, 25, 3, 30],
|
---|
6807 | 2014: [4, 14, 4, 17],
|
---|
6808 | 2018: [4, 2, 4, 2],
|
---|
6809 | 2019: [3, 24, 3, 24],
|
---|
6810 | 2020: [4, 10, 4, 13]
|
---|
6811 | }, {
|
---|
6812 | name: "Pfingstferien",
|
---|
6813 | 2010: [5, 14, 5, 22],
|
---|
6814 | 2011: [6, 14, 6, 18],
|
---|
6815 | 2012: [5, 18, 5, 25],
|
---|
6816 | 2013: [5, 10, 5, 18],
|
---|
6817 | 2014: [5, 30, 6, 7],
|
---|
6818 | 2018: [5, 15, 5, 23],
|
---|
6819 | 2019: [5, 6, 5, 14],
|
---|
6820 | 2020: [5, 26, 5, 26]
|
---|
6821 | }, {
|
---|
6822 | name: "Sommerferien",
|
---|
6823 | 2010: [6, 24, 8, 4],
|
---|
6824 | 2011: [7, 11, 8, 24],
|
---|
6825 | 2012: [7, 23, 9, 5],
|
---|
6826 | 2013: [7, 15, 8, 28],
|
---|
6827 | 2014: [7, 21, 9, 3],
|
---|
6828 | 2018: [7, 13, 8, 26],
|
---|
6829 | 2019: [6, 27, 8, 10],
|
---|
6830 | 2020: [6, 26, 8, 9]
|
---|
6831 | }, {
|
---|
6832 | name: "Herbstferien",
|
---|
6833 | 2010: [10, 18, 10, 23],
|
---|
6834 | 2011: [10, 17, 10, 22],
|
---|
6835 | 2012: [10, 29, 11, 2],
|
---|
6836 | 2013: [10, 21, 10, 25],
|
---|
6837 | 2014: [10, 27, 10, 30],
|
---|
6838 | 2018: [10, 17, 10, 24],
|
---|
6839 | 2019: [10, 4, 10, 15]
|
---|
6840 | }, {
|
---|
6841 | name: "Weihnachtsferien",
|
---|
6842 | 2010: [12, 22, 1, 5],
|
---|
6843 | 2011: [12, 22, 1, 7],
|
---|
6844 | 2012: [12, 19, 1, 4],
|
---|
6845 | 2013: [12, 21, 1, 3],
|
---|
6846 | 2014: [12, 22, 1, 5],
|
---|
6847 | 2018: [12, 21, 1, 5],
|
---|
6848 | 2019: [12, 19, 1, 2]
|
---|
6849 | }]
|
---|
6850 | },
|
---|
6851 | "Rheinland-Pfalz": {
|
---|
6852 | SH: [{
|
---|
6853 | name: "Osterferien",
|
---|
6854 | 2010: [3, 26, 4, 9],
|
---|
6855 | 2011: [4, 18, 4, 29],
|
---|
6856 | 2012: [3, 29, 4, 13],
|
---|
6857 | 2013: [3, 20, 4, 5],
|
---|
6858 | 2014: [4, 11, 4, 25],
|
---|
6859 | 2018: [3, 26, 4, 10],
|
---|
6860 | 2019: [3, 18, 4, 1],
|
---|
6861 | 2020: [4, 10, 4, 21]
|
---|
6862 | }, {
|
---|
6863 | name: "Sommerferien",
|
---|
6864 | 2010: [7, 5, 8, 13],
|
---|
6865 | 2011: [6, 27, 8, 5],
|
---|
6866 | 2012: [7, 2, 8, 10],
|
---|
6867 | 2013: [7, 8, 8, 16],
|
---|
6868 | 2014: [7, 28, 9, 5],
|
---|
6869 | 2018: [7, 27, 9, 4],
|
---|
6870 | 2019: [7, 18, 8, 26],
|
---|
6871 | 2020: [7, 3, 8, 11]
|
---|
6872 | }, {
|
---|
6873 | name: "Herbstferien",
|
---|
6874 | 2010: [10, 11, 10, 22],
|
---|
6875 | 2011: [10, 4, 10, 14],
|
---|
6876 | 2012: [10, 1, 10, 12],
|
---|
6877 | 2013: [10, 4, 10, 18],
|
---|
6878 | 2014: [10, 20, 10, 31],
|
---|
6879 | 2018: [10, 19, 10, 30],
|
---|
6880 | 2019: [10, 10, 10, 21]
|
---|
6881 | }, {
|
---|
6882 | name: "Weihnachtsferien",
|
---|
6883 | 2010: [12, 23, 1, 7],
|
---|
6884 | 2011: [12, 22, 1, 6],
|
---|
6885 | 2012: [12, 20, 1, 4],
|
---|
6886 | 2013: [12, 23, 1, 7],
|
---|
6887 | 2014: [12, 22, 1, 7],
|
---|
6888 | 2018: [12, 23, 1, 8],
|
---|
6889 | 2019: [12, 22, 1, 6]
|
---|
6890 | }]
|
---|
6891 | },
|
---|
6892 | Brandenburg: {
|
---|
6893 | SH: [{
|
---|
6894 | name: "Winterferien",
|
---|
6895 | 2010: [2, 1, 2, 6],
|
---|
6896 | 2011: [1, 31, 2, 5],
|
---|
6897 | 2012: [1, 30, 2, 4],
|
---|
6898 | 2013: [2, 4, 2, 9],
|
---|
6899 | 2014: [2, 3, 2, 8],
|
---|
6900 | 2018: [2, 2, 2, 7],
|
---|
6901 | 2019: [2, 1, 2, 6],
|
---|
6902 | 2020: [1, 30, 2, 4]
|
---|
6903 | }, {
|
---|
6904 | name: "Osterferien",
|
---|
6905 | 2010: [3, 31, 4, 10],
|
---|
6906 | 2011: [4, 20, 4, 30],
|
---|
6907 | 2012: [4, 4, 4, 14, 4, 30, 4, 30],
|
---|
6908 | 2013: [3, 27, 4, 6],
|
---|
6909 | 2014: [4, 16, 4, 26, 5, 2, 5, 2],
|
---|
6910 | 2018: [4, 1, 4, 11],
|
---|
6911 | 2019: [3, 23, 4, 2],
|
---|
6912 | 2020: [4, 12, 4, 22]
|
---|
6913 | }, {
|
---|
6914 | name: "Pfingstferien",
|
---|
6915 | 2010: [5, 14, 5, 14],
|
---|
6916 | 2011: [6, 3, 6, 3],
|
---|
6917 | 2012: [5, 18, 5, 18],
|
---|
6918 | 2013: [5, 10, 5, 10],
|
---|
6919 | 2014: [5, 30, 5, 30],
|
---|
6920 | 2018: [5, 15, 5, 15],
|
---|
6921 | 2019: [5, 6, 5, 6, 5, 17, 5, 17],
|
---|
6922 | 2020: [5, 26, 5, 26]
|
---|
6923 | }, {
|
---|
6924 | name: "Sommerferien",
|
---|
6925 | 2010: [7, 8, 8, 21],
|
---|
6926 | 2011: [6, 30, 8, 13],
|
---|
6927 | 2012: [6, 21, 8, 3],
|
---|
6928 | 2013: [6, 20, 8, 2],
|
---|
6929 | 2014: [7, 10, 8, 22],
|
---|
6930 | 2018: [7, 16, 8, 28],
|
---|
6931 | 2019: [7, 21, 9, 3],
|
---|
6932 | 2020: [7, 20, 9, 1]
|
---|
6933 | }, {
|
---|
6934 | name: "Herbstferien",
|
---|
6935 | 2010: [10, 11, 10, 23],
|
---|
6936 | 2011: [10, 4, 10, 14],
|
---|
6937 | 2012: [10, 1, 10, 13],
|
---|
6938 | 2013: [9, 30, 10, 12, 11, 1, 11, 1],
|
---|
6939 | 2014: [10, 20, 11, 1],
|
---|
6940 | 2018: [10, 19, 10, 30],
|
---|
6941 | 2019: [10, 17, 10, 28]
|
---|
6942 | }, {
|
---|
6943 | name: "Weihnachtsferien",
|
---|
6944 | 2010: [12, 23, 1, 1],
|
---|
6945 | 2011: [12, 23, 1, 3],
|
---|
6946 | 2012: [12, 24, 1, 4],
|
---|
6947 | 2013: [12, 23, 1, 3],
|
---|
6948 | 2014: [12, 22, 1, 2],
|
---|
6949 | 2018: [12, 23, 1, 2],
|
---|
6950 | 2019: [12, 23, 1, 3]
|
---|
6951 | }]
|
---|
6952 | }
|
---|
6953 | },
|
---|
6954 | at: {
|
---|
6955 | PH: {
|
---|
6956 | Neujahrstag: [1, 1],
|
---|
6957 | "Heilige Drei Könige": [1, 6],
|
---|
6958 | Ostermontag: ["easter", 1],
|
---|
6959 | Staatsfeiertag: [5, 1],
|
---|
6960 | "Christi Himmelfahrt": ["easter", 39],
|
---|
6961 | Pfingstmontag: ["easter", 50],
|
---|
6962 | Fronleichnam: ["easter", 60],
|
---|
6963 | "Mariä Himmelfahrt": [8, 15],
|
---|
6964 | Nationalfeiertag: [10, 26],
|
---|
6965 | Allerheiligen: [11, 1],
|
---|
6966 | "Mariä Empfängnis": [12, 8],
|
---|
6967 | Christtag: [12, 25],
|
---|
6968 | Stefanitag: [12, 26]
|
---|
6969 | }
|
---|
6970 | },
|
---|
6971 | dk: {
|
---|
6972 | PH: {
|
---|
6973 | "Nytårsdag": [1, 1],
|
---|
6974 | "Skærtorsdag": ["easter", -3],
|
---|
6975 | Langfredag: ["easter", -2],
|
---|
6976 | "Påskedag": ["easter", 0],
|
---|
6977 | "2. Påskedag": ["easter", 1],
|
---|
6978 | "Store Bededag": ["easter", 26],
|
---|
6979 | "Kristi Himmelfartsdag": ["easter", 39],
|
---|
6980 | Pinsedag: ["easter", 49],
|
---|
6981 | "2. Pinsedag": ["easter", 50],
|
---|
6982 | Grundlovsdag: [6, 5],
|
---|
6983 | Juleaftensdag: [12, 24],
|
---|
6984 | Juledag: [12, 25],
|
---|
6985 | "2. Juledag": [12, 26]
|
---|
6986 | }
|
---|
6987 | },
|
---|
6988 | ca: {
|
---|
6989 | PH: {
|
---|
6990 | "New Year's Day": [1, 1],
|
---|
6991 | "Good Friday": ["easter", -2],
|
---|
6992 | "Canada Day": ["canadaDay", 0],
|
---|
6993 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
6994 | "Christmas Day": [12, 25]
|
---|
6995 | },
|
---|
6996 | Alberta: {
|
---|
6997 | PH: {
|
---|
6998 | "New Year's Day": [1, 1],
|
---|
6999 | "Alberta Family Day": ["firstFebruaryMonday", 14],
|
---|
7000 | "Good Friday": ["easter", -2],
|
---|
7001 | "Easter Monday": ["easter", 1],
|
---|
7002 | "Victoria Day": ["victoriaDay", 0],
|
---|
7003 | "Canada Day": ["canadaDay", 0],
|
---|
7004 | "Heritage Day": ["firstAugustMonday", 0],
|
---|
7005 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7006 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7007 | "Remembrance Day": [11, 11],
|
---|
7008 | "Christmas Day": [12, 25],
|
---|
7009 | "Boxing Day": [12, 26]
|
---|
7010 | }
|
---|
7011 | },
|
---|
7012 | "British Columbia": {
|
---|
7013 | PH: {
|
---|
7014 | "New Year's Day": [1, 1],
|
---|
7015 | "Family Day": ["firstFebruaryMonday", 7],
|
---|
7016 | "Good Friday": ["easter", -2],
|
---|
7017 | "Victoria Day": ["victoriaDay", 0],
|
---|
7018 | "Canada Day": ["canadaDay", 0],
|
---|
7019 | "British Columbia Day": ["firstAugustMonday", 0],
|
---|
7020 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7021 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7022 | "Remembrance Day": [11, 11],
|
---|
7023 | "Christmas Day": [12, 25]
|
---|
7024 | }
|
---|
7025 | },
|
---|
7026 | Manitoba: {
|
---|
7027 | PH: {
|
---|
7028 | "New Year's Day": [1, 1],
|
---|
7029 | "Louis Riel Day": ["firstFebruaryMonday", 14],
|
---|
7030 | "Good Friday": ["easter", -2],
|
---|
7031 | "Victoria Day": ["victoriaDay", 0],
|
---|
7032 | "Canada Day": ["canadaDay", 0],
|
---|
7033 | "Civic Holiday": ["firstAugustMonday", 0],
|
---|
7034 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7035 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7036 | "Remembrance Day": [11, 11],
|
---|
7037 | "Christmas Day": [12, 25]
|
---|
7038 | }
|
---|
7039 | },
|
---|
7040 | "New Brunswick": {
|
---|
7041 | PH: {
|
---|
7042 | "New Year's Day": [1, 1],
|
---|
7043 | "Good Friday": ["easter", -2],
|
---|
7044 | "Victoria Day": ["victoriaDay", 0],
|
---|
7045 | "Canada Day": ["canadaDay", 0],
|
---|
7046 | "New Brunswick Day": ["firstAugustMonday", 0],
|
---|
7047 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7048 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7049 | "Remembrance Day": [11, 11],
|
---|
7050 | "Christmas Day": [12, 25],
|
---|
7051 | "Boxing Day": [12, 26]
|
---|
7052 | }
|
---|
7053 | },
|
---|
7054 | "Newfoundland and Labrador": {
|
---|
7055 | PH: {
|
---|
7056 | "New Year's Day": [1, 1],
|
---|
7057 | "Saint Patrick's Day": [3, 17],
|
---|
7058 | "Good Friday": ["easter", -2],
|
---|
7059 | "Saint George's Day": [4, 23],
|
---|
7060 | "Discovery Day": [6, 24],
|
---|
7061 | "Memorial Day": [7, 1],
|
---|
7062 | "Orangemen's Day": [7, 12],
|
---|
7063 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7064 | "Armistice Day": [11, 11],
|
---|
7065 | "Christmas Day": [12, 25]
|
---|
7066 | }
|
---|
7067 | },
|
---|
7068 | "Northwest Territories": {
|
---|
7069 | PH: {
|
---|
7070 | "New Year's Day": [1, 1],
|
---|
7071 | "Good Friday": ["easter", -2],
|
---|
7072 | "Victoria Day": ["victoriaDay", 0],
|
---|
7073 | "National Aboriginal Day": [6, 21],
|
---|
7074 | "Canada Day": ["canadaDay", 0],
|
---|
7075 | "Civic Holiday": ["firstAugustMonday", 0],
|
---|
7076 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7077 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7078 | "Remembrance Day": [11, 11],
|
---|
7079 | "Christmas Day": [12, 25]
|
---|
7080 | }
|
---|
7081 | },
|
---|
7082 | "Nova Scotia": {
|
---|
7083 | PH: {
|
---|
7084 | "New Year's Day": [1, 1],
|
---|
7085 | "Good Friday": ["easter", -2],
|
---|
7086 | "Victoria Day": ["victoriaDay", 0],
|
---|
7087 | "Canada Day": ["canadaDay", 0],
|
---|
7088 | "Natal Day": ["firstAugustMonday", 0],
|
---|
7089 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7090 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7091 | "Remembrance Day": [11, 11],
|
---|
7092 | "Christmas Day": [12, 25],
|
---|
7093 | "Boxing Day": [12, 26]
|
---|
7094 | }
|
---|
7095 | },
|
---|
7096 | Nunavut: {
|
---|
7097 | PH: {
|
---|
7098 | "New Year's Day": [1, 1],
|
---|
7099 | "Good Friday": ["easter", -2],
|
---|
7100 | "Victoria Day": ["victoriaDay", 0],
|
---|
7101 | "Canada Day": ["canadaDay", 0],
|
---|
7102 | "Nunavut Day": [7, 9],
|
---|
7103 | "Civic Holiday": ["firstAugustMonday", 0],
|
---|
7104 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7105 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7106 | "Remembrance Day": [11, 11],
|
---|
7107 | "Christmas Day": [12, 25]
|
---|
7108 | }
|
---|
7109 | },
|
---|
7110 | Ontario: {
|
---|
7111 | PH: {
|
---|
7112 | "New Year's Day": [1, 1],
|
---|
7113 | "Family Day": ["firstFebruaryMonday", 14],
|
---|
7114 | "Good Friday": ["easter", -2],
|
---|
7115 | "Victoria Day": ["victoriaDay", 0],
|
---|
7116 | "Canada Day": ["canadaDay", 0],
|
---|
7117 | "August Civic Public Holiday": ["firstAugustMonday", 0],
|
---|
7118 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7119 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7120 | "Remembrance Day": [11, 11],
|
---|
7121 | "Christmas Day": [12, 25],
|
---|
7122 | "Boxing Day": [12, 26]
|
---|
7123 | }
|
---|
7124 | },
|
---|
7125 | "Prince Edward Island": {
|
---|
7126 | PH: {
|
---|
7127 | "New Year's Day": [1, 1],
|
---|
7128 | "Islander Day": ["firstFebruaryMonday", 14],
|
---|
7129 | "Good Friday": ["easter", -2],
|
---|
7130 | "Easter Monday": ["easter", 1],
|
---|
7131 | "Victoria Day": ["victoriaDay", 0],
|
---|
7132 | "Canada Day": ["canadaDay", 0],
|
---|
7133 | "Civic Holiday": ["firstAugustMonday", 0],
|
---|
7134 | "Gold Cup Parade Day": ["firstAugustMonday", 18],
|
---|
7135 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7136 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7137 | "Remembrance Day": [11, 11],
|
---|
7138 | "Christmas Day": [12, 25],
|
---|
7139 | "Boxing Day": [12, 26]
|
---|
7140 | }
|
---|
7141 | },
|
---|
7142 | Quebec: {
|
---|
7143 | PH: {
|
---|
7144 | "Jour de l'an": [1, 1],
|
---|
7145 | "Vendredi saint": ["easter", -2],
|
---|
7146 | "Lundi de Pâques": ["easter", 1],
|
---|
7147 | "Journée nationale des patriotes": ["victoriaDay", 0],
|
---|
7148 | "Fête nationale du Québec": [6, 24],
|
---|
7149 | "Fête du Canada": ["canadaDay", 0],
|
---|
7150 | "Fête du Travail": ["firstSeptemberMonday", 0],
|
---|
7151 | "Jour de l'Action de grâce": ["firstOctoberMonday", 7],
|
---|
7152 | "Noël": [12, 25]
|
---|
7153 | }
|
---|
7154 | },
|
---|
7155 | Saskatchewan: {
|
---|
7156 | PH: {
|
---|
7157 | "New Year's Day": [1, 1],
|
---|
7158 | "Family Day": ["firstFebruaryMonday", 14],
|
---|
7159 | "Good Friday": ["easter", -2],
|
---|
7160 | "Victoria Day": ["victoriaDay", 0],
|
---|
7161 | "Canada Day": ["canadaDay", 0],
|
---|
7162 | "Saskatchewan Day": ["firstAugustMonday", 0],
|
---|
7163 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7164 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7165 | "Remembrance Day": [11, 11],
|
---|
7166 | "Christmas Day": [12, 25]
|
---|
7167 | }
|
---|
7168 | },
|
---|
7169 | Yukon: {
|
---|
7170 | PH: {
|
---|
7171 | "New Year's Day": [1, 1],
|
---|
7172 | "Heritage Day": ["lastFebruarySunday", -2],
|
---|
7173 | "Good Friday": ["easter", -2],
|
---|
7174 | "Easter Monday": ["easter", 1],
|
---|
7175 | "Victoria Day": ["victoriaDay", 0],
|
---|
7176 | "Canada Day": ["canadaDay", 0],
|
---|
7177 | "Discovery Day": ["firstAugustMonday", 14],
|
---|
7178 | "Labour Day": ["firstSeptemberMonday", 0],
|
---|
7179 | Thanksgiving: ["firstOctoberMonday", 7],
|
---|
7180 | "Remembrance Day": [11, 11],
|
---|
7181 | "Christmas Day": [12, 25],
|
---|
7182 | "Boxing Day": [12, 26]
|
---|
7183 | }
|
---|
7184 | }
|
---|
7185 | },
|
---|
7186 | ru: {
|
---|
7187 | PH: {
|
---|
7188 | "1. Новогодние каникулы": [1, 1],
|
---|
7189 | "2. Новогодние каникулы": [1, 2],
|
---|
7190 | "3. Новогодние каникулы": [1, 3],
|
---|
7191 | "4. Новогодние каникулы": [1, 4],
|
---|
7192 | "5. Новогодние каникулы": [1, 5],
|
---|
7193 | "6. Новогодние каникулы": [1, 6],
|
---|
7194 | "Рождество Христово": [1, 7],
|
---|
7195 | "8. Новогодние каникулы": [1, 8],
|
---|
7196 | "День защитника Отечества": [2, 23],
|
---|
7197 | "Международный женский день": [3, 8],
|
---|
7198 | "День Победы": [5, 9],
|
---|
7199 | "Праздник Весны и Труда": [5, 1],
|
---|
7200 | "День народного единства": [11, 4],
|
---|
7201 | "День России": [6, 12]
|
---|
7202 | },
|
---|
7203 | Tatarstan: {
|
---|
7204 | PH: {
|
---|
7205 | "1. Новогодние каникулы": [1, 1],
|
---|
7206 | "2. Новогодние каникулы": [1, 2],
|
---|
7207 | "3. Новогодние каникулы": [1, 3],
|
---|
7208 | "4. Новогодние каникулы": [1, 4],
|
---|
7209 | "5. Новогодние каникулы": [1, 5],
|
---|
7210 | "6. Новогодние каникулы": [1, 6],
|
---|
7211 | "Рождество Христово": [1, 7],
|
---|
7212 | "8. Новогодние каникулы": [1, 8],
|
---|
7213 | "День защитника Отечества": [2, 23],
|
---|
7214 | "Международный женский день": [3, 8],
|
---|
7215 | "День Победы": [5, 9],
|
---|
7216 | "Праздник Весны и Труда": [5, 1],
|
---|
7217 | "День народного единства": [11, 4],
|
---|
7218 | "День России": [6, 12],
|
---|
7219 | "Ураза-байрам": [7, 28],
|
---|
7220 | "День Республики Татарстан": [8, 30],
|
---|
7221 | "Курбан-байрам": [10, 4],
|
---|
7222 | "День Конституции Республики Татарстан": [11, 6]
|
---|
7223 | }
|
---|
7224 | },
|
---|
7225 | Bashkortostan: {
|
---|
7226 | PH: {
|
---|
7227 | "1. Новогодние каникулы": [1, 1],
|
---|
7228 | "2. Новогодние каникулы": [1, 2],
|
---|
7229 | "3. Новогодние каникулы": [1, 3],
|
---|
7230 | "4. Новогодние каникулы": [1, 4],
|
---|
7231 | "5. Новогодние каникулы": [1, 5],
|
---|
7232 | "6. Новогодние каникулы": [1, 6],
|
---|
7233 | "Рождество Христово": [1, 7],
|
---|
7234 | "8. Новогодние каникулы": [1, 8],
|
---|
7235 | "День защитника Отечества": [2, 23],
|
---|
7236 | "Международный женский день": [3, 8],
|
---|
7237 | "День Победы": [5, 9],
|
---|
7238 | "Праздник Весны и Труда": [5, 1],
|
---|
7239 | "День народного единства": [11, 4],
|
---|
7240 | "День России": [6, 12],
|
---|
7241 | "Ураза-байрам": [7, 28],
|
---|
7242 | "Курбан-байрам": [10, 4],
|
---|
7243 | "День Республики Башкирии": [10, 11],
|
---|
7244 | "День Конституции Башкортостана": [12, 24]
|
---|
7245 | }
|
---|
7246 | },
|
---|
7247 | Chuvashia: {
|
---|
7248 | PH: {
|
---|
7249 | "1. Новогодние каникулы": [1, 1],
|
---|
7250 | "2. Новогодние каникулы": [1, 2],
|
---|
7251 | "3. Новогодние каникулы": [1, 3],
|
---|
7252 | "4. Новогодние каникулы": [1, 4],
|
---|
7253 | "5. Новогодние каникулы": [1, 5],
|
---|
7254 | "6. Новогодние каникулы": [1, 6],
|
---|
7255 | "Рождество Христово": [1, 7],
|
---|
7256 | "8. Новогодние каникулы": [1, 8],
|
---|
7257 | "День защитника Отечества": [2, 23],
|
---|
7258 | "Международный женский день": [3, 8],
|
---|
7259 | "День Победы": [5, 9],
|
---|
7260 | "Праздник Весны и Труда": [5, 1],
|
---|
7261 | "День народного единства": [11, 4],
|
---|
7262 | "День России": [6, 12],
|
---|
7263 | "День Чувашской республики": [6, 24]
|
---|
7264 | }
|
---|
7265 | },
|
---|
7266 | "Sakha Republic": {
|
---|
7267 | PH: {
|
---|
7268 | "1. Новогодние каникулы": [1, 1],
|
---|
7269 | "2. Новогодние каникулы": [1, 2],
|
---|
7270 | "3. Новогодние каникулы": [1, 3],
|
---|
7271 | "4. Новогодние каникулы": [1, 4],
|
---|
7272 | "5. Новогодние каникулы": [1, 5],
|
---|
7273 | "6. Новогодние каникулы": [1, 6],
|
---|
7274 | "Рождество Христово": [1, 7],
|
---|
7275 | "8. Новогодние каникулы": [1, 8],
|
---|
7276 | "День защитника Отечества": [2, 23],
|
---|
7277 | "Международный женский день": [3, 8],
|
---|
7278 | "День Победы": [5, 9],
|
---|
7279 | "Праздник Весны и Труда": [5, 1],
|
---|
7280 | "День народного единства": [11, 4],
|
---|
7281 | "День России": [6, 12],
|
---|
7282 | "День Республики Саха": [4, 27],
|
---|
7283 | "Ысыах": [6, 23],
|
---|
7284 | "День государственности Республики Саха": [9, 27]
|
---|
7285 | }
|
---|
7286 | },
|
---|
7287 | "Republic of Kalmykia": {
|
---|
7288 | PH: {
|
---|
7289 | "1. Новогодние каникулы": [1, 1],
|
---|
7290 | "2. Новогодние каникулы": [1, 2],
|
---|
7291 | "3. Новогодние каникулы": [1, 3],
|
---|
7292 | "4. Новогодние каникулы": [1, 4],
|
---|
7293 | "5. Новогодние каникулы": [1, 5],
|
---|
7294 | "6. Новогодние каникулы": [1, 6],
|
---|
7295 | "Рождество Христово": [1, 7],
|
---|
7296 | "8. Новогодние каникулы": [1, 8],
|
---|
7297 | "День защитника Отечества": [2, 23],
|
---|
7298 | "Международный женский день": [3, 8],
|
---|
7299 | "День Победы": [5, 9],
|
---|
7300 | "Праздник Весны и Труда": [5, 1],
|
---|
7301 | "День народного единства": [11, 4],
|
---|
7302 | "День России": [6, 12],
|
---|
7303 | "Цаган Сар": [1, 14],
|
---|
7304 | "День принятия Степного Уложения (Конституции) Республики Калмыкия": [4, 5],
|
---|
7305 | "День рождения Будды Шакьямун": [6, 6],
|
---|
7306 | "Зул": [12, 15],
|
---|
7307 | "День памяти жертв депортации калмыцкого народа": [12, 28]
|
---|
7308 | }
|
---|
7309 | },
|
---|
7310 | Buryatia: {
|
---|
7311 | PH: {
|
---|
7312 | "1. Новогодние каникулы": [1, 1],
|
---|
7313 | "2. Новогодние каникулы": [1, 2],
|
---|
7314 | "3. Новогодние каникулы": [1, 3],
|
---|
7315 | "4. Новогодние каникулы": [1, 4],
|
---|
7316 | "5. Новогодние каникулы": [1, 5],
|
---|
7317 | "6. Новогодние каникулы": [1, 6],
|
---|
7318 | "Рождество Христово": [1, 7],
|
---|
7319 | "8. Новогодние каникулы": [1, 8],
|
---|
7320 | "День защитника Отечества": [2, 23],
|
---|
7321 | "Международный женский день": [3, 8],
|
---|
7322 | "День Победы": [5, 9],
|
---|
7323 | "Праздник Весны и Труда": [5, 1],
|
---|
7324 | "День народного единства": [11, 4],
|
---|
7325 | "День России": [6, 12],
|
---|
7326 | "Сагаалган": [1, 14]
|
---|
7327 | }
|
---|
7328 | },
|
---|
7329 | "Republic of Karelia": {
|
---|
7330 | PH: {
|
---|
7331 | "1. Новогодние каникулы": [1, 1],
|
---|
7332 | "2. Новогодние каникулы": [1, 2],
|
---|
7333 | "3. Новогодние каникулы": [1, 3],
|
---|
7334 | "4. Новогодние каникулы": [1, 4],
|
---|
7335 | "5. Новогодние каникулы": [1, 5],
|
---|
7336 | "6. Новогодние каникулы": [1, 6],
|
---|
7337 | "Рождество Христово": [1, 7],
|
---|
7338 | "8. Новогодние каникулы": [1, 8],
|
---|
7339 | "День защитника Отечества": [2, 23],
|
---|
7340 | "Международный женский день": [3, 8],
|
---|
7341 | "День Победы": [5, 9],
|
---|
7342 | "Праздник Весны и Труда": [5, 1],
|
---|
7343 | "День народного единства": [11, 4],
|
---|
7344 | "День России": [6, 12],
|
---|
7345 | "День Республики Карелия": [6, 8],
|
---|
7346 | "День освобождения Карелии от фашистских захватчиков": [9, 30]
|
---|
7347 | }
|
---|
7348 | },
|
---|
7349 | "Удмуртская республика": {
|
---|
7350 | PH: {
|
---|
7351 | "1. Новогодние каникулы": [1, 1],
|
---|
7352 | "2. Новогодние каникулы": [1, 2],
|
---|
7353 | "3. Новогодние каникулы": [1, 3],
|
---|
7354 | "4. Новогодние каникулы": [1, 4],
|
---|
7355 | "5. Новогодние каникулы": [1, 5],
|
---|
7356 | "6. Новогодние каникулы": [1, 6],
|
---|
7357 | "Рождество Христово": [1, 7],
|
---|
7358 | "8. Новогодние каникулы": [1, 8],
|
---|
7359 | "День защитника Отечества": [2, 23],
|
---|
7360 | "Международный женский день": [3, 8],
|
---|
7361 | "День Победы": [5, 9],
|
---|
7362 | "Праздник Весны и Труда": [5, 1],
|
---|
7363 | "День народного единства": [11, 4],
|
---|
7364 | "День России": [6, 12],
|
---|
7365 | "День Государственности Удмуртской Республики": [5, 31]
|
---|
7366 | }
|
---|
7367 | },
|
---|
7368 | Adygea: {
|
---|
7369 | PH: {
|
---|
7370 | "1. Новогодние каникулы": [1, 1],
|
---|
7371 | "2. Новогодние каникулы": [1, 2],
|
---|
7372 | "3. Новогодние каникулы": [1, 3],
|
---|
7373 | "4. Новогодние каникулы": [1, 4],
|
---|
7374 | "5. Новогодние каникулы": [1, 5],
|
---|
7375 | "6. Новогодние каникулы": [1, 6],
|
---|
7376 | "Рождество Христово": [1, 7],
|
---|
7377 | "8. Новогодние каникулы": [1, 8],
|
---|
7378 | "День защитника Отечества": [2, 23],
|
---|
7379 | "Международный женский день": [3, 8],
|
---|
7380 | "День Победы": [5, 9],
|
---|
7381 | "Праздник Весны и Труда": [5, 1],
|
---|
7382 | "День народного единства": [11, 4],
|
---|
7383 | "День России": [6, 12],
|
---|
7384 | "Ураза-байрам": [7, 28],
|
---|
7385 | "Курбан-байрам": [10, 4],
|
---|
7386 | "День образования Республики Адыгея": [10, 5]
|
---|
7387 | }
|
---|
7388 | },
|
---|
7389 | "Republic of Dagestan": {
|
---|
7390 | PH: {
|
---|
7391 | "1. Новогодние каникулы": [1, 1],
|
---|
7392 | "2. Новогодние каникулы": [1, 2],
|
---|
7393 | "3. Новогодние каникулы": [1, 3],
|
---|
7394 | "4. Новогодние каникулы": [1, 4],
|
---|
7395 | "5. Новогодние каникулы": [1, 5],
|
---|
7396 | "6. Новогодние каникулы": [1, 6],
|
---|
7397 | "Рождество Христово": [1, 7],
|
---|
7398 | "8. Новогодние каникулы": [1, 8],
|
---|
7399 | "День защитника Отечества": [2, 23],
|
---|
7400 | "Международный женский день": [3, 8],
|
---|
7401 | "День Победы": [5, 9],
|
---|
7402 | "Праздник Весны и Труда": [5, 1],
|
---|
7403 | "День народного единства": [11, 4],
|
---|
7404 | "День России": [6, 12],
|
---|
7405 | "День Конституции Республики Дагестан": [7, 26],
|
---|
7406 | "Ураза-байрам": [7, 28],
|
---|
7407 | "День единства народов Дагестана": [9, 15],
|
---|
7408 | "Курбан-байрам": [10, 4]
|
---|
7409 | }
|
---|
7410 | },
|
---|
7411 | Ingushetia: {
|
---|
7412 | PH: {
|
---|
7413 | "1. Новогодние каникулы": [1, 1],
|
---|
7414 | "2. Новогодние каникулы": [1, 2],
|
---|
7415 | "3. Новогодние каникулы": [1, 3],
|
---|
7416 | "4. Новогодние каникулы": [1, 4],
|
---|
7417 | "5. Новогодние каникулы": [1, 5],
|
---|
7418 | "6. Новогодние каникулы": [1, 6],
|
---|
7419 | "Рождество Христово": [1, 7],
|
---|
7420 | "8. Новогодние каникулы": [1, 8],
|
---|
7421 | "День защитника Отечества": [2, 23],
|
---|
7422 | "Международный женский день": [3, 8],
|
---|
7423 | "День Победы": [5, 9],
|
---|
7424 | "Праздник Весны и Труда": [5, 1],
|
---|
7425 | "День народного единства": [11, 4],
|
---|
7426 | "День России": [6, 12],
|
---|
7427 | "День образования Республики Ингушетия": [6, 4],
|
---|
7428 | "Ураза-байрам": [7, 28],
|
---|
7429 | "Курбан-байрам": [10, 4]
|
---|
7430 | }
|
---|
7431 | },
|
---|
7432 | "Карачаево-Черкесская республика": {
|
---|
7433 | PH: {
|
---|
7434 | "1. Новогодние каникулы": [1, 1],
|
---|
7435 | "2. Новогодние каникулы": [1, 2],
|
---|
7436 | "3. Новогодние каникулы": [1, 3],
|
---|
7437 | "4. Новогодние каникулы": [1, 4],
|
---|
7438 | "5. Новогодние каникулы": [1, 5],
|
---|
7439 | "6. Новогодние каникулы": [1, 6],
|
---|
7440 | "Рождество Христово": [1, 7],
|
---|
7441 | "8. Новогодние каникулы": [1, 8],
|
---|
7442 | "День защитника Отечества": [2, 23],
|
---|
7443 | "Международный женский день": [3, 8],
|
---|
7444 | "День Победы": [5, 9],
|
---|
7445 | "Праздник Весны и Труда": [5, 1],
|
---|
7446 | "День народного единства": [11, 4],
|
---|
7447 | "День России": [6, 12],
|
---|
7448 | "День возрождения карачаевского народа": [5, 3],
|
---|
7449 | "Ураза-байрам": [7, 28],
|
---|
7450 | "Курбан-байрам": [10, 4]
|
---|
7451 | }
|
---|
7452 | },
|
---|
7453 | "Chechen Republic": {
|
---|
7454 | PH: {
|
---|
7455 | "1. Новогодние каникулы": [1, 1],
|
---|
7456 | "2. Новогодние каникулы": [1, 2],
|
---|
7457 | "3. Новогодние каникулы": [1, 3],
|
---|
7458 | "4. Новогодние каникулы": [1, 4],
|
---|
7459 | "5. Новогодние каникулы": [1, 5],
|
---|
7460 | "6. Новогодние каникулы": [1, 6],
|
---|
7461 | "Рождество Христово": [1, 7],
|
---|
7462 | "8. Новогодние каникулы": [1, 8],
|
---|
7463 | "День защитника Отечества": [2, 23],
|
---|
7464 | "Международный женский день": [3, 8],
|
---|
7465 | "День Победы": [5, 9],
|
---|
7466 | "Праздник Весны и Труда": [5, 1],
|
---|
7467 | "День народного единства": [11, 4],
|
---|
7468 | "День России": [6, 12],
|
---|
7469 | "День мира в Чеченской Республике": [4, 16],
|
---|
7470 | "Ураза-байрам": [7, 28],
|
---|
7471 | "Курбан-байрам": [10, 4]
|
---|
7472 | }
|
---|
7473 | },
|
---|
7474 | "Кабардино-Балкарская республика": {
|
---|
7475 | PH: {
|
---|
7476 | "1. Новогодние каникулы": [1, 1],
|
---|
7477 | "2. Новогодние каникулы": [1, 2],
|
---|
7478 | "3. Новогодние каникулы": [1, 3],
|
---|
7479 | "4. Новогодние каникулы": [1, 4],
|
---|
7480 | "5. Новогодние каникулы": [1, 5],
|
---|
7481 | "6. Новогодние каникулы": [1, 6],
|
---|
7482 | "Рождество Христово": [1, 7],
|
---|
7483 | "8. Новогодние каникулы": [1, 8],
|
---|
7484 | "День защитника Отечества": [2, 23],
|
---|
7485 | "Международный женский день": [3, 8],
|
---|
7486 | "День Победы": [5, 9],
|
---|
7487 | "Праздник Весны и Труда": [5, 1],
|
---|
7488 | "День народного единства": [11, 4],
|
---|
7489 | "День России": [6, 12],
|
---|
7490 | "День возрождения балкарского народа": [3, 28],
|
---|
7491 | "Черкесский день траура": [5, 21],
|
---|
7492 | "Ураза-байрам": [7, 28],
|
---|
7493 | "День государственности Кабардино-Балкарской Республики": [9, 1],
|
---|
7494 | "Курбан-байрам": [10, 4]
|
---|
7495 | }
|
---|
7496 | },
|
---|
7497 | "Altai Republic": {
|
---|
7498 | PH: {
|
---|
7499 | "1. Новогодние каникулы": [1, 1],
|
---|
7500 | "2. Новогодние каникулы": [1, 2],
|
---|
7501 | "3. Новогодние каникулы": [1, 3],
|
---|
7502 | "4. Новогодние каникулы": [1, 4],
|
---|
7503 | "5. Новогодние каникулы": [1, 5],
|
---|
7504 | "6. Новогодние каникулы": [1, 6],
|
---|
7505 | "Рождество Христово": [1, 7],
|
---|
7506 | "8. Новогодние каникулы": [1, 8],
|
---|
7507 | "День защитника Отечества": [2, 23],
|
---|
7508 | "Международный женский день": [3, 8],
|
---|
7509 | "День Победы": [5, 9],
|
---|
7510 | "Праздник Весны и Труда": [5, 1],
|
---|
7511 | "День народного единства": [11, 4],
|
---|
7512 | "День России": [6, 12],
|
---|
7513 | "Чага-Байрам": [1, 14]
|
---|
7514 | }
|
---|
7515 | },
|
---|
7516 | Tuva: {
|
---|
7517 | PH: {
|
---|
7518 | "1. Новогодние каникулы": [1, 1],
|
---|
7519 | "2. Новогодние каникулы": [1, 2],
|
---|
7520 | "3. Новогодние каникулы": [1, 3],
|
---|
7521 | "4. Новогодние каникулы": [1, 4],
|
---|
7522 | "5. Новогодние каникулы": [1, 5],
|
---|
7523 | "6. Новогодние каникулы": [1, 6],
|
---|
7524 | "Рождество Христово": [1, 7],
|
---|
7525 | "8. Новогодние каникулы": [1, 8],
|
---|
7526 | "День защитника Отечества": [2, 23],
|
---|
7527 | "Международный женский день": [3, 8],
|
---|
7528 | "День Победы": [5, 9],
|
---|
7529 | "Праздник Весны и Труда": [5, 1],
|
---|
7530 | "День народного единства": [11, 4],
|
---|
7531 | "День России": [6, 12],
|
---|
7532 | "Народный праздник Шагаа": [1, 14],
|
---|
7533 | "День Республики Тыва": [8, 15]
|
---|
7534 | }
|
---|
7535 | },
|
---|
7536 | "Saratov Oblast": {
|
---|
7537 | PH: {
|
---|
7538 | "1. Новогодние каникулы": [1, 1],
|
---|
7539 | "2. Новогодние каникулы": [1, 2],
|
---|
7540 | "3. Новогодние каникулы": [1, 3],
|
---|
7541 | "4. Новогодние каникулы": [1, 4],
|
---|
7542 | "5. Новогодние каникулы": [1, 5],
|
---|
7543 | "6. Новогодние каникулы": [1, 6],
|
---|
7544 | "Рождество Христово": [1, 7],
|
---|
7545 | "8. Новогодние каникулы": [1, 8],
|
---|
7546 | "День защитника Отечества": [2, 23],
|
---|
7547 | "Международный женский день": [3, 8],
|
---|
7548 | "День Победы": [5, 9],
|
---|
7549 | "Праздник Весны и Труда": [5, 1],
|
---|
7550 | "День народного единства": [11, 4],
|
---|
7551 | "День России": [6, 12],
|
---|
7552 | "Радоница": [4, 29]
|
---|
7553 | }
|
---|
7554 | },
|
---|
7555 | "Bryansk Oblast": {
|
---|
7556 | PH: {
|
---|
7557 | "1. Новогодние каникулы": [1, 1],
|
---|
7558 | "2. Новогодние каникулы": [1, 2],
|
---|
7559 | "3. Новогодние каникулы": [1, 3],
|
---|
7560 | "4. Новогодние каникулы": [1, 4],
|
---|
7561 | "5. Новогодние каникулы": [1, 5],
|
---|
7562 | "6. Новогодние каникулы": [1, 6],
|
---|
7563 | "Рождество Христово": [1, 7],
|
---|
7564 | "8. Новогодние каникулы": [1, 8],
|
---|
7565 | "День защитника Отечества": [2, 23],
|
---|
7566 | "Международный женский день": [3, 8],
|
---|
7567 | "День Победы": [5, 9],
|
---|
7568 | "Праздник Весны и Труда": [5, 1],
|
---|
7569 | "День народного единства": [11, 4],
|
---|
7570 | "День России": [6, 12],
|
---|
7571 | "Радоница": [4, 29],
|
---|
7572 | "День освобождения города Брянска": [9, 17]
|
---|
7573 | }
|
---|
7574 | },
|
---|
7575 | "Komi Republic": {
|
---|
7576 | PH: {
|
---|
7577 | "1. Новогодние каникулы": [1, 1],
|
---|
7578 | "2. Новогодние каникулы": [1, 2],
|
---|
7579 | "3. Новогодние каникулы": [1, 3],
|
---|
7580 | "4. Новогодние каникулы": [1, 4],
|
---|
7581 | "5. Новогодние каникулы": [1, 5],
|
---|
7582 | "6. Новогодние каникулы": [1, 6],
|
---|
7583 | "Рождество Христово": [1, 7],
|
---|
7584 | "8. Новогодние каникулы": [1, 8],
|
---|
7585 | "День защитника Отечества": [2, 23],
|
---|
7586 | "Международный женский день": [3, 8],
|
---|
7587 | "День Победы": [5, 9],
|
---|
7588 | "Праздник Весны и Труда": [5, 1],
|
---|
7589 | "День народного единства": [11, 4],
|
---|
7590 | "День России": [6, 12],
|
---|
7591 | "День Республики Коми": [8, 22]
|
---|
7592 | }
|
---|
7593 | }
|
---|
7594 | },
|
---|
7595 | ua: {
|
---|
7596 | PH: {
|
---|
7597 | "Новий рік": [1, 1],
|
---|
7598 | "Різдво": [1, 7],
|
---|
7599 | "Міжнародний жіночий день": [3, 8],
|
---|
7600 | "Великдень": ["orthodox easter", 1],
|
---|
7601 | "День Праці 1": [5, 1],
|
---|
7602 | "День Праці 2": [5, 2],
|
---|
7603 | "День Перемоги": [5, 9],
|
---|
7604 | "День Конституції України": [6, 28],
|
---|
7605 | "День Незалежності України": [8, 24]
|
---|
7606 | }
|
---|
7607 | },
|
---|
7608 | us: {
|
---|
7609 | PH: {
|
---|
7610 | "New Year's Day": [1, 1],
|
---|
7611 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7612 | "Independence Day": [7, 4],
|
---|
7613 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7614 | "Veterans Day": [11, 11],
|
---|
7615 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7616 | "Christmas Day": [12, 25]
|
---|
7617 | },
|
---|
7618 | Alabama: {
|
---|
7619 | PH: {
|
---|
7620 | "New Year's Day": [1, 1],
|
---|
7621 | "Robert E. Lee/Martin Luther King Birthday": ["firstJanuaryMonday", 14],
|
---|
7622 | "George Washington/Thomas Jefferson Birthday": ["firstFebruaryMonday", 14],
|
---|
7623 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7624 | "Independence Day": [7, 4],
|
---|
7625 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7626 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7627 | "Veterans Day": [11, 11],
|
---|
7628 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7629 | "Christmas Day": [12, 25],
|
---|
7630 | "Confederate Memorial Day": ["firstAprilMonday", 21],
|
---|
7631 | "Jefferson Davis' Birthday": ["firstJuneMonday", 0]
|
---|
7632 | }
|
---|
7633 | },
|
---|
7634 | Alaska: {
|
---|
7635 | PH: {
|
---|
7636 | "New Year's Day": [1, 1],
|
---|
7637 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7638 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7639 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7640 | "Independence Day": [7, 4],
|
---|
7641 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7642 | "Veterans Day": [11, 11],
|
---|
7643 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7644 | "Christmas Day": [12, 25],
|
---|
7645 | "Seward's Day": ["lastMarchMonday", 0],
|
---|
7646 | "Alaska Day": [10, 18]
|
---|
7647 | }
|
---|
7648 | },
|
---|
7649 | Arizona: {
|
---|
7650 | PH: {
|
---|
7651 | "New Year's Day": [1, 1],
|
---|
7652 | "Dr. Martin Luther King Jr./Civil Rights Day": ["firstJanuaryMonday", 14],
|
---|
7653 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7654 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7655 | "Independence Day": [7, 4],
|
---|
7656 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7657 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7658 | "Veterans Day": [11, 11],
|
---|
7659 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7660 | "Christmas Day": [12, 25]
|
---|
7661 | }
|
---|
7662 | },
|
---|
7663 | Arkansas: {
|
---|
7664 | PH: {
|
---|
7665 | "New Year's Day": [1, 1],
|
---|
7666 | "Dr. Martin Luther King Jr. and Robert E. Lee's Birthdays": ["firstJanuaryMonday", 14],
|
---|
7667 | "George Washington's Birthday and Daisy Gatson Bates Day": ["firstFebruaryMonday", 14],
|
---|
7668 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7669 | "Independence Day": [7, 4],
|
---|
7670 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7671 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7672 | "Veterans Day": [11, 11],
|
---|
7673 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7674 | "Christmas Eve": [12, 24],
|
---|
7675 | "Christmas Day": [12, 25]
|
---|
7676 | }
|
---|
7677 | },
|
---|
7678 | California: {
|
---|
7679 | PH: {
|
---|
7680 | "New Year's Day": [1, 1],
|
---|
7681 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7682 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7683 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7684 | "Independence Day": [7, 4],
|
---|
7685 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7686 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7687 | "Veterans Day": [11, 11],
|
---|
7688 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7689 | "Christmas Day": [12, 25],
|
---|
7690 | "César Chávez Day": [3, 31]
|
---|
7691 | }
|
---|
7692 | },
|
---|
7693 | Colorado: {
|
---|
7694 | PH: {
|
---|
7695 | "New Year's Day": [1, 1],
|
---|
7696 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7697 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7698 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7699 | "Independence Day": [7, 4],
|
---|
7700 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7701 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7702 | "Veterans Day": [11, 11],
|
---|
7703 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7704 | "Christmas Day": [12, 25]
|
---|
7705 | }
|
---|
7706 | },
|
---|
7707 | Connecticut: {
|
---|
7708 | PH: {
|
---|
7709 | "New Year's Day": [1, 1],
|
---|
7710 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7711 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7712 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7713 | "Independence Day": [7, 4],
|
---|
7714 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7715 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7716 | "Veterans Day": [11, 11],
|
---|
7717 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7718 | "Christmas Day": [12, 25],
|
---|
7719 | "Lincoln's Birthday": [2, 12],
|
---|
7720 | "Good Friday": ["easter", -2]
|
---|
7721 | }
|
---|
7722 | },
|
---|
7723 | Delaware: {
|
---|
7724 | PH: {
|
---|
7725 | "New Year's Day": [1, 1],
|
---|
7726 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7727 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7728 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7729 | "Independence Day": [7, 4],
|
---|
7730 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7731 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7732 | "Veterans Day": [11, 11],
|
---|
7733 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7734 | "Day After Thanksgiving": ["firstNovemberThursday", 22],
|
---|
7735 | "Christmas Day": [12, 25],
|
---|
7736 | "Good Friday": ["easter", -2]
|
---|
7737 | }
|
---|
7738 | },
|
---|
7739 | "District of Columbia": {
|
---|
7740 | PH: {
|
---|
7741 | "New Year's Day": [1, 1],
|
---|
7742 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7743 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7744 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7745 | "Independence Day": [7, 4],
|
---|
7746 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7747 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7748 | "Veterans Day": [11, 11],
|
---|
7749 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7750 | "Christmas Day": [12, 25],
|
---|
7751 | "Emancipation Day": [4, 16]
|
---|
7752 | }
|
---|
7753 | },
|
---|
7754 | Florida: {
|
---|
7755 | PH: {
|
---|
7756 | "New Year's Day": [1, 1],
|
---|
7757 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7758 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7759 | "Independence Day": [7, 4],
|
---|
7760 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7761 | "Veterans Day": [11, 11],
|
---|
7762 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7763 | "Friday after Thanksgiving": ["firstNovemberThursday", 22],
|
---|
7764 | "Christmas Day": [12, 25]
|
---|
7765 | }
|
---|
7766 | },
|
---|
7767 | Georgia: {
|
---|
7768 | PH: {
|
---|
7769 | "New Year's Day": [1, 1],
|
---|
7770 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7771 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7772 | "Independence Day": [7, 4],
|
---|
7773 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7774 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7775 | "Veterans Day": [11, 11],
|
---|
7776 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7777 | "Robert E. Lee's Birthday": ["firstNovemberThursday", 22],
|
---|
7778 | "Washington's Birthday": [12, 24],
|
---|
7779 | "Christmas Day": [12, 25],
|
---|
7780 | "Confederate Memorial Day": ["lastAprilMonday", 0]
|
---|
7781 | }
|
---|
7782 | },
|
---|
7783 | Guam: {
|
---|
7784 | PH: {
|
---|
7785 | "New Year's Day": [1, 1],
|
---|
7786 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7787 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7788 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7789 | "Independence Day": [7, 4],
|
---|
7790 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7791 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7792 | "Veterans Day": [11, 11],
|
---|
7793 | "Guam Discovery Day": [3, 5],
|
---|
7794 | "Good Friday": ["easter", -2],
|
---|
7795 | "Liberation Day": [7, 21],
|
---|
7796 | "All Souls' Day": [11, 2],
|
---|
7797 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7798 | "Lady of Camarin Day": [12, 8],
|
---|
7799 | "Christmas Day": [12, 25]
|
---|
7800 | }
|
---|
7801 | },
|
---|
7802 | Hawaii: {
|
---|
7803 | PH: {
|
---|
7804 | "New Year's Day": [1, 1],
|
---|
7805 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7806 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7807 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7808 | "Independence Day": [7, 4],
|
---|
7809 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7810 | "Veterans Day": [11, 11],
|
---|
7811 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7812 | "Christmas Day": [12, 25],
|
---|
7813 | "Prince Jonah Kuhio Kalanianaole Day": [3, 26],
|
---|
7814 | "Kamehameha Day": [6, 11],
|
---|
7815 | "Statehood Day": ["firstAugustFriday", 14],
|
---|
7816 | "Election Day": ["firstNovemberMonday", 1]
|
---|
7817 | }
|
---|
7818 | },
|
---|
7819 | Idaho: {
|
---|
7820 | PH: {
|
---|
7821 | "New Year's Day": [1, 1],
|
---|
7822 | "Martin Luther King, Jr.-Idaho Human Rights Day": ["firstJanuaryMonday", 14],
|
---|
7823 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7824 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7825 | "Independence Day": [7, 4],
|
---|
7826 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7827 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7828 | "Veterans Day": [11, 11],
|
---|
7829 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7830 | "Christmas Day": [12, 25]
|
---|
7831 | }
|
---|
7832 | },
|
---|
7833 | Illinois: {
|
---|
7834 | PH: {
|
---|
7835 | "New Year's Day": [1, 1],
|
---|
7836 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7837 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7838 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7839 | "Independence Day": [7, 4],
|
---|
7840 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7841 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7842 | "Veterans Day": [11, 11],
|
---|
7843 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7844 | "Christmas Day": [12, 25],
|
---|
7845 | "Lincoln's Birthday": [2, 12],
|
---|
7846 | "Casimir Pulaski Day": ["firstMarchMonday", 0],
|
---|
7847 | "Election Day": ["firstNovemberMonday", 1]
|
---|
7848 | }
|
---|
7849 | },
|
---|
7850 | Indiana: {
|
---|
7851 | PH: {
|
---|
7852 | "New Year's Day": [1, 1],
|
---|
7853 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7854 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7855 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7856 | "Independence Day": [7, 4],
|
---|
7857 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7858 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7859 | "Veterans Day": [11, 11],
|
---|
7860 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7861 | "Lincoln's Birthday": ["firstNovemberThursday", 22],
|
---|
7862 | "Christmas Day": [12, 25],
|
---|
7863 | "Good Friday": ["easter", -2],
|
---|
7864 | "Primary Election Day": ["firstMayMonday", 1],
|
---|
7865 | "Election Day": ["firstNovemberMonday", 1]
|
---|
7866 | }
|
---|
7867 | },
|
---|
7868 | Iowa: {
|
---|
7869 | PH: {
|
---|
7870 | "New Year's Day": [1, 1],
|
---|
7871 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7872 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7873 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7874 | "Independence Day": [7, 4],
|
---|
7875 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7876 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7877 | "Veterans Day": [11, 11],
|
---|
7878 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7879 | "Christmas Day": [12, 25],
|
---|
7880 | "Lincoln's Birthday": [2, 12]
|
---|
7881 | }
|
---|
7882 | },
|
---|
7883 | Kansas: {
|
---|
7884 | PH: {
|
---|
7885 | "New Year's Day": [1, 1],
|
---|
7886 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7887 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7888 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7889 | "Independence Day": [7, 4],
|
---|
7890 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7891 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7892 | "Veterans Day": [11, 11],
|
---|
7893 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7894 | "Christmas Day": [12, 25]
|
---|
7895 | }
|
---|
7896 | },
|
---|
7897 | Kentucky: {
|
---|
7898 | PH: {
|
---|
7899 | "New Year's Day": [1, 1],
|
---|
7900 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7901 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7902 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7903 | "Independence Day": [7, 4],
|
---|
7904 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7905 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7906 | "Veterans Day": [11, 11],
|
---|
7907 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7908 | "Christmas Eve": [12, 24],
|
---|
7909 | "Christmas Day": [12, 25],
|
---|
7910 | "New Year's Eve": [12, 31],
|
---|
7911 | "Good Friday": ["easter", -2]
|
---|
7912 | }
|
---|
7913 | },
|
---|
7914 | Louisiana: {
|
---|
7915 | PH: {
|
---|
7916 | "New Year's Day": [1, 1],
|
---|
7917 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7918 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7919 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7920 | "Independence Day": [7, 4],
|
---|
7921 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7922 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7923 | "Veterans Day": [11, 11],
|
---|
7924 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7925 | "Christmas Day": [12, 25],
|
---|
7926 | "Mardi Gras": ["easter", -47],
|
---|
7927 | "Good Friday": ["easter", -2],
|
---|
7928 | "Election Day": ["firstNovemberMonday", 1]
|
---|
7929 | }
|
---|
7930 | },
|
---|
7931 | Maine: {
|
---|
7932 | PH: {
|
---|
7933 | "New Year's Day": [1, 1],
|
---|
7934 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7935 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7936 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7937 | "Independence Day": [7, 4],
|
---|
7938 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7939 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7940 | "Veterans Day": [11, 11],
|
---|
7941 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7942 | "Christmas Day": [12, 25],
|
---|
7943 | "Patriots' Day": ["firstAprilMonday", 14]
|
---|
7944 | }
|
---|
7945 | },
|
---|
7946 | Maryland: {
|
---|
7947 | PH: {
|
---|
7948 | "New Year's Day": [1, 1],
|
---|
7949 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7950 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7951 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7952 | "Independence Day": [7, 4],
|
---|
7953 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7954 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7955 | "Veterans Day": [11, 11],
|
---|
7956 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7957 | "Native American Heritage Day": ["firstNovemberThursday", 22],
|
---|
7958 | "Christmas Day": [12, 25]
|
---|
7959 | }
|
---|
7960 | },
|
---|
7961 | Massachusetts: {
|
---|
7962 | PH: {
|
---|
7963 | "New Year's Day": [1, 1],
|
---|
7964 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7965 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7966 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7967 | "Independence Day": [7, 4],
|
---|
7968 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7969 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7970 | "Veterans Day": [11, 11],
|
---|
7971 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7972 | "Christmas Day": [12, 25],
|
---|
7973 | "Patriots' Day": ["firstAprilMonday", 14]
|
---|
7974 | }
|
---|
7975 | },
|
---|
7976 | Michigan: {
|
---|
7977 | PH: {
|
---|
7978 | "New Year's Day": [1, 1],
|
---|
7979 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7980 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7981 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7982 | "Independence Day": [7, 4],
|
---|
7983 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
7984 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
7985 | "Veterans Day": [11, 11],
|
---|
7986 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
7987 | "Christmas Eve": [12, 24],
|
---|
7988 | "Christmas Day": [12, 25],
|
---|
7989 | "New Year's Eve": [12, 31]
|
---|
7990 | }
|
---|
7991 | },
|
---|
7992 | Minnesota: {
|
---|
7993 | PH: {
|
---|
7994 | "New Year's Day": [1, 1],
|
---|
7995 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
7996 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
7997 | "Memorial Day": ["lastMayMonday", 0],
|
---|
7998 | "Independence Day": [7, 4],
|
---|
7999 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8000 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8001 | "Veterans Day": [11, 11],
|
---|
8002 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8003 | "Christmas Day": [12, 25]
|
---|
8004 | }
|
---|
8005 | },
|
---|
8006 | Mississippi: {
|
---|
8007 | PH: {
|
---|
8008 | "New Year's Day": [1, 1],
|
---|
8009 | "Martin Luther King's and Robert E. Lee's Birthdays": ["firstJanuaryMonday", 14],
|
---|
8010 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8011 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8012 | "Independence Day": [7, 4],
|
---|
8013 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8014 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8015 | "Veterans Day": [11, 11],
|
---|
8016 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8017 | "Christmas Day": [12, 25],
|
---|
8018 | "Confederate Memorial Day": ["lastAprilMonday", 0]
|
---|
8019 | }
|
---|
8020 | },
|
---|
8021 | Missouri: {
|
---|
8022 | PH: {
|
---|
8023 | "New Year's Day": [1, 1],
|
---|
8024 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8025 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8026 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8027 | "Independence Day": [7, 4],
|
---|
8028 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8029 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8030 | "Veterans Day": [11, 11],
|
---|
8031 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8032 | "Christmas Day": [12, 25],
|
---|
8033 | "Truman Day": [5, 8]
|
---|
8034 | }
|
---|
8035 | },
|
---|
8036 | Montana: {
|
---|
8037 | PH: {
|
---|
8038 | "New Year's Day": [1, 1],
|
---|
8039 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8040 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8041 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8042 | "Independence Day": [7, 4],
|
---|
8043 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8044 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8045 | "Veterans Day": [11, 11],
|
---|
8046 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8047 | "Christmas Day": [12, 25],
|
---|
8048 | "Election Day": ["firstNovemberMonday", 1],
|
---|
8049 | "Christmas Eve": [12, 24],
|
---|
8050 | "New Year's Eve": [12, 31]
|
---|
8051 | }
|
---|
8052 | },
|
---|
8053 | Nebraska: {
|
---|
8054 | PH: {
|
---|
8055 | "New Year's Day": [1, 1],
|
---|
8056 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8057 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8058 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8059 | "Independence Day": [7, 4],
|
---|
8060 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8061 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8062 | "Veterans Day": [11, 11],
|
---|
8063 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8064 | "Christmas Day": [12, 25],
|
---|
8065 | "Arbor Day": ["lastAprilFriday", 0]
|
---|
8066 | }
|
---|
8067 | },
|
---|
8068 | Nevada: {
|
---|
8069 | PH: {
|
---|
8070 | "New Year's Day": [1, 1],
|
---|
8071 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8072 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8073 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8074 | "Independence Day": [7, 4],
|
---|
8075 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8076 | "Veterans Day": [11, 11],
|
---|
8077 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8078 | "Christmas Day": [12, 25],
|
---|
8079 | "Nevada Day": ["lastOctoberFriday", 0],
|
---|
8080 | "Family Day": ["firstNovemberThursday", 22]
|
---|
8081 | }
|
---|
8082 | },
|
---|
8083 | "New Hampshire": {
|
---|
8084 | PH: {
|
---|
8085 | "New Year's Day": [1, 1],
|
---|
8086 | "Martin Luther King, Jr. Civil Rights Day": ["firstJanuaryMonday", 14],
|
---|
8087 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8088 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8089 | "Independence Day": [7, 4],
|
---|
8090 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8091 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8092 | "Veterans Day": [11, 11],
|
---|
8093 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8094 | "Day after Thanksgiving": ["firstNovemberThursday", 22],
|
---|
8095 | "Christmas Day": [12, 25],
|
---|
8096 | "Election Day": ["firstNovemberMonday", 1]
|
---|
8097 | }
|
---|
8098 | },
|
---|
8099 | "New Jersey": {
|
---|
8100 | PH: {
|
---|
8101 | "New Year's Day": [1, 1],
|
---|
8102 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8103 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8104 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8105 | "Independence Day": [7, 4],
|
---|
8106 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8107 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8108 | "Veterans Day": [11, 11],
|
---|
8109 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8110 | "Christmas Day": [12, 25],
|
---|
8111 | "Lincoln's Birthday": [2, 12],
|
---|
8112 | "Good Friday": ["easter", -2],
|
---|
8113 | "Election Day": ["firstNovemberMonday", 1]
|
---|
8114 | }
|
---|
8115 | },
|
---|
8116 | "New Mexico": {
|
---|
8117 | PH: {
|
---|
8118 | "New Year's Day": [1, 1],
|
---|
8119 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8120 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8121 | "Independence Day": [7, 4],
|
---|
8122 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8123 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8124 | "Veterans Day": [11, 11],
|
---|
8125 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8126 | "Day after Thanksgiving": ["firstNovemberThursday", 22],
|
---|
8127 | "Christmas Day": [12, 25]
|
---|
8128 | }
|
---|
8129 | },
|
---|
8130 | "New York": {
|
---|
8131 | PH: {
|
---|
8132 | "New Year's Day": [1, 1],
|
---|
8133 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8134 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8135 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8136 | "Independence Day": [7, 4],
|
---|
8137 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8138 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8139 | "Veterans Day": [11, 11],
|
---|
8140 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8141 | "Christmas Day": [12, 25],
|
---|
8142 | "Lincoln's Birthday": [2, 12],
|
---|
8143 | "Election Day": ["firstNovemberMonday", 1]
|
---|
8144 | }
|
---|
8145 | },
|
---|
8146 | "North Carolina": {
|
---|
8147 | PH: {
|
---|
8148 | "New Year's Day": [1, 1],
|
---|
8149 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8150 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8151 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8152 | "Independence Day": [7, 4],
|
---|
8153 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8154 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8155 | "Veterans Day": [11, 11],
|
---|
8156 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8157 | "Day after Thanksgiving": ["firstNovemberThursday", 22],
|
---|
8158 | "Christmas Eve": [12, 24],
|
---|
8159 | "Christmas Day": [12, 25],
|
---|
8160 | "Day after Christmas": [12, 26],
|
---|
8161 | "Good Friday": ["easter", -2]
|
---|
8162 | }
|
---|
8163 | },
|
---|
8164 | "North Dakota": {
|
---|
8165 | PH: {
|
---|
8166 | "New Year's Day": [1, 1],
|
---|
8167 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8168 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8169 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8170 | "Independence Day": [7, 4],
|
---|
8171 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8172 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8173 | "Veterans Day": [11, 11],
|
---|
8174 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8175 | "Christmas Day": [12, 25]
|
---|
8176 | }
|
---|
8177 | },
|
---|
8178 | Ohio: {
|
---|
8179 | PH: {
|
---|
8180 | "New Year's Day": [1, 1],
|
---|
8181 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8182 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8183 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8184 | "Independence Day": [7, 4],
|
---|
8185 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8186 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8187 | "Veterans Day": [11, 11],
|
---|
8188 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8189 | "Christmas Day": [12, 25]
|
---|
8190 | }
|
---|
8191 | },
|
---|
8192 | Oklahoma: {
|
---|
8193 | PH: {
|
---|
8194 | "New Year's Day": [1, 1],
|
---|
8195 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8196 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8197 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8198 | "Independence Day": [7, 4],
|
---|
8199 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8200 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8201 | "Veterans Day": [11, 11],
|
---|
8202 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8203 | "Day after Thanksgiving": ["firstNovemberThursday", 22],
|
---|
8204 | "Christmas Day": [12, 25]
|
---|
8205 | }
|
---|
8206 | },
|
---|
8207 | Oregon: {
|
---|
8208 | PH: {
|
---|
8209 | "New Year's Day": [1, 1],
|
---|
8210 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8211 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8212 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8213 | "Independence Day": [7, 4],
|
---|
8214 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8215 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8216 | "Veterans Day": [11, 11],
|
---|
8217 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8218 | "Christmas Day": [12, 25]
|
---|
8219 | }
|
---|
8220 | },
|
---|
8221 | Pennsylvania: {
|
---|
8222 | PH: {
|
---|
8223 | "New Year's Day": [1, 1],
|
---|
8224 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8225 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8226 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8227 | "Independence Day": [7, 4],
|
---|
8228 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8229 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8230 | "Veterans Day": [11, 11],
|
---|
8231 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8232 | "Christmas Day": [12, 25],
|
---|
8233 | "Flag Day": [6, 14]
|
---|
8234 | }
|
---|
8235 | },
|
---|
8236 | "Puerto Rico": {
|
---|
8237 | PH: {
|
---|
8238 | "Día de Año Nuevo": [1, 1],
|
---|
8239 | "Día de Reyes": [1, 6],
|
---|
8240 | "Natalicio de Eugenio María de Hostos": ["firstJanuaryMonday", 7],
|
---|
8241 | "Natalicio de Martin Luther King, Jr.": ["firstJanuaryMonday", 14],
|
---|
8242 | "Día de los Presidentes": ["firstFebruaryMonday", 14],
|
---|
8243 | "Día de la Abolición de Esclavitud": [3, 22],
|
---|
8244 | "Viernes Santo": ["easter", -2],
|
---|
8245 | "Natalicio de José de Diego": ["firstAprilMonday", 14],
|
---|
8246 | "Recordación de los Muertos de la Guerra": ["lastMayMonday", 0],
|
---|
8247 | "Día de la Independencia": [7, 4],
|
---|
8248 | "Constitución de Puerto Rico": [7, 25],
|
---|
8249 | "Natalicio de Dr. José Celso Barbosa": [7, 27],
|
---|
8250 | "Día del Trabajo": ["firstSeptemberMonday", 0],
|
---|
8251 | "Día de la Raza Descubrimiento de América": ["firstOctoberMonday", 7],
|
---|
8252 | "Día del Veterano": [11, 11],
|
---|
8253 | "Día del Descubrimiento de Puerto Rico": [11, 19],
|
---|
8254 | "Día de Acción de Gracias": ["firstNovemberThursday", 21],
|
---|
8255 | "Noche Buena": [12, 24],
|
---|
8256 | "Día de Navidad": [12, 25]
|
---|
8257 | }
|
---|
8258 | },
|
---|
8259 | "Rhode Island": {
|
---|
8260 | PH: {
|
---|
8261 | "New Year's Day": [1, 1],
|
---|
8262 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8263 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8264 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8265 | "Independence Day": [7, 4],
|
---|
8266 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8267 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8268 | "Veterans Day": [11, 11],
|
---|
8269 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8270 | "Christmas Day": [12, 25],
|
---|
8271 | "Victory Day": ["firstAugustMonday", 7]
|
---|
8272 | }
|
---|
8273 | },
|
---|
8274 | "South Carolina": {
|
---|
8275 | PH: {
|
---|
8276 | "New Year's Day": [1, 1],
|
---|
8277 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8278 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8279 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8280 | "Independence Day": [7, 4],
|
---|
8281 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8282 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8283 | "Veterans Day": [11, 11],
|
---|
8284 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8285 | "Christmas Day": [12, 25],
|
---|
8286 | "Confederate Memorial Day": [5, 10]
|
---|
8287 | }
|
---|
8288 | },
|
---|
8289 | "South Dakota": {
|
---|
8290 | PH: {
|
---|
8291 | "New Year's Day": [1, 1],
|
---|
8292 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8293 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8294 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8295 | "Independence Day": [7, 4],
|
---|
8296 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8297 | "Native American Day": ["firstOctoberMonday", 7],
|
---|
8298 | "Veterans Day": [11, 11],
|
---|
8299 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8300 | "Christmas Day": [12, 25]
|
---|
8301 | }
|
---|
8302 | },
|
---|
8303 | Tennessee: {
|
---|
8304 | PH: {
|
---|
8305 | "New Year's Day": [1, 1],
|
---|
8306 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8307 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8308 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8309 | "Independence Day": [7, 4],
|
---|
8310 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8311 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8312 | "Veterans Day": [11, 11],
|
---|
8313 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8314 | "Christmas Eve": [12, 24],
|
---|
8315 | "Christmas Day": [12, 25],
|
---|
8316 | "Good Friday": ["easter", -2]
|
---|
8317 | }
|
---|
8318 | },
|
---|
8319 | Texas: {
|
---|
8320 | PH: {
|
---|
8321 | "New Year's Day": [1, 1],
|
---|
8322 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8323 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8324 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8325 | "Independence Day": [7, 4],
|
---|
8326 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8327 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8328 | "Veterans Day": [11, 11],
|
---|
8329 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8330 | "Friday after Thanksgiving": ["firstNovemberThursday", 22],
|
---|
8331 | "Christmas Eve": [12, 24],
|
---|
8332 | "Christmas Day": [12, 25],
|
---|
8333 | "Day after Christmas": [12, 26]
|
---|
8334 | }
|
---|
8335 | },
|
---|
8336 | "United States Virgin Islands": {
|
---|
8337 | PH: {
|
---|
8338 | "New Year's Day": [1, 1],
|
---|
8339 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8340 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8341 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8342 | "Independence Day": [7, 4],
|
---|
8343 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8344 | "Virgin Islands-Puerto Rico Friendship Day": ["firstOctoberMonday", 7],
|
---|
8345 | "Veterans Day": [11, 11],
|
---|
8346 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8347 | "Christmas Day": [12, 25],
|
---|
8348 | "Three Kings Day": [1, 6],
|
---|
8349 | "Transfer Day": [3, 31],
|
---|
8350 | "Holy Thursday": ["easter", -3],
|
---|
8351 | "Good Friday": ["easter", -2],
|
---|
8352 | "Easter Monday": ["easter", 1],
|
---|
8353 | "Emancipation Day": [7, 3],
|
---|
8354 | "Hurricane Supplication Day": ["firstJulyMonday", 21],
|
---|
8355 | "Hurricane Thanksgiving": [10, 25],
|
---|
8356 | "Liberty Day": [11, 1],
|
---|
8357 | "Christmas Second Day": [12, 26],
|
---|
8358 | "New Year's Eve": [12, 31]
|
---|
8359 | }
|
---|
8360 | },
|
---|
8361 | Utah: {
|
---|
8362 | PH: {
|
---|
8363 | "New Year's Day": [1, 1],
|
---|
8364 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8365 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8366 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8367 | "Independence Day": [7, 4],
|
---|
8368 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8369 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8370 | "Veterans Day": [11, 11],
|
---|
8371 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8372 | "Christmas Day": [12, 25],
|
---|
8373 | "Pioneer Day": [7, 24]
|
---|
8374 | }
|
---|
8375 | },
|
---|
8376 | Vermont: {
|
---|
8377 | PH: {
|
---|
8378 | "New Year's Day": [1, 1],
|
---|
8379 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8380 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8381 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8382 | "Independence Day": [7, 4],
|
---|
8383 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8384 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8385 | "Veterans Day": [11, 11],
|
---|
8386 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8387 | "Christmas Day": [12, 25],
|
---|
8388 | "Town Meeting Day": ["firstMarchTuesday", 0],
|
---|
8389 | "Battle of Bennington": ["firstAugustMonday", 14]
|
---|
8390 | }
|
---|
8391 | },
|
---|
8392 | Virginia: {
|
---|
8393 | PH: {
|
---|
8394 | "New Year's Day": [1, 1],
|
---|
8395 | "Lee-Jackson Day": ["firstJanuaryMonday", 11],
|
---|
8396 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8397 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8398 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8399 | "Independence Day": [7, 4],
|
---|
8400 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8401 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8402 | "Veterans Day": [11, 11],
|
---|
8403 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8404 | "Christmas Day": [12, 25]
|
---|
8405 | }
|
---|
8406 | },
|
---|
8407 | Washington: {
|
---|
8408 | PH: {
|
---|
8409 | "New Year's Day": [1, 1],
|
---|
8410 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8411 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8412 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8413 | "Independence Day": [7, 4],
|
---|
8414 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8415 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8416 | "Veterans Day": [11, 11],
|
---|
8417 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8418 | "Christmas Day": [12, 25]
|
---|
8419 | }
|
---|
8420 | },
|
---|
8421 | "West Virginia": {
|
---|
8422 | PH: {
|
---|
8423 | "New Year's Day": [1, 1],
|
---|
8424 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8425 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8426 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8427 | "Independence Day": [7, 4],
|
---|
8428 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8429 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8430 | "Veterans Day": [11, 11],
|
---|
8431 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8432 | "Christmas Day": [12, 25],
|
---|
8433 | "West Virginia Day": [6, 20],
|
---|
8434 | "Lincoln's Day": ["firstNovemberThursday", 22]
|
---|
8435 | }
|
---|
8436 | },
|
---|
8437 | Wisconsin: {
|
---|
8438 | PH: {
|
---|
8439 | "New Year's Day": [1, 1],
|
---|
8440 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8441 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8442 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8443 | "Independence Day": [7, 4],
|
---|
8444 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8445 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8446 | "Veterans Day": [11, 11],
|
---|
8447 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8448 | "Christmas Day": [12, 25],
|
---|
8449 | "Primary Election Day": ["firstAugustTuesday", 7],
|
---|
8450 | "Election Day": ["firstNovemberMonday", 1]
|
---|
8451 | }
|
---|
8452 | },
|
---|
8453 | Wyoming: {
|
---|
8454 | PH: {
|
---|
8455 | "New Year's Day": [1, 1],
|
---|
8456 | "Martin Luther King, Jr. Day": ["firstJanuaryMonday", 14],
|
---|
8457 | "Washington's Birthday": ["firstFebruaryMonday", 14],
|
---|
8458 | "Memorial Day": ["lastMayMonday", 0],
|
---|
8459 | "Independence Day": [7, 4],
|
---|
8460 | "Labor Day": ["firstSeptemberMonday", 0],
|
---|
8461 | "Columbus Day": ["firstOctoberMonday", 7],
|
---|
8462 | "Veterans Day": [11, 11],
|
---|
8463 | Thanksgiving: ["firstNovemberThursday", 21],
|
---|
8464 | "Christmas Day": [12, 25]
|
---|
8465 | }
|
---|
8466 | }
|
---|
8467 | },
|
---|
8468 | si: {
|
---|
8469 | PH: {
|
---|
8470 | "novo leto": [1, 1],
|
---|
8471 | "Prešernov dan, slovenski kulturni praznik": [2, 8],
|
---|
8472 | "velikonočna nedelja": ["easter", 0],
|
---|
8473 | "velikonočni ponedeljek": ["easter", 1],
|
---|
8474 | "dan upora proti okupatorju": [4, 27],
|
---|
8475 | "praznik dela 1": [5, 1],
|
---|
8476 | "praznik dela 2": [5, 2],
|
---|
8477 | "binkoštna nedelja - binkošti": ["easter", 49],
|
---|
8478 | "dan državnosti": [6, 25],
|
---|
8479 | "Marijino vnebovzetje": [8, 15],
|
---|
8480 | "dan reformacije": [10, 31],
|
---|
8481 | "dan spomina na mrtve": [11, 1],
|
---|
8482 | "božič": [12, 25],
|
---|
8483 | "dan samostojnosti in enotnosti": [12, 26]
|
---|
8484 | }
|
---|
8485 | },
|
---|
8486 | it: {
|
---|
8487 | PH: {
|
---|
8488 | Capodanno: [1, 1],
|
---|
8489 | Epifania: [1, 6],
|
---|
8490 | "Liberazione dal nazifascismo (1945)": [4, 25],
|
---|
8491 | Pasqua: ["easter", 0],
|
---|
8492 | "Lunedì di Pasqua": ["easter", 1],
|
---|
8493 | "Festa del lavoro": [5, 1],
|
---|
8494 | "Festa della Repubblica": [6, 2],
|
---|
8495 | "Assunzione di Maria": [8, 15],
|
---|
8496 | Ognissanti: [11, 1],
|
---|
8497 | "Festa dell’unità nazionale": ["firstSeptemberSunday", 0],
|
---|
8498 | "Immacolata Concezione": [12, 8],
|
---|
8499 | "Natale di Gesù": [12, 25],
|
---|
8500 | "Santo Stefano": [12, 26]
|
---|
8501 | }
|
---|
8502 | },
|
---|
8503 | cz: {
|
---|
8504 | PH: {
|
---|
8505 | "Den obnovy samostatného českého státu": [1, 1],
|
---|
8506 | "Velký pátek": ["easter", -2],
|
---|
8507 | "Velikonoční pondělí": ["easter", 1],
|
---|
8508 | "Svátek práce": [5, 1],
|
---|
8509 | "Den vítězství": [5, 8],
|
---|
8510 | "Den slovanských věrozvěstů Cyrila a Metoděje": [7, 5],
|
---|
8511 | "Den upálení mistra Jana Husa": [7, 6],
|
---|
8512 | "Den české státnosti": [9, 28],
|
---|
8513 | "Den vzniku samostatného československého státu": [10, 28],
|
---|
8514 | "Den boje za svobodu a demokracii": [11, 17],
|
---|
8515 | "Štědrý den": [12, 24],
|
---|
8516 | "1. svátek vánoční": [12, 25],
|
---|
8517 | "2. svátek vánoční": [12, 26]
|
---|
8518 | }
|
---|
8519 | },
|
---|
8520 | ro: {
|
---|
8521 | PH: {
|
---|
8522 | "Anul Nou": [1, 1],
|
---|
8523 | "A doua zi de Anul Nou": [1, 2],
|
---|
8524 | "Ziua Unirii Principatelor Române (Ziua Unirii)": [1, 24],
|
---|
8525 | "Paștele ortodox": ["orthodox easter", 0],
|
---|
8526 | "A doua zi de Paște ortodox": ["orthodox easter", 1],
|
---|
8527 | "Ziua Muncii": [5, 1],
|
---|
8528 | Rusaliile: ["orthodox easter", 50],
|
---|
8529 | "A doua zi de Rusalii": ["orthodox easter", 51],
|
---|
8530 | "Adormirea Maicii Domnului": [8, 15],
|
---|
8531 | "Sfântul Apostol Andrei": [11, 30],
|
---|
8532 | "Ziua Națională (Ziua Marii Uniri)": [12, 1],
|
---|
8533 | "Crăciunul": [12, 25],
|
---|
8534 | "A doua zi de Crăciun": [12, 26]
|
---|
8535 | },
|
---|
8536 | SH: [{
|
---|
8537 | name: "Vacanţa intersemestrială",
|
---|
8538 | 2018: [1, 31, 2, 8],
|
---|
8539 | 2019: [1, 30, 2, 7]
|
---|
8540 | }, {
|
---|
8541 | name: "Vacanța de primăvară",
|
---|
8542 | 2018: [4, 11, 4, 19],
|
---|
8543 | 2019: [4, 23, 5, 3]
|
---|
8544 | }, {
|
---|
8545 | name: "Vacanța de vară",
|
---|
8546 | 2018: [6, 20, 9, 13],
|
---|
8547 | 2019: [6, 18, 9, 4]
|
---|
8548 | }, {
|
---|
8549 | name: "Vacanța de iarnă",
|
---|
8550 | 2014: [12, 20, 1, 4],
|
---|
8551 | 2018: [12, 19, 1, 3]
|
---|
8552 | }]
|
---|
8553 | },
|
---|
8554 | se: {
|
---|
8555 | PH: {
|
---|
8556 | "nyårsdagen": [1, 1],
|
---|
8557 | "trettondedag jul": [1, 6],
|
---|
8558 | "långfredagen": ["easter", -2],
|
---|
8559 | "påskdagen": ["easter", 0],
|
---|
8560 | "annandag påsk": ["easter", 1],
|
---|
8561 | "första maj": [5, 1],
|
---|
8562 | pingstdagen: ["easter", 49],
|
---|
8563 | nationaldagen: [6, 6],
|
---|
8564 | midsommardagen: ["nextSaturday20Jun", 0],
|
---|
8565 | "alla helgons dag": ["nextSaturday31Oct", 0],
|
---|
8566 | juldagen: [12, 25],
|
---|
8567 | "annandag jul": [12, 26]
|
---|
8568 | }
|
---|
8569 | },
|
---|
8570 | br: {
|
---|
8571 | PH: {
|
---|
8572 | "Ano Novo": [1, 1],
|
---|
8573 | Carnaval: ["easter", -47],
|
---|
8574 | "Sexta-feira santa": ["easter", -2],
|
---|
8575 | Tiradentes: [4, 21],
|
---|
8576 | "Dia do Trabalhador": [5, 1],
|
---|
8577 | "Corpus Christi": ["easter", 60],
|
---|
8578 | "Independência": [9, 7],
|
---|
8579 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8580 | Finados: [11, 2],
|
---|
8581 | "Proclamação da República": [11, 15],
|
---|
8582 | Natal: [12, 25]
|
---|
8583 | },
|
---|
8584 | Acre: {
|
---|
8585 | PH: {
|
---|
8586 | "Ano Novo": [1, 1],
|
---|
8587 | "Dia do evangélico": [1, 23],
|
---|
8588 | Carnaval: ["easter", -47],
|
---|
8589 | "Alusivo ao Dia Internacional da Mulher": [3, 8],
|
---|
8590 | "Sexta-feira santa": ["easter", -2],
|
---|
8591 | Tiradentes: [4, 21],
|
---|
8592 | "Dia do Trabalhador": [5, 1],
|
---|
8593 | "Corpus Christi": ["easter", 60],
|
---|
8594 | "Aniversário do estado": [6, 15],
|
---|
8595 | "Dia da Amazônia": [9, 5],
|
---|
8596 | "Independência": [9, 7],
|
---|
8597 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8598 | Finados: [11, 2],
|
---|
8599 | "Proclamação da República": [11, 15],
|
---|
8600 | "Assinatura do Tratado de Petrópolis": [11, 17],
|
---|
8601 | Natal: [12, 25]
|
---|
8602 | }
|
---|
8603 | },
|
---|
8604 | Alagoas: {
|
---|
8605 | PH: {
|
---|
8606 | "Ano Novo": [1, 1],
|
---|
8607 | Carnaval: ["easter", -47],
|
---|
8608 | "Sexta-feira santa": ["easter", -2],
|
---|
8609 | Tiradentes: [4, 21],
|
---|
8610 | "Dia do Trabalhador": [5, 1],
|
---|
8611 | "Corpus Christi": ["easter", 60],
|
---|
8612 | "São João": [6, 24],
|
---|
8613 | "São Pedro": [6, 29],
|
---|
8614 | "Independência": [9, 7],
|
---|
8615 | "Emancipação política": [9, 16],
|
---|
8616 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8617 | Finados: [11, 2],
|
---|
8618 | "Proclamação da República": [11, 15],
|
---|
8619 | "Morte de Zumbi dos Palmares": [11, 20],
|
---|
8620 | Natal: [12, 25]
|
---|
8621 | }
|
---|
8622 | },
|
---|
8623 | "Amapá": {
|
---|
8624 | PH: {
|
---|
8625 | "Ano Novo": [1, 1],
|
---|
8626 | Carnaval: ["easter", -47],
|
---|
8627 | "Dia de São José": [3, 19],
|
---|
8628 | "Sexta-feira santa": ["easter", -2],
|
---|
8629 | Tiradentes: [4, 21],
|
---|
8630 | "Dia do Trabalhador": [5, 1],
|
---|
8631 | "Corpus Christi": ["easter", 60],
|
---|
8632 | "Independência": [9, 7],
|
---|
8633 | "Data Magna do estado": [9, 13],
|
---|
8634 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8635 | Finados: [11, 2],
|
---|
8636 | "Proclamação da República": [11, 15],
|
---|
8637 | Natal: [12, 25]
|
---|
8638 | }
|
---|
8639 | },
|
---|
8640 | Amazonas: {
|
---|
8641 | PH: {
|
---|
8642 | "Ano Novo": [1, 1],
|
---|
8643 | Carnaval: ["easter", -47],
|
---|
8644 | "Sexta-feira santa": ["easter", -2],
|
---|
8645 | Tiradentes: [4, 21],
|
---|
8646 | "Dia do Trabalhador": [5, 1],
|
---|
8647 | "Corpus Christi": ["easter", 60],
|
---|
8648 | "Data Magna do estado": [9, 5],
|
---|
8649 | "Independência": [9, 7],
|
---|
8650 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8651 | Finados: [11, 2],
|
---|
8652 | "Proclamação da República": [11, 15],
|
---|
8653 | "Dia da Consciência Negra": [11, 20],
|
---|
8654 | Natal: [12, 25]
|
---|
8655 | }
|
---|
8656 | },
|
---|
8657 | Bahia: {
|
---|
8658 | PH: {
|
---|
8659 | "Ano Novo": [1, 1],
|
---|
8660 | Carnaval: ["easter", -47],
|
---|
8661 | "Sexta-feira santa": ["easter", -2],
|
---|
8662 | Tiradentes: [4, 21],
|
---|
8663 | "Dia do Trabalhador": [5, 1],
|
---|
8664 | "Corpus Christi": ["easter", 60],
|
---|
8665 | "Data magna do estado": [2, 7],
|
---|
8666 | "Independência": [9, 7],
|
---|
8667 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8668 | Finados: [11, 2],
|
---|
8669 | "Proclamação da República": [11, 15],
|
---|
8670 | Natal: [12, 25]
|
---|
8671 | }
|
---|
8672 | },
|
---|
8673 | "Ceará": {
|
---|
8674 | PH: {
|
---|
8675 | "Ano Novo": [1, 1],
|
---|
8676 | Carnaval: ["easter", -47],
|
---|
8677 | "Data magna do estado": [3, 25],
|
---|
8678 | "Sexta-feira santa": ["easter", -2],
|
---|
8679 | Tiradentes: [4, 21],
|
---|
8680 | "Dia do Trabalhador": [5, 1],
|
---|
8681 | "Corpus Christi": ["easter", 60],
|
---|
8682 | "Independência": [9, 7],
|
---|
8683 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8684 | Finados: [11, 2],
|
---|
8685 | "Proclamação da República": [11, 15],
|
---|
8686 | Natal: [12, 25]
|
---|
8687 | }
|
---|
8688 | },
|
---|
8689 | "Distrito Federal": {
|
---|
8690 | PH: {
|
---|
8691 | "Ano Novo": [1, 1],
|
---|
8692 | Carnaval: ["easter", -47],
|
---|
8693 | "Sexta-feira santa": ["easter", -2],
|
---|
8694 | Tiradentes: [4, 21],
|
---|
8695 | "Dia do Trabalhador": [5, 1],
|
---|
8696 | "Corpus Christi": ["easter", 60],
|
---|
8697 | "Independência": [9, 7],
|
---|
8698 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8699 | Finados: [11, 2],
|
---|
8700 | "Proclamação da República": [11, 15],
|
---|
8701 | "Dia do evangélico": [11, 30],
|
---|
8702 | Natal: [12, 25]
|
---|
8703 | }
|
---|
8704 | },
|
---|
8705 | "Espírito Santo": {
|
---|
8706 | PH: {
|
---|
8707 | "Ano Novo": [1, 1],
|
---|
8708 | Carnaval: ["easter", -47],
|
---|
8709 | "Sexta-feira santa": ["easter", -2],
|
---|
8710 | Tiradentes: [4, 21],
|
---|
8711 | "Data magna do estado": [4, 21],
|
---|
8712 | "Dia do Trabalhador": [5, 1],
|
---|
8713 | "Corpus Christi": ["easter", 60],
|
---|
8714 | "Independência": [9, 7],
|
---|
8715 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8716 | Finados: [11, 2],
|
---|
8717 | "Proclamação da República": [11, 15],
|
---|
8718 | Natal: [12, 25]
|
---|
8719 | }
|
---|
8720 | },
|
---|
8721 | "Goiás": {
|
---|
8722 | PH: {
|
---|
8723 | "Ano Novo": [1, 1],
|
---|
8724 | Carnaval: ["easter", -47],
|
---|
8725 | "Sexta-feira santa": ["easter", -2],
|
---|
8726 | Tiradentes: [4, 21],
|
---|
8727 | "Dia do Trabalhador": [5, 1],
|
---|
8728 | "Corpus Christi": ["easter", 60],
|
---|
8729 | "Independência": [9, 7],
|
---|
8730 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8731 | Finados: [11, 2],
|
---|
8732 | "Proclamação da República": [11, 15],
|
---|
8733 | Natal: [12, 25]
|
---|
8734 | }
|
---|
8735 | },
|
---|
8736 | "Maranhão": {
|
---|
8737 | PH: {
|
---|
8738 | "Ano Novo": [1, 1],
|
---|
8739 | Carnaval: ["easter", -47],
|
---|
8740 | "Sexta-feira santa": ["easter", -2],
|
---|
8741 | Tiradentes: [4, 21],
|
---|
8742 | "Dia do Trabalhador": [5, 1],
|
---|
8743 | "Corpus Christi": ["easter", 60],
|
---|
8744 | "Data magna do estado": [7, 28],
|
---|
8745 | "Independência": [9, 7],
|
---|
8746 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8747 | Finados: [11, 2],
|
---|
8748 | "Proclamação da República": [11, 15],
|
---|
8749 | Natal: [12, 25]
|
---|
8750 | }
|
---|
8751 | },
|
---|
8752 | "Mato Grosso": {
|
---|
8753 | _nominatim_url: "https://nominatim.openstreetmap.org/reverse?format=json&lat=-10.4276788&lon=-52.0892082&zoom=18&addressdetails=1&accept-language=pt,en",
|
---|
8754 | PH: {
|
---|
8755 | "Ano Novo": [1, 1],
|
---|
8756 | Carnaval: ["easter", -47],
|
---|
8757 | "Sexta-feira santa": ["easter", -2],
|
---|
8758 | Tiradentes: [4, 21],
|
---|
8759 | "Dia do Trabalhador": [5, 1],
|
---|
8760 | "Corpus Christi": ["easter", 60],
|
---|
8761 | "Independência": [9, 7],
|
---|
8762 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8763 | Finados: [11, 2],
|
---|
8764 | "Proclamação da República": [11, 15],
|
---|
8765 | "Dia da Consciência Negra": [11, 20],
|
---|
8766 | Natal: [12, 25]
|
---|
8767 | }
|
---|
8768 | },
|
---|
8769 | "Mato Grosso do Sul": {
|
---|
8770 | PH: {
|
---|
8771 | "Ano Novo": [1, 1],
|
---|
8772 | Carnaval: ["easter", -47],
|
---|
8773 | "Sexta-feira santa": ["easter", -2],
|
---|
8774 | Tiradentes: [4, 21],
|
---|
8775 | "Dia do Trabalhador": [5, 1],
|
---|
8776 | "Corpus Christi": ["easter", 60],
|
---|
8777 | "Independência": [9, 7],
|
---|
8778 | "Criação do estado": [10, 11],
|
---|
8779 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8780 | Finados: [11, 2],
|
---|
8781 | "Proclamação da República": [11, 15],
|
---|
8782 | Natal: [12, 25]
|
---|
8783 | }
|
---|
8784 | },
|
---|
8785 | "Minas Gerais": {
|
---|
8786 | PH: {
|
---|
8787 | "Ano Novo": [1, 1],
|
---|
8788 | Carnaval: ["easter", -47],
|
---|
8789 | "Sexta-feira santa": ["easter", -2],
|
---|
8790 | Tiradentes: [4, 21],
|
---|
8791 | "Data magna do estado": [4, 21],
|
---|
8792 | "Dia do Trabalhador": [5, 1],
|
---|
8793 | "Corpus Christi": ["easter", 60],
|
---|
8794 | "Independência": [9, 7],
|
---|
8795 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8796 | Finados: [11, 2],
|
---|
8797 | "Proclamação da República": [11, 15],
|
---|
8798 | Natal: [12, 25]
|
---|
8799 | }
|
---|
8800 | },
|
---|
8801 | "Pará": {
|
---|
8802 | PH: {
|
---|
8803 | "Ano Novo": [1, 1],
|
---|
8804 | Carnaval: ["easter", -47],
|
---|
8805 | "Sexta-feira santa": ["easter", -2],
|
---|
8806 | Tiradentes: [4, 21],
|
---|
8807 | "Dia do Trabalhador": [5, 1],
|
---|
8808 | "Corpus Christi": ["easter", 60],
|
---|
8809 | "Data magna do estado": [8, 15],
|
---|
8810 | "Independência": [9, 7],
|
---|
8811 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8812 | Finados: [11, 2],
|
---|
8813 | "Proclamação da República": [11, 15],
|
---|
8814 | Natal: [12, 25]
|
---|
8815 | }
|
---|
8816 | },
|
---|
8817 | "Paraíba": {
|
---|
8818 | PH: {
|
---|
8819 | "Ano Novo": [1, 1],
|
---|
8820 | Carnaval: ["easter", -47],
|
---|
8821 | "Sexta-feira santa": ["easter", -2],
|
---|
8822 | Tiradentes: [4, 21],
|
---|
8823 | "Dia do Trabalhador": [5, 1],
|
---|
8824 | "Corpus Christi": ["easter", 60],
|
---|
8825 | "Homenagem a João Pessoa": [7, 26],
|
---|
8826 | "Data magna do estado": [8, 5],
|
---|
8827 | "Independência": [9, 7],
|
---|
8828 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8829 | Finados: [11, 2],
|
---|
8830 | "Proclamação da República": [11, 15],
|
---|
8831 | Natal: [12, 25]
|
---|
8832 | }
|
---|
8833 | },
|
---|
8834 | "Paraná": {
|
---|
8835 | PH: {
|
---|
8836 | "Ano Novo": [1, 1],
|
---|
8837 | Carnaval: ["easter", -47],
|
---|
8838 | "Sexta-feira santa": ["easter", -2],
|
---|
8839 | Tiradentes: [4, 21],
|
---|
8840 | "Dia do Trabalhador": [5, 1],
|
---|
8841 | "Corpus Christi": ["easter", 60],
|
---|
8842 | "Independência": [9, 7],
|
---|
8843 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8844 | Finados: [11, 2],
|
---|
8845 | "Proclamação da República": [11, 15],
|
---|
8846 | "Data magna do estado": [12, 19],
|
---|
8847 | Natal: [12, 25]
|
---|
8848 | }
|
---|
8849 | },
|
---|
8850 | Pernambuco: {
|
---|
8851 | PH: {
|
---|
8852 | "Ano Novo": [1, 1],
|
---|
8853 | Carnaval: ["easter", -47],
|
---|
8854 | "Data magna do estado": ["firstMarchSunday"],
|
---|
8855 | "Sexta-feira santa": ["easter", -2],
|
---|
8856 | Tiradentes: [4, 21],
|
---|
8857 | "Dia do Trabalhador": [5, 1],
|
---|
8858 | "Corpus Christi": ["easter", 60],
|
---|
8859 | "Independência": [9, 7],
|
---|
8860 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8861 | Finados: [11, 2],
|
---|
8862 | "Proclamação da República": [11, 15],
|
---|
8863 | Natal: [12, 25]
|
---|
8864 | }
|
---|
8865 | },
|
---|
8866 | "Piauí": {
|
---|
8867 | PH: {
|
---|
8868 | "Ano Novo": [1, 1],
|
---|
8869 | Carnaval: ["easter", -47],
|
---|
8870 | "Sexta-feira santa": ["easter", -2],
|
---|
8871 | Tiradentes: [4, 21],
|
---|
8872 | "Dia do Trabalhador": [5, 1],
|
---|
8873 | "Corpus Christi": ["easter", 60],
|
---|
8874 | "Independência": [9, 7],
|
---|
8875 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8876 | "Data magna do estado": [10, 19],
|
---|
8877 | Finados: [11, 2],
|
---|
8878 | "Proclamação da República": [11, 15],
|
---|
8879 | Natal: [12, 25]
|
---|
8880 | }
|
---|
8881 | },
|
---|
8882 | "Rio de Janeiro": {
|
---|
8883 | PH: {
|
---|
8884 | "Ano Novo": [1, 1],
|
---|
8885 | Carnaval: ["easter", -47],
|
---|
8886 | "Sexta-feira santa": ["easter", -2],
|
---|
8887 | Tiradentes: [4, 21],
|
---|
8888 | "Dia do Trabalhador": [5, 1],
|
---|
8889 | "Corpus Christi": ["easter", 60],
|
---|
8890 | "Independência": [9, 7],
|
---|
8891 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8892 | Finados: [11, 2],
|
---|
8893 | "Proclamação da República": [11, 15],
|
---|
8894 | "Dia da Consciência Negra": [11, 20],
|
---|
8895 | Natal: [12, 25]
|
---|
8896 | }
|
---|
8897 | },
|
---|
8898 | "Rio Grande do Norte": {
|
---|
8899 | PH: {
|
---|
8900 | "Ano Novo": [1, 1],
|
---|
8901 | Carnaval: ["easter", -47],
|
---|
8902 | "Sexta-feira santa": ["easter", -2],
|
---|
8903 | Tiradentes: [4, 21],
|
---|
8904 | "São Jorge": [4, 23],
|
---|
8905 | "Dia do Trabalhador": [5, 1],
|
---|
8906 | "Corpus Christi": ["easter", 60],
|
---|
8907 | "Independência": [9, 7],
|
---|
8908 | "Mártires de Cunhaú e Uruaçu": [10, 3],
|
---|
8909 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8910 | Finados: [11, 2],
|
---|
8911 | "Proclamação da República": [11, 15],
|
---|
8912 | Natal: [12, 25]
|
---|
8913 | }
|
---|
8914 | },
|
---|
8915 | "Rio Grande do Sul": {
|
---|
8916 | PH: {
|
---|
8917 | "Ano Novo": [1, 1],
|
---|
8918 | Carnaval: ["easter", -47],
|
---|
8919 | "Sexta-feira santa": ["easter", -2],
|
---|
8920 | Tiradentes: [4, 21],
|
---|
8921 | "Dia do Trabalhador": [5, 1],
|
---|
8922 | "Corpus Christi": ["easter", 60],
|
---|
8923 | "Independência": [9, 7],
|
---|
8924 | "Proclamação da República Rio-Grandense": [9, 20],
|
---|
8925 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8926 | Finados: [11, 2],
|
---|
8927 | "Proclamação da República": [11, 15],
|
---|
8928 | Natal: [12, 25]
|
---|
8929 | }
|
---|
8930 | },
|
---|
8931 | "Rondônia": {
|
---|
8932 | PH: {
|
---|
8933 | "Ano Novo": [1, 1],
|
---|
8934 | "Data magna do estado": [1, 4],
|
---|
8935 | Carnaval: ["easter", -47],
|
---|
8936 | "Sexta-feira santa": ["easter", -2],
|
---|
8937 | Tiradentes: [4, 21],
|
---|
8938 | "Dia do Trabalhador": [5, 1],
|
---|
8939 | "Corpus Christi": ["easter", 60],
|
---|
8940 | "Dia do evangélico": [6, 18],
|
---|
8941 | "Independência": [9, 7],
|
---|
8942 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8943 | Finados: [11, 2],
|
---|
8944 | "Proclamação da República": [11, 15],
|
---|
8945 | Natal: [12, 25]
|
---|
8946 | }
|
---|
8947 | },
|
---|
8948 | Roraima: {
|
---|
8949 | PH: {
|
---|
8950 | "Ano Novo": [1, 1],
|
---|
8951 | Carnaval: ["easter", -47],
|
---|
8952 | "Sexta-feira santa": ["easter", -2],
|
---|
8953 | Tiradentes: [4, 21],
|
---|
8954 | "Dia do Trabalhador": [5, 1],
|
---|
8955 | "Corpus Christi": ["easter", 60],
|
---|
8956 | "Independência": [9, 7],
|
---|
8957 | "Data magna do estado": [10, 5],
|
---|
8958 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8959 | Finados: [11, 2],
|
---|
8960 | "Proclamação da República": [11, 15],
|
---|
8961 | Natal: [12, 25]
|
---|
8962 | }
|
---|
8963 | },
|
---|
8964 | "Santa Catarina": {
|
---|
8965 | PH: {
|
---|
8966 | "Ano Novo": [1, 1],
|
---|
8967 | Carnaval: ["easter", -47],
|
---|
8968 | "Sexta-feira santa": ["easter", -2],
|
---|
8969 | Tiradentes: [4, 21],
|
---|
8970 | "Dia do Trabalhador": [5, 1],
|
---|
8971 | "Corpus Christi": ["easter", 60],
|
---|
8972 | "Data magna do estado": [8, 11],
|
---|
8973 | "Independência": [9, 7],
|
---|
8974 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8975 | Finados: [11, 2],
|
---|
8976 | "Proclamação da República": [11, 15],
|
---|
8977 | "Santa Catarina de Alexandria": [11, 25],
|
---|
8978 | Natal: [12, 25]
|
---|
8979 | }
|
---|
8980 | },
|
---|
8981 | "São Paulo": {
|
---|
8982 | PH: {
|
---|
8983 | "Ano Novo": [1, 1],
|
---|
8984 | Carnaval: ["easter", -47],
|
---|
8985 | "Sexta-feira santa": ["easter", -2],
|
---|
8986 | Tiradentes: [4, 21],
|
---|
8987 | "Dia do Trabalhador": [5, 1],
|
---|
8988 | "Corpus Christi": ["easter", 60],
|
---|
8989 | "Data magna do estado": [7, 9],
|
---|
8990 | "Independência": [9, 7],
|
---|
8991 | "Nossa Senhora Aparecida": [10, 12],
|
---|
8992 | Finados: [11, 2],
|
---|
8993 | "Proclamação da República": [11, 15],
|
---|
8994 | Natal: [12, 25]
|
---|
8995 | }
|
---|
8996 | },
|
---|
8997 | Sergipe: {
|
---|
8998 | PH: {
|
---|
8999 | "Ano Novo": [1, 1],
|
---|
9000 | Carnaval: ["easter", -47],
|
---|
9001 | "Aniversário de Aracaju": [3, 17],
|
---|
9002 | "Sexta-feira santa": ["easter", -2],
|
---|
9003 | Tiradentes: [4, 21],
|
---|
9004 | "Dia do Trabalhador": [5, 1],
|
---|
9005 | "Corpus Christi": ["easter", 60],
|
---|
9006 | "São João": [6, 24],
|
---|
9007 | "Data magna do estado": [7, 8],
|
---|
9008 | "Independência": [9, 7],
|
---|
9009 | "Nossa Senhora Aparecida": [10, 12],
|
---|
9010 | Finados: [11, 2],
|
---|
9011 | "Proclamação da República": [11, 15],
|
---|
9012 | "Nossa Senhora da Conceição": [12, 8],
|
---|
9013 | Natal: [12, 25]
|
---|
9014 | }
|
---|
9015 | },
|
---|
9016 | Tocantins: {
|
---|
9017 | PH: {
|
---|
9018 | "Ano Novo": [1, 1],
|
---|
9019 | Carnaval: ["easter", -47],
|
---|
9020 | "Autonomia do estado": [3, 18],
|
---|
9021 | "Sexta-feira santa": ["easter", -2],
|
---|
9022 | Tiradentes: [4, 21],
|
---|
9023 | "Dia do Trabalhador": [5, 1],
|
---|
9024 | "Corpus Christi": ["easter", 60],
|
---|
9025 | "Independência": [9, 7],
|
---|
9026 | "Nossa Senhora da Natividade": [9, 8],
|
---|
9027 | "Criação do estado": [10, 5],
|
---|
9028 | "Nossa Senhora Aparecida": [10, 12],
|
---|
9029 | Finados: [11, 2],
|
---|
9030 | "Proclamação da República": [11, 15],
|
---|
9031 | Natal: [12, 25]
|
---|
9032 | }
|
---|
9033 | }
|
---|
9034 | },
|
---|
9035 | hu: {
|
---|
9036 | PH: {
|
---|
9037 | "újév": [1, 1],
|
---|
9038 | "az 1848-as forradalom ünnepe": [3, 15],
|
---|
9039 | "nagypéntek": ["easter", -2],
|
---|
9040 | "húsvétvasárnap": ["easter", 0],
|
---|
9041 | "húsvéthétfő": ["easter", 1],
|
---|
9042 | "pünkösdvasárnap": ["easter", 49],
|
---|
9043 | "pünkösdhétfő": ["easter", 50],
|
---|
9044 | "a munka ünnepe": [5, 1],
|
---|
9045 | "az államalapítás ünnepe": [8, 20],
|
---|
9046 | "az 1956-os forradalom ünnepe": [10, 23],
|
---|
9047 | mindenszentek: [11, 1],
|
---|
9048 | "karácsony": [12, 25],
|
---|
9049 | "karácsony másnap": [12, 26]
|
---|
9050 | },
|
---|
9051 | SH: [{
|
---|
9052 | name: "tavaszi szünet",
|
---|
9053 | 2018: [4, 2, 4, 7],
|
---|
9054 | 2019: [3, 24, 3, 29],
|
---|
9055 | 2020: [4, 13, 4, 18]
|
---|
9056 | }, {
|
---|
9057 | name: "nyári szünet",
|
---|
9058 | 2018: [6, 16, 8, 31],
|
---|
9059 | 2019: [6, 16, 8, 31],
|
---|
9060 | 2020: [6, 16, 8, 31]
|
---|
9061 | }, {
|
---|
9062 | name: "őszi szünet",
|
---|
9063 | 2014: [10, 27, 10, 31],
|
---|
9064 | 2018: [10, 26, 10, 30],
|
---|
9065 | 2019: [11, 2, 11, 4]
|
---|
9066 | }, {
|
---|
9067 | name: "téli szünet",
|
---|
9068 | 2014: [12, 22, 1, 2],
|
---|
9069 | 2018: [12, 21, 12, 31],
|
---|
9070 | 2019: [12, 22, 1, 2]
|
---|
9071 | }]
|
---|
9072 | },
|
---|
9073 | sk: {
|
---|
9074 | PH: {
|
---|
9075 | "Deň vzniku Slovenskej republiky": [1, 1],
|
---|
9076 | "Zjavenie Pána": [1, 6],
|
---|
9077 | "Veľký piatok": ["easter", -2],
|
---|
9078 | "Veľkonočný pondelok": ["easter", 1],
|
---|
9079 | "Sviatok práce": [5, 1],
|
---|
9080 | "Deň víťazstva nad fašizmom": [5, 8],
|
---|
9081 | "Sviatok svätého Cyrila a Metoda": [7, 5],
|
---|
9082 | "Výročie Slovenského národného povstania": [8, 29],
|
---|
9083 | "Deň Ústavy Slovenskej republiky": [9, 1],
|
---|
9084 | "Sviatok Panny Márie Sedembolestnej": [9, 15],
|
---|
9085 | "Sviatok všetkých svätých": [11, 1],
|
---|
9086 | "Deň boja za slobodu a demokraciu": [11, 17],
|
---|
9087 | "Štedrý deň": [12, 24],
|
---|
9088 | "Prvý sviatok vianočný": [12, 25],
|
---|
9089 | "Druhý sviatok vianočný": [12, 26]
|
---|
9090 | }
|
---|
9091 | }
|
---|
9092 | };
|
---|
9093 | var word_error_correction = {
|
---|
9094 | wrong_words: {
|
---|
9095 | 'Assuming "<ok>" for "<ko>".': {
|
---|
9096 | daytime: "sunrise-sunset",
|
---|
9097 | spring: "Mar-May",
|
---|
9098 | summer: "Jun-Aug",
|
---|
9099 | autumn: "Sep-Nov",
|
---|
9100 | winter: "Dec-Feb",
|
---|
9101 | _: "-",
|
---|
9102 | "=": "-"
|
---|
9103 | },
|
---|
9104 | '"<ko>" wird als "<ok>" interpertiert.': {
|
---|
9105 | "frühling": "Mar-May",
|
---|
9106 | "frühjahr": "Mar-May",
|
---|
9107 | sommer: "Jun-Aug",
|
---|
9108 | herbst: "Sep-Nov"
|
---|
9109 | },
|
---|
9110 | 'Bitte benutze die englische Schreibweise "<ok>" für "<ko>".': {
|
---|
9111 | "werktags?": "Mo-Fr"
|
---|
9112 | },
|
---|
9113 | 'Bitte benutze "<ok>" für "<ko>". Beispiel: "Mo-Fr 08:00-12:00; Tu off".': {
|
---|
9114 | "ruhetage?": "off",
|
---|
9115 | geschlossen: "off",
|
---|
9116 | geschl: "off"
|
---|
9117 | },
|
---|
9118 | 'Neem de engelse afkorting "<ok>" voor "<ko>" alstublieft.': {
|
---|
9119 | gesloten: "off",
|
---|
9120 | feestdag: "PH",
|
---|
9121 | feestdagen: "PH"
|
---|
9122 | },
|
---|
9123 | 'Assuming "<ok>" for "<ko>". Please avoid using "workday": https://wiki.openstreetmap.org/wiki/Talk:Key:opening_hours#need_syntax_for_holidays_and_workingdays': {
|
---|
9124 | wd: "Mo-Fr",
|
---|
9125 | "on work days?": "Mo-Fr",
|
---|
9126 | "weekdays?": "Mo-Fr",
|
---|
9127 | vardagar: "Mo-Fr"
|
---|
9128 | },
|
---|
9129 | 'Please use something like "Mo off" instead "<ko>".': {
|
---|
9130 | except: "off"
|
---|
9131 | },
|
---|
9132 | 'Please omit "<ko>" or use a colon instead: "12:00-14:00".': {
|
---|
9133 | h: ""
|
---|
9134 | },
|
---|
9135 | 'Please omit "<ko>".': {
|
---|
9136 | season: "",
|
---|
9137 | hs: "",
|
---|
9138 | hrs: "",
|
---|
9139 | hours: ""
|
---|
9140 | },
|
---|
9141 | 'Please omit "<ko>". The key must not be in the value.': {
|
---|
9142 | "opening_hours\\s*=": ""
|
---|
9143 | },
|
---|
9144 | 'Please omit "<ko>". You might want to express open end which can be specified as "12:00+" for example.': {
|
---|
9145 | from: ""
|
---|
9146 | },
|
---|
9147 | 'You can use notation "<ok>" for "<ko>" in the case that you want to express open end times. Example: "12:00+".': {
|
---|
9148 | "(:?bis|till?|-|–)? ?(?:open ?end|late)": "+"
|
---|
9149 | },
|
---|
9150 | 'Please use notation "<ok>" for "<ko>". If the times are unsure or vary consider a comment e.g. 12:00-14:00 "only on sunshine".': {
|
---|
9151 | "~": "-",
|
---|
9152 | "~": "-"
|
---|
9153 | },
|
---|
9154 | 'Please use notation "<ok>" for "<ko>". Fallback rule: 12:00-14:00 || "call us"': {
|
---|
9155 | otherwise: "||"
|
---|
9156 | },
|
---|
9157 | 'You can use notation "<ok>" for "?" temporally if the syntax will still be valid.': {
|
---|
9158 | "\\?": 'unknown "please add this if known"'
|
---|
9159 | },
|
---|
9160 | 'Please use notation "<ok>" for "<ko>". Although using "–" is typographical correct, the opening_hours syntax is defined with the normal hyphen. Correct typography should be done on application level …': {
|
---|
9161 | "–": "-"
|
---|
9162 | },
|
---|
9163 | 'Please use notation "<ok>" for "<ko>".': {
|
---|
9164 | "→": "-",
|
---|
9165 | "−": "-",
|
---|
9166 | "—": "-",
|
---|
9167 | "ー": "-",
|
---|
9168 | to: "-",
|
---|
9169 | "до": "-",
|
---|
9170 | a: "-",
|
---|
9171 | as: "-",
|
---|
9172 | "á": "-",
|
---|
9173 | "ás": "-",
|
---|
9174 | "às": "-",
|
---|
9175 | ate: "-",
|
---|
9176 | "till?": "-",
|
---|
9177 | until: "-",
|
---|
9178 | through: "-",
|
---|
9179 | and: ",",
|
---|
9180 | "&": ",",
|
---|
9181 | ":": ":",
|
---|
9182 | "°°": ":00",
|
---|
9183 | always: "24/7",
|
---|
9184 | "always open": "24/7",
|
---|
9185 | "always closed": "closed",
|
---|
9186 | nonstop: "24/7",
|
---|
9187 | "24x7": "24/7",
|
---|
9188 | anytime: "24/7",
|
---|
9189 | "all day": "24/7",
|
---|
9190 | daily: "Mo-Su",
|
---|
9191 | everyday: "Mo-Su",
|
---|
9192 | "every day": "Mo-Su",
|
---|
9193 | "all days": "Mo-Su",
|
---|
9194 | "7j/7": "Mo-Su",
|
---|
9195 | "7/7": "Mo-Su",
|
---|
9196 | "7days": "Mo-Su",
|
---|
9197 | "7 days": "Mo-Su",
|
---|
9198 | "7 days a week": "Mo-Su",
|
---|
9199 | "7 days/week": "Mo-Su",
|
---|
9200 | "24 hours 7 days a week": "24/7",
|
---|
9201 | "24 hours": "00:00-24:00",
|
---|
9202 | midday: "12:00",
|
---|
9203 | midnight: "00:00",
|
---|
9204 | "(?:public )?holidays?": "PH",
|
---|
9205 | "(?:one )?day after public holiday": "PH +1 day",
|
---|
9206 | "(?:one )?day before public holiday": "PH -1 day",
|
---|
9207 | "school ?holidays?": "SH",
|
---|
9208 | "weekends?": "Sa,Su",
|
---|
9209 | daylight: "sunrise-sunset",
|
---|
9210 | "(?:on|by)?(?:_| )?appointments?": '"on appointment"'
|
---|
9211 | },
|
---|
9212 | 'Please use notation "<ok>" for "<ko>". Those characters look very similar but are not the same!': {
|
---|
9213 | "оff": "off"
|
---|
9214 | },
|
---|
9215 | 'Please use time format in 24 hours notation ("<ko>"). If PM is used you might have to convert the hours to the 24 hours notation.': {
|
---|
9216 | pm: "",
|
---|
9217 | "p.m.": "",
|
---|
9218 | "рм": "",
|
---|
9219 | am: "",
|
---|
9220 | "a.m.": "",
|
---|
9221 | "ам": ""
|
---|
9222 | },
|
---|
9223 | 'Bitte verzichte auf "<ko>".': {
|
---|
9224 | uhr: "",
|
---|
9225 | "geöffnet": "",
|
---|
9226 | zwischen: "",
|
---|
9227 | ist: "",
|
---|
9228 | durchgehend: "",
|
---|
9229 | "öffnungszeit(?:en)?:?": ""
|
---|
9230 | },
|
---|
9231 | 'Bitte verzichte auf "<ko>". Sie möchten eventuell eine Öffnungszeit ohne vorgegebenes Ende (Open End) angeben. Beispiel: "12:00+"': {
|
---|
9232 | ab: "",
|
---|
9233 | von: ""
|
---|
9234 | },
|
---|
9235 | 'Es sieht so aus also möchten Sie zusätzliche Einschränkungen für eine Öffnungszeit geben. Falls sich dies nicht mit der Syntax ausdrücken lässt können Kommentare verwendet werden. Zusätzlich sollte eventuell das Schlüsselwort `open` benutzt werden. Bitte probiere "<ok>" für "<ko>".': {
|
---|
9236 | damen: 'open "Damen"',
|
---|
9237 | herren: 'open "Herren"'
|
---|
9238 | },
|
---|
9239 | 'Bitte benutze die Schreibweise "<ok>" für "<ko>".': {
|
---|
9240 | bis: "-",
|
---|
9241 | "täglich": "Mo-Su",
|
---|
9242 | "(?:schul)?ferien": "SH",
|
---|
9243 | "(?:an|nur)? ?sonn-?(?: und |/)feiertag(?:s|en?)?": "PH,Su",
|
---|
9244 | "nach(?: |_)vereinbarung": '"Nach Vereinbarung"',
|
---|
9245 | "nach(?: |_)absprache": '"Nach Absprache"'
|
---|
9246 | },
|
---|
9247 | 'Bitte benutze die Schreibweise "<ok>" für "<ko>". Es ist war typografisch korrekt aber laut der Spezifikation für opening_hours nicht erlaubt. Siehe auch: https://wiki.openstreetmap.org/wiki/DE:Key:opening_hours/specification.': {
|
---|
9248 | "„": '"',
|
---|
9249 | "“": '"',
|
---|
9250 | "”": '"'
|
---|
9251 | },
|
---|
9252 | 'Please use notation "<ok>" for "<ko>". The used quote signs might be typographically correct but are not defined in the specification. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification.': {
|
---|
9253 | "«": '"',
|
---|
9254 | "»": '"',
|
---|
9255 | "‚": '"',
|
---|
9256 | "‘": '"',
|
---|
9257 | "’": '"',
|
---|
9258 | "「": '"',
|
---|
9259 | "」": '"',
|
---|
9260 | "『": '"',
|
---|
9261 | "』": '"'
|
---|
9262 | },
|
---|
9263 | 'Please use notation "<ok>" for "<ko>". The used quote signs are not defined in the specification. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification.': {
|
---|
9264 | "'": '"'
|
---|
9265 | },
|
---|
9266 | 'You might want to use comments instead of brackets (which are not valid in this context). If you do, replace "<ok>" with "<ko>".': {},
|
---|
9267 | 'Bitte benutze die Schreibweise "<ok>" als Ersatz für "<ko>".': {
|
---|
9268 | und: ",",
|
---|
9269 | u: ",",
|
---|
9270 | auch: ","
|
---|
9271 | },
|
---|
9272 | 'Bitte benutze die englische Abkürzung "<ok>" für "<ko>".': {
|
---|
9273 | "(?:an )?feiertag(?:s|en?)?": "PH"
|
---|
9274 | },
|
---|
9275 | 'S\'il vous plaît utiliser "<ok>" pour "<ko>".': {
|
---|
9276 | "fermé": "off",
|
---|
9277 | et: ",",
|
---|
9278 | "à": "-",
|
---|
9279 | "jours fériés": "PH"
|
---|
9280 | }
|
---|
9281 | },
|
---|
9282 | month: {
|
---|
9283 | "default": {
|
---|
9284 | jan: 0,
|
---|
9285 | feb: 1,
|
---|
9286 | mar: 2,
|
---|
9287 | apr: 3,
|
---|
9288 | may: 4,
|
---|
9289 | jun: 5,
|
---|
9290 | jul: 6,
|
---|
9291 | aug: 7,
|
---|
9292 | sep: 8,
|
---|
9293 | oct: 9,
|
---|
9294 | nov: 10,
|
---|
9295 | dec: 11
|
---|
9296 | },
|
---|
9297 | 'Please use the English abbreviation "<ok>" for "<ko>".': {
|
---|
9298 | "jänner": 0,
|
---|
9299 | january: 0,
|
---|
9300 | february: 1,
|
---|
9301 | march: 2,
|
---|
9302 | april: 3,
|
---|
9303 | "june?": 5,
|
---|
9304 | "july?": 6,
|
---|
9305 | august: 7,
|
---|
9306 | september: 8,
|
---|
9307 | sept: 8,
|
---|
9308 | october: 9,
|
---|
9309 | november: 10,
|
---|
9310 | december: 11
|
---|
9311 | },
|
---|
9312 | 'Bitte benutze die englische Abkürzung "<ok>" für "<ko>".': {
|
---|
9313 | januar: 0,
|
---|
9314 | februar: 1,
|
---|
9315 | "märz?": 2,
|
---|
9316 | maerz: 2,
|
---|
9317 | mai: 4,
|
---|
9318 | juni: 5,
|
---|
9319 | juli: 6,
|
---|
9320 | okt: 9,
|
---|
9321 | oktober: 9,
|
---|
9322 | dez: 11,
|
---|
9323 | dezember: 11
|
---|
9324 | },
|
---|
9325 | 'S\'il vous plaît utiliser l\'abréviation "<ok>" pour "<ko>".': {
|
---|
9326 | janvier: 0,
|
---|
9327 | "février": 1,
|
---|
9328 | "fév": 1,
|
---|
9329 | mars: 2,
|
---|
9330 | avril: 3,
|
---|
9331 | avr: 3,
|
---|
9332 | mai: 4,
|
---|
9333 | juin: 5,
|
---|
9334 | juillet: 6,
|
---|
9335 | "août": 7,
|
---|
9336 | "aoû": 7,
|
---|
9337 | septembre: 8,
|
---|
9338 | octobre: 9,
|
---|
9339 | novembre: 10,
|
---|
9340 | "décembre": 11
|
---|
9341 | },
|
---|
9342 | 'Neem de engelse afkorting "<ok>" voor "<ko>" alstublieft.': {
|
---|
9343 | januari: 0,
|
---|
9344 | februari: 1,
|
---|
9345 | maart: 2,
|
---|
9346 | mei: 4,
|
---|
9347 | augustus: 7
|
---|
9348 | }
|
---|
9349 | },
|
---|
9350 | calcday: {
|
---|
9351 | "default": {
|
---|
9352 | day: "day",
|
---|
9353 | days: "days"
|
---|
9354 | }
|
---|
9355 | },
|
---|
9356 | weekday: {
|
---|
9357 | "default": {
|
---|
9358 | su: 0,
|
---|
9359 | mo: 1,
|
---|
9360 | tu: 2,
|
---|
9361 | we: 3,
|
---|
9362 | th: 4,
|
---|
9363 | fr: 5,
|
---|
9364 | sa: 6
|
---|
9365 | },
|
---|
9366 | 'Assuming "<ok>" for "<ko>"': {
|
---|
9367 | m: 1,
|
---|
9368 | w: 3,
|
---|
9369 | f: 5
|
---|
9370 | },
|
---|
9371 | 'Please use the abbreviation "<ok>" for "<ko>".': {
|
---|
9372 | sun: 0,
|
---|
9373 | "sundays?": 0,
|
---|
9374 | mon: 1,
|
---|
9375 | "mondays?": 1,
|
---|
9376 | "tues?": 2,
|
---|
9377 | "tuesdays?": 2,
|
---|
9378 | "weds?": 3,
|
---|
9379 | "wednesdays?": 3,
|
---|
9380 | thu: 4,
|
---|
9381 | "thurs?": 4,
|
---|
9382 | "thursdays?": 4,
|
---|
9383 | fri: 5,
|
---|
9384 | "fridays?": 5,
|
---|
9385 | sat: 6,
|
---|
9386 | "saturdays?": 6
|
---|
9387 | },
|
---|
9388 | 'Bitte benutze die englische Abkürzung "<ok>" für "<ko>". Could also mean Saturday in Polish …': {
|
---|
9389 | so: 0
|
---|
9390 | },
|
---|
9391 | 'Bitte benutze die englische Abkürzung "<ok>" für "<ko>".': {
|
---|
9392 | son: 0,
|
---|
9393 | "sonn-": 0,
|
---|
9394 | "sonntags?": 0,
|
---|
9395 | "montags?": 1,
|
---|
9396 | di: 2,
|
---|
9397 | "die?": 2,
|
---|
9398 | "dienstags?": 2,
|
---|
9399 | mi: 3,
|
---|
9400 | "mit?": 3,
|
---|
9401 | "mittwochs?": 3,
|
---|
9402 | "don?": 4,
|
---|
9403 | "donnerstags?": 4,
|
---|
9404 | fre: 5,
|
---|
9405 | "freitags?": 5,
|
---|
9406 | sam: 6,
|
---|
9407 | "samstags?": 6
|
---|
9408 | },
|
---|
9409 | 'S\'il vous plaît utiliser l\'abréviation "<ok>" pour "<ko>".': {
|
---|
9410 | dim: 0,
|
---|
9411 | dimanche: 0,
|
---|
9412 | "lun?": 1,
|
---|
9413 | lundi: 1,
|
---|
9414 | mardi: 2,
|
---|
9415 | mer: 3,
|
---|
9416 | mercredi: 3,
|
---|
9417 | "jeu?": 4,
|
---|
9418 | jeudi: 4,
|
---|
9419 | "ven?": 5,
|
---|
9420 | vendredi: 5,
|
---|
9421 | samedi: 6
|
---|
9422 | },
|
---|
9423 | 'Neem de engelse afkorting "<ok>" voor "<ko>" alstublieft.': {
|
---|
9424 | "zon?": 0,
|
---|
9425 | zontag: 0,
|
---|
9426 | zondag: 0,
|
---|
9427 | maandag: 1,
|
---|
9428 | din: 2,
|
---|
9429 | dinsdag: 2,
|
---|
9430 | "woe?": 3,
|
---|
9431 | woensdag: 3,
|
---|
9432 | donderdag: 4,
|
---|
9433 | "vri?": 5,
|
---|
9434 | vrijdag: 5,
|
---|
9435 | "zat?": 6,
|
---|
9436 | zaterdag: 6
|
---|
9437 | },
|
---|
9438 | 'Please use the English abbreviation "<ok>" for "<ko>".': {
|
---|
9439 | "neděle": 0,
|
---|
9440 | ne: 0,
|
---|
9441 | "pondělí": 1,
|
---|
9442 | po: 1,
|
---|
9443 | "úterý": 2,
|
---|
9444 | "út": 2,
|
---|
9445 | "středa": 3,
|
---|
9446 | st: 3,
|
---|
9447 | "čtvrtek": 4,
|
---|
9448 | "čt": 4,
|
---|
9449 | "pátek": 5,
|
---|
9450 | "pá": 5,
|
---|
9451 | sobota: 6
|
---|
9452 | },
|
---|
9453 | 'Please use the English abbreviation "<ok>" (Spanish) for "<ko>".': {
|
---|
9454 | martes: 0,
|
---|
9455 | "miércoles": 1,
|
---|
9456 | jueves: 2,
|
---|
9457 | viernes: 3,
|
---|
9458 | "sábado": 4,
|
---|
9459 | domingo: 5,
|
---|
9460 | lunes: 6
|
---|
9461 | },
|
---|
9462 | 'Please use the English abbreviation "<ok>" (Indonesian) for "<ko>".': {
|
---|
9463 | selasa: 0,
|
---|
9464 | rabu: 1,
|
---|
9465 | kami: 2,
|
---|
9466 | jumat: 3,
|
---|
9467 | sabtu: 4,
|
---|
9468 | minggu: 5,
|
---|
9469 | senin: 6
|
---|
9470 | },
|
---|
9471 | 'Please use the English abbreviation "<ok>" (Swedish) for "<ko>".': {
|
---|
9472 | "söndag": 0,
|
---|
9473 | "söndagar": 0,
|
---|
9474 | "måndag": 1,
|
---|
9475 | ma: 1,
|
---|
9476 | tisdag: 2,
|
---|
9477 | onsdag: 3,
|
---|
9478 | torsdag: 4,
|
---|
9479 | fredag: 5,
|
---|
9480 | "lördag": 6,
|
---|
9481 | "lördagar": 6
|
---|
9482 | },
|
---|
9483 | 'Please use the English abbreviation "<ok>" (Polish) for "<ko>".': {
|
---|
9484 | niedziela: 0,
|
---|
9485 | niedz: 0,
|
---|
9486 | n: 0,
|
---|
9487 | ndz: 0,
|
---|
9488 | "poniedziałek": 1,
|
---|
9489 | poniedzialek: 1,
|
---|
9490 | pon: 1,
|
---|
9491 | pn: 1,
|
---|
9492 | wtorek: 2,
|
---|
9493 | wt: 2,
|
---|
9494 | "środa": 3,
|
---|
9495 | sroda: 3,
|
---|
9496 | "śr": 3,
|
---|
9497 | sr: 3,
|
---|
9498 | czwartek: 4,
|
---|
9499 | czw: 4,
|
---|
9500 | cz: 4,
|
---|
9501 | "piątek": 5,
|
---|
9502 | piatek: 5,
|
---|
9503 | pt: 5,
|
---|
9504 | sobota: 6,
|
---|
9505 | sob: 6
|
---|
9506 | },
|
---|
9507 | 'Please use the English abbreviation "<ok>" (Russian) for "<ko>".': {
|
---|
9508 | "воскресенье": 0,
|
---|
9509 | "Вс": 0,
|
---|
9510 | "voskresen'ye": 0,
|
---|
9511 | "понедельник": 1,
|
---|
9512 | "Пн": 1,
|
---|
9513 | "ponedel'nik": 1,
|
---|
9514 | "вторник": 2,
|
---|
9515 | vtornik: 2,
|
---|
9516 | "среда": 3,
|
---|
9517 | sreda: 3,
|
---|
9518 | "четверг": 4,
|
---|
9519 | chetverk: 4,
|
---|
9520 | "пятница": 5,
|
---|
9521 | pyatnitsa: 5,
|
---|
9522 | "суббота": 6,
|
---|
9523 | subbota: 6
|
---|
9524 | },
|
---|
9525 | 'Please use the English abbreviation "<ok>" (Danish) for "<ko>".': {
|
---|
9526 | "søndag": 0,
|
---|
9527 | mandag: 1,
|
---|
9528 | tirsdag: 2,
|
---|
9529 | onsdag: 3,
|
---|
9530 | torsdag: 4,
|
---|
9531 | fredag: 5,
|
---|
9532 | "lørdag": 6
|
---|
9533 | }
|
---|
9534 | },
|
---|
9535 | timevar: {
|
---|
9536 | "default": {
|
---|
9537 | sunrise: "sunrise",
|
---|
9538 | sunset: "sunset",
|
---|
9539 | dawn: "dawn",
|
---|
9540 | dusk: "dusk"
|
---|
9541 | },
|
---|
9542 | 'Please use notation "<ok>" for "<ko>".': {
|
---|
9543 | sundown: "sunset"
|
---|
9544 | },
|
---|
9545 | 'Bitte benutze die Schreibweise "<ok>" für "<ko>".': {
|
---|
9546 | "morgendämmerung": "dawn",
|
---|
9547 | "abenddämmerung": "dusk",
|
---|
9548 | sonnenaufgang: "sunrise",
|
---|
9549 | sonnenuntergang: "sunset"
|
---|
9550 | }
|
---|
9551 | },
|
---|
9552 | event: {
|
---|
9553 | "default": {
|
---|
9554 | easter: "easter"
|
---|
9555 | },
|
---|
9556 | 'Bitte benutze die Schreibweise "<ok>" für "<ko>".': {
|
---|
9557 | ostern: "easter"
|
---|
9558 | }
|
---|
9559 | }
|
---|
9560 | };
|
---|
9561 | var lang = {
|
---|
9562 | "unexpected token": 'Unexpected token: "__token__" This means that the syntax is not valid at that point or it is currently not supported.',
|
---|
9563 | "no string": "The value (first parameter) is not a string.",
|
---|
9564 | nothing: "The value contains nothing meaningful which can be parsed.",
|
---|
9565 | "nothing useful": "This rule does not contain anything useful. Please remove this empty rule.",
|
---|
9566 | "programmers joke": "Might it be possible that you are a programmer and adding a semicolon after each statement is hardwired in your muscle memory ;) ?" + " The thing is that the semicolon in the opening_hours syntax is defined as rule separator." + " So for compatibility reasons you should omit this last semicolon.",
|
---|
9567 | "interpreted as year": "The number __number__ will be interpreted as year." + ' This is probably not intended. Times can be specified as "12:00".',
|
---|
9568 | "rule before fallback empty": "Rule before fallback rule does not contain anything useful",
|
---|
9569 | "hour min separator": 'Please use ":" as hour/minute-separator',
|
---|
9570 | "warnings severity": 'The parameter optional_conf_parm["warnings_severity"] must be an integer number between 0 and 7 (inclusive).' + " Given __severity__" + ", expected one of the following numbers: __allowed__.",
|
---|
9571 | "optional conf parm type": "The optional_conf_parm parameter is of unknown type." + " Given __given__",
|
---|
9572 | "conf param tag key missing": 'The optional_conf_parm["tag_key"] is missing, required by optional_conf_parm["map_value"].',
|
---|
9573 | "conf param mode invalid": 'The optional_conf_parm["mode"] parameter is a invalid number.' + " Gave __given__" + ", expected one of the following numbers: __allowed__.",
|
---|
9574 | "conf param unkown type": 'The optional_conf_parm["__key__"] parameter is of unknown type.' + " Given __given__" + ", expected __expected__.",
|
---|
9575 | "library bug": 'An error occurred during evaluation of the value "__value__".' + " Please file a bug report or pull request: __url__.__message__",
|
---|
9576 | "library bug PR only": 'An error occurred during evaluation of the value "__value__".' + " Please submit a pull request: __url__.__message__",
|
---|
9577 | "use multi": 'You have used __count__ __part2__ Rules can be separated by ";".',
|
---|
9578 | "selector multi 2a": "__what__ in one rule. You may only use one in one rule.",
|
---|
9579 | "selector multi 2b": "not connected __what__ in one rule. This is probably an error." + " Equal selector types can (and should) always be written in conjunction separated by comma." + ' Example for time ranges "12:00-13:00,15:00-18:00".' + ' Example for weekdays "Mo-We,Fr".',
|
---|
9580 | "selector state": "state keywords",
|
---|
9581 | comments: "comments",
|
---|
9582 | "holiday ranges": "holiday ranges",
|
---|
9583 | months: "months",
|
---|
9584 | weekdays: "weekdays",
|
---|
9585 | ranges: "ranges",
|
---|
9586 | "default state": "This rule which changes the default state (which is closed) for all following rules is not the first rule." + " The rule will overwrite all previous rules." + " It can be legitimate to change the default state to open for example" + " and then only specify for which times the facility is closed.",
|
---|
9587 | vague: "This rule is not very explicit because there is no time selector being used." + " Please add a time selector to this rule or use a comment to make it more explicit.",
|
---|
9588 | "empty comment": "You have used an empty comment." + " Please either write something in the comment or use the keyword unknown instead.",
|
---|
9589 | separator_for_readability: "You have used the optional symbol <separator_for_readability> in the wrong place." + " Please check the syntax specification to see where it could be used or remove it.",
|
---|
9590 | "strange 24/7": 'You used 24/7 in a way that is probably not interpreted as "24 hours 7 days a week".' + ' For correctness you might want to use "open" or "closed"' + " for this rule and then write your exceptions which should achieve the same goal and is more clear" + ' e.g. "open; Mo 12:00-14:00 off".',
|
---|
9591 | "public holiday": "There was no PH (public holiday) specified. This is not very explicit.__part2__" + ' Please either append a "PH off" rule if the amenity is closed on all public holidays' + ' or use something like "Sa,Su,PH 12:00-16:00" to say that on Saturdays, Sundays and on public holidays the amenity is open 12:00-16:00.' + ' If the amenity is open everyday including public holidays then you can make this explicit by writing "Mo-Su,PH".' + " If you are not certain try to find it out. If you can’t then do not add PH to the value and ignore this warning.",
|
---|
9592 | "public holiday part2": ' Unfortunately the tag key (e.g. "opening_hours", or "lit") is unknown to opening_hours.js. ' + "This warning only applies to the key __keys__. If your value is for that key than read on. If not you can ignore the following.",
|
---|
9593 | switched: 'The selector "__first__" was switched with' + ' the selector "__second__"' + " for readablitity and compatibiltity reasons.",
|
---|
9594 | "no colon after": 'Please don’t use ":" after __token__.',
|
---|
9595 | "number -5 to 5": "Number between -5 and 5 (except 0) expected.",
|
---|
9596 | "one weekday constraint": "You can not use more than one constrained weekday in a month range",
|
---|
9597 | "range constrained weekdays": "You can not use a range of constrained weekdays in a month range",
|
---|
9598 | expected: '"__symbol__" expected.',
|
---|
9599 | "range zero": "You can not use __type__ ranges with period equals zero.",
|
---|
9600 | "period one year+": "Please don’t use __type__ ranges with period equals one." + ' If you want to express that a facility is open starting from a year without limit use "<year>+".',
|
---|
9601 | "period one": "Please don’t use __type__ ranges with period equals one.",
|
---|
9602 | "month 31": "The day for __month__ must be between 1 and 31.",
|
---|
9603 | "month 30": "Month __month__ doesn't have 31 days. The last day of __month__ is day 30.",
|
---|
9604 | "month feb": "Month __month__ either has 28 or 29 days (leap years).",
|
---|
9605 | "point in time": "hyphen (-) or open end (+) in time range __calc__expected." + " For working with points in time, the mode for __libraryname__ has to be altered." + " Maybe wrong tag?",
|
---|
9606 | calculation: "calculation",
|
---|
9607 | "time range continue": "Time range does not continue as expected",
|
---|
9608 | "period continue": 'Time period does not continue as expected. Example "/01:30".',
|
---|
9609 | "time range mode": '__libraryname__ is running in "time range mode". Found point in time.',
|
---|
9610 | "point in time mode": '__libraryname__ is running in "points in time mode". Found time range.',
|
---|
9611 | "outside current day": "Time range starts outside of the current day",
|
---|
9612 | "two midnights": "Time spanning more than two midnights not supported",
|
---|
9613 | "without minutes": "Time range without minutes specified. Not very explicit!" + ' Please use this syntax instead "__syntax__".',
|
---|
9614 | "outside day": "Time range starts outside of the current day",
|
---|
9615 | "zero calculation": "Adding zero in a variable time calculation does not change the variable time." + ' Please omit the calculation (example: "sunrise-(sunset-00:00)").',
|
---|
9616 | "calculation syntax": "Calculation with variable time is not in the right syntax",
|
---|
9617 | missing: 'Missing "__symbol__"',
|
---|
9618 | "(time)": "(time)",
|
---|
9619 | "bad range": "Bad range: __from__-__to__",
|
---|
9620 | "] or more numbers": '"]" or more numbers expected.',
|
---|
9621 | "additional rule no sense": 'An additional rule does not make sense here. Just use a ";" as rule separator.' + " See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator",
|
---|
9622 | "unexpected token weekday range": "Unexpected token in weekday range: __token__",
|
---|
9623 | "max differ": "There should be no reason to differ more than __maxdiffer__ days from a __name__. If so tell us …",
|
---|
9624 | "adding 0": "Adding 0 does not change the date. Please omit this.",
|
---|
9625 | "unexpected token holiday": "Unexpected token (holiday parser): __token__",
|
---|
9626 | "no holiday definition": "There are no holidays (__name__) defined for country __cc__.",
|
---|
9627 | "no holiday definition state": "There are no holidays (__name__) defined for country __cc__ and state __state__.",
|
---|
9628 | "no country code": "Country code missing which is needed to select the correct holidays (see README how to provide it)",
|
---|
9629 | "movable no formula": "Movable day __name__ can not not be calculated." + " Please add the formula how to calculate it.",
|
---|
9630 | "movable not in year": "The movable day __name__ plus __days__" + " days is not in the year of the movable day anymore. Currently not supported.",
|
---|
9631 | "year range one year": "A year range in which the start year is equal to the end year does not make sense." + ' Please remove the end year. E.g. "__year__ May 23"',
|
---|
9632 | "year range reverse": "A year range in which the start year is greater than the end year does not make sense." + " Please turn it over.",
|
---|
9633 | "year past": "The year is in the past.",
|
---|
9634 | "unexpected token year range": "Unexpected token in year range: __token__",
|
---|
9635 | "week range reverse": "You have specified a week range in reverse order or leaping over a year. This is (currently) not supported.",
|
---|
9636 | "week negative": "You have specified a week date less then one. A valid week date range is 1-53.",
|
---|
9637 | "week exceed": "You have specified a week date greater then 53. A valid week date range is 1-53.",
|
---|
9638 | "week period less than 2": "You have specified a week period which is less than two." + ' If you want to select the whole range from week __weekfrom__ to week __weekto__ then just omit the "/__period__".',
|
---|
9639 | "week period greater than 26": "You have specified a week period which is greater than 26." + " 26.5 is the half of the maximum 53 week dates per year so a week date period greater than 26 would only apply once per year." + ' Please specify the week selector as "week __weekfrom__" if that is what you want to express.',
|
---|
9640 | "unexpected token week range": "Unexpected token in week range: __token__",
|
---|
9641 | "unexpected token month range": "Unexpected token in month range: __token__",
|
---|
9642 | "day range reverse": "Range in wrong order. From day is greater than to day.",
|
---|
9643 | "open end": "Specified as open end. Closing time was guessed.",
|
---|
9644 | "date parameter needed": "Date parameter needed."
|
---|
9645 | };
|
---|
9646 | if (typeof exports === "object") {
|
---|
9647 | var moment, SunCalc, i18n;
|
---|
9648 | SunCalc = root.SunCalc || require("suncalc");
|
---|
9649 | try {
|
---|
9650 | moment = root.moment || require("moment")
|
---|
9651 | } catch (error_pass) {
|
---|
9652 | error_pass
|
---|
9653 | }
|
---|
9654 | try {
|
---|
9655 | i18n = require("./locales/core")
|
---|
9656 | } catch (error_pass) {
|
---|
9657 | error_pass
|
---|
9658 | }
|
---|
9659 | module.exports = factory(SunCalc, moment, i18n, holiday_definitions, word_error_correction, lang)
|
---|
9660 | } else if (typeof define === "function" && define.amd) {
|
---|
9661 | define(["suncalc", "moment", "./locales/core"], function (SunCalc, moment, i18n) {
|
---|
9662 | root.opening_hours = factory(SunCalc, moment, i18n, holiday_definitions, word_error_correction, lang);
|
---|
9663 | return root.opening_hours
|
---|
9664 | })
|
---|
9665 | } else {
|
---|
9666 | root.opening_hours = factory(root.SunCalc, root.moment, root.i18n, holiday_definitions, word_error_correction, lang)
|
---|
9667 | }
|
---|
9668 | })(this, function (SunCalc, moment, i18n, holiday_definitions, word_error_correction, lang) {
|
---|
9669 | return function (value, nominatim_object, optional_conf_parm) {
|
---|
9670 | var word_value_replacement = {
|
---|
9671 | dawn: 60 * 5 + 30,
|
---|
9672 | sunrise: 60 * 6,
|
---|
9673 | sunset: 60 * 18,
|
---|
9674 | dusk: 60 * 18 + 30
|
---|
9675 | };
|
---|
9676 | var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
---|
9677 | var weekdays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
---|
9678 | var default_prettify_conf = {
|
---|
9679 | zero_pad_hour: true,
|
---|
9680 | one_zero_if_hour_zero: false,
|
---|
9681 | leave_off_closed: true,
|
---|
9682 | keyword_for_off_closed: "off",
|
---|
9683 | rule_sep_string: " ",
|
---|
9684 | print_semicolon: true,
|
---|
9685 | leave_weekday_sep_one_day_betw: true,
|
---|
9686 | sep_one_day_between: ",",
|
---|
9687 | zero_pad_month_and_week_numbers: true,
|
---|
9688 | locale: "en"
|
---|
9689 | };
|
---|
9690 | var osm_tag_defaults = {
|
---|
9691 | opening_hours: {
|
---|
9692 | mode: 0,
|
---|
9693 | warn_for_PH_missing: true
|
---|
9694 | },
|
---|
9695 | collection_times: {
|
---|
9696 | mode: 2
|
---|
9697 | },
|
---|
9698 | "opening_hours:.+": {
|
---|
9699 | mode: 0
|
---|
9700 | },
|
---|
9701 | ".+:opening_hours": {
|
---|
9702 | mode: 0
|
---|
9703 | },
|
---|
9704 | ".+:opening_hours:.+": {
|
---|
9705 | mode: 0
|
---|
9706 | },
|
---|
9707 | smoking_hours: {
|
---|
9708 | mode: 0
|
---|
9709 | },
|
---|
9710 | service_times: {
|
---|
9711 | mode: 2
|
---|
9712 | },
|
---|
9713 | happy_hours: {
|
---|
9714 | mode: 0
|
---|
9715 | },
|
---|
9716 | lit: {
|
---|
9717 | mode: 0,
|
---|
9718 | map: {
|
---|
9719 | yes: 'sunset-sunrise open "specified as yes: At night (unknown time schedule or daylight detection)"',
|
---|
9720 | automatic: 'unknown "specified as automatic: When someone enters the way the lights are turned on."',
|
---|
9721 | no: 'off "specified as no: There are no lights installed."',
|
---|
9722 | interval: 'unknown "specified as interval"',
|
---|
9723 | limited: 'unknown "specified as limited"'
|
---|
9724 | }
|
---|
9725 | }
|
---|
9726 | };
|
---|
9727 | var minutes_in_day = 60 * 24;
|
---|
9728 | var msec_in_day = 1e3 * 60 * minutes_in_day;
|
---|
9729 | var library_name = "opening_hours.js";
|
---|
9730 | var repository_url = "https://github.com/ypid/" + library_name;
|
---|
9731 | var locale = "en";
|
---|
9732 | if (typeof i18n === "object") {
|
---|
9733 | locale = i18n.lng()
|
---|
9734 | }
|
---|
9735 | var t = function (str, variables) {
|
---|
9736 | if (typeof i18n === "object" && typeof i18n.t === "function" && typeof locale === "string" && ["de"].indexOf(locale) !== -1) {
|
---|
9737 | var global_locale = i18n.lng();
|
---|
9738 | if (global_locale !== locale) {
|
---|
9739 | i18n.setLng(locale)
|
---|
9740 | }
|
---|
9741 | var text = i18n.t("opening_hours:texts." + str, variables);
|
---|
9742 | if (global_locale !== locale) {
|
---|
9743 | i18n.setLng(global_locale)
|
---|
9744 | }
|
---|
9745 | return text
|
---|
9746 | }
|
---|
9747 | var text = lang[str];
|
---|
9748 | if (typeof text === "undefined") {
|
---|
9749 | text = str
|
---|
9750 | }
|
---|
9751 | return text.replace(/__([^_]*)__/g, function (match, c) {
|
---|
9752 | return typeof variables[c] !== "undefined" ? variables[c] : match
|
---|
9753 | })
|
---|
9754 | };
|
---|
9755 | var location_cc, location_state, lat, lon;
|
---|
9756 | if (typeof nominatim_object === "object" && nominatim_object !== null) {
|
---|
9757 | if (typeof nominatim_object.address === "object") {
|
---|
9758 | if (typeof nominatim_object.address.country_code === "string") {
|
---|
9759 | location_cc = nominatim_object.address.country_code
|
---|
9760 | }
|
---|
9761 | if (typeof nominatim_object.address.state === "string") {
|
---|
9762 | location_state = nominatim_object.address.state
|
---|
9763 | } else if (typeof nominatim_object.address.county === "string") {
|
---|
9764 | location_state = nominatim_object.address.county
|
---|
9765 | }
|
---|
9766 | }
|
---|
9767 | if (typeof nominatim_object.lon === "string" && typeof nominatim_object.lat === "string") {
|
---|
9768 | lat = nominatim_object.lat;
|
---|
9769 | lon = nominatim_object.lon
|
---|
9770 | }
|
---|
9771 | } else if (nominatim_object === null) {
|
---|
9772 | location_cc = "de";
|
---|
9773 | location_state = "Baden-Württemberg";
|
---|
9774 | lat = "49.5400039";
|
---|
9775 | lon = "9.7937133"
|
---|
9776 | } else if (typeof nominatim_object !== "undefined") {
|
---|
9777 | throw "The nominatim_object parameter is of unknown type." + " Given " + typeof nominatim_object + ", expected object."
|
---|
9778 | }
|
---|
9779 | var warnings_severity = 4;
|
---|
9780 | var oh_mode;
|
---|
9781 | var oh_map_value = false;
|
---|
9782 | var oh_key, oh_regex_key;
|
---|
9783 | if (typeof optional_conf_parm === "number") {
|
---|
9784 | oh_mode = optional_conf_parm
|
---|
9785 | } else if (typeof optional_conf_parm === "object") {
|
---|
9786 | locale = optional_conf_parm["locale"];
|
---|
9787 | if (checkOptionalConfParm("mode", "number")) {
|
---|
9788 | oh_mode = optional_conf_parm["mode"]
|
---|
9789 | }
|
---|
9790 | if (checkOptionalConfParm("warnings_severity", "number")) {
|
---|
9791 | warnings_severity = optional_conf_parm["warnings_severity"];
|
---|
9792 | if ([0, 1, 2, 3, 4, 5, 6, 7].indexOf(warnings_severity) === -1) {
|
---|
9793 | throw t("warnings severity", {
|
---|
9794 | severity: warnings_severity,
|
---|
9795 | allowed: "[ 0, 1, 2, 3, 4, 5, 6, 7 ]"
|
---|
9796 | })
|
---|
9797 | }
|
---|
9798 | }
|
---|
9799 | if (checkOptionalConfParm("tag_key", "string")) {
|
---|
9800 | oh_key = optional_conf_parm["tag_key"]
|
---|
9801 | }
|
---|
9802 | if (checkOptionalConfParm("map_value", "boolean")) {
|
---|
9803 | oh_map_value = optional_conf_parm.map_value
|
---|
9804 | }
|
---|
9805 | } else if (typeof optional_conf_parm !== "undefined") {
|
---|
9806 | throw t("optional conf parm type", {
|
---|
9807 | given: typeof optional_conf_parm
|
---|
9808 | })
|
---|
9809 | }
|
---|
9810 | if (typeof oh_key === "string") {
|
---|
9811 | oh_regex_key = getRegexKeyForKeyFromOsmDefaults(oh_key);
|
---|
9812 | if (oh_map_value && typeof osm_tag_defaults[oh_regex_key] === "object" && typeof osm_tag_defaults[oh_regex_key]["map"] === "object" && typeof osm_tag_defaults[oh_regex_key]["map"][value] === "string") {
|
---|
9813 | value = osm_tag_defaults[oh_regex_key]["map"][value]
|
---|
9814 | }
|
---|
9815 | } else if (oh_map_value) {
|
---|
9816 | throw t("conf param tag key missing")
|
---|
9817 | }
|
---|
9818 | if (typeof oh_mode === "undefined") {
|
---|
9819 | if (typeof oh_key === "string") {
|
---|
9820 | if (typeof osm_tag_defaults[oh_regex_key]["mode"] === "number") {
|
---|
9821 | oh_mode = osm_tag_defaults[oh_regex_key]["mode"]
|
---|
9822 | } else {
|
---|
9823 | oh_mode = 0
|
---|
9824 | }
|
---|
9825 | } else {
|
---|
9826 | oh_mode = 0
|
---|
9827 | }
|
---|
9828 | } else if ([0, 1, 2].indexOf(oh_mode) === -1) {
|
---|
9829 | throw t("conf param mode invalid", {
|
---|
9830 | given: oh_mode,
|
---|
9831 | allowed: "[ 0, 1, 2 ]"
|
---|
9832 | })
|
---|
9833 | }
|
---|
9834 | if (typeof value !== "string") {
|
---|
9835 | throw t("no string")
|
---|
9836 | }
|
---|
9837 | if (value.match(/^(?:\s*;?\s*)+$/)) {
|
---|
9838 | throw t("nothing")
|
---|
9839 | }
|
---|
9840 | var parsing_warnings = [];
|
---|
9841 | var done_with_warnings = false;
|
---|
9842 | var done_with_selector_reordering = false;
|
---|
9843 | var done_with_selector_reordering_warnings = false;
|
---|
9844 | var tokens = tokenize(value);
|
---|
9845 | var prettified_value = "";
|
---|
9846 | var week_stable = true;
|
---|
9847 | var rules = [];
|
---|
9848 | var new_tokens = [];
|
---|
9849 | for (var nrule = 0; nrule < tokens.length; nrule++) {
|
---|
9850 | if (tokens[nrule][0].length === 0) {
|
---|
9851 | parsing_warnings.push([nrule, -1, t("nothing useful") + (nrule === tokens.length - 1 && nrule > 0 && !tokens[nrule][1] ? " " + t("programmers joke") : "")]);
|
---|
9852 | continue
|
---|
9853 | }
|
---|
9854 | var continue_at = 0;
|
---|
9855 | var next_rule_is_additional = false;
|
---|
9856 | do {
|
---|
9857 | if (continue_at === tokens[nrule][0].length)
|
---|
9858 | break;
|
---|
9859 | var selectors = {
|
---|
9860 | time: [],
|
---|
9861 | wraptime: [],
|
---|
9862 | weekday: [],
|
---|
9863 | holiday: [],
|
---|
9864 | week: [],
|
---|
9865 | month: [],
|
---|
9866 | monthday: [],
|
---|
9867 | year: [],
|
---|
9868 | date: [],
|
---|
9869 | fallback: tokens[nrule][1],
|
---|
9870 | additional: continue_at ? true : false,
|
---|
9871 | meaning: true,
|
---|
9872 | unknown: false,
|
---|
9873 | comment: undefined,
|
---|
9874 | build_from_token_rule: undefined
|
---|
9875 | };
|
---|
9876 | selectors.build_from_token_rule = [nrule, continue_at, new_tokens.length];
|
---|
9877 | continue_at = parseGroup(tokens[nrule][0], continue_at, selectors, nrule);
|
---|
9878 | if (typeof continue_at === "object") {
|
---|
9879 | continue_at = continue_at[0]
|
---|
9880 | } else {
|
---|
9881 | continue_at = 0
|
---|
9882 | }
|
---|
9883 | new_tokens.push([tokens[nrule][0].slice(selectors.build_from_token_rule[1], continue_at === 0 ? tokens[nrule][0].length : continue_at), tokens[nrule][1], tokens[nrule][2]]);
|
---|
9884 | if (next_rule_is_additional && new_tokens.length > 1) {
|
---|
9885 | new_tokens[new_tokens.length - 1][0].unshift(new_tokens[new_tokens.length - 2][0].pop())
|
---|
9886 | }
|
---|
9887 | next_rule_is_additional = continue_at === 0 ? false : true;
|
---|
9888 | var selector_elements = ["year", "holiday", "month", "monthday", "week", "weekday"];
|
---|
9889 | for (var selector_ind in selector_elements) {
|
---|
9890 | if (selectors[selector_elements[selector_ind]].length > 0) {
|
---|
9891 | selectors.date.push(selectors[selector_elements[selector_ind]]);
|
---|
9892 | selectors[selector_elements[selector_ind]] = []
|
---|
9893 | }
|
---|
9894 | }
|
---|
9895 | rules.push(selectors);
|
---|
9896 | if (selectors.wraptime.length > 0) {
|
---|
9897 | var wrapselectors = {
|
---|
9898 | time: selectors.wraptime,
|
---|
9899 | date: [],
|
---|
9900 | meaning: selectors.meaning,
|
---|
9901 | unknown: selectors.unknown,
|
---|
9902 | comment: selectors.comment,
|
---|
9903 | wrapped: true,
|
---|
9904 | build_from_token_rule: selectors.build_from_token_rule
|
---|
9905 | };
|
---|
9906 | for (var dselg = 0; dselg < selectors.date.length; dselg++) {
|
---|
9907 | wrapselectors.date.push([]);
|
---|
9908 | for (var dsel = 0; dsel < selectors.date[dselg].length; dsel++) {
|
---|
9909 | wrapselectors.date[wrapselectors.date.length - 1].push(generateDateShifter(selectors.date[dselg][dsel], -msec_in_day))
|
---|
9910 | }
|
---|
9911 | }
|
---|
9912 | rules.push(wrapselectors)
|
---|
9913 | }
|
---|
9914 | } while (continue_at)
|
---|
9915 | }
|
---|
9916 |
|
---|
9917 | function getRegexKeyForKeyFromOsmDefaults(key) {
|
---|
9918 | var regex_key;
|
---|
9919 | for (var osm_key in osm_tag_defaults) {
|
---|
9920 | if (key === osm_key) {
|
---|
9921 | regex_key = osm_key;
|
---|
9922 | break
|
---|
9923 | } else if (key.match(osm_key)) {
|
---|
9924 | regex_key = osm_key
|
---|
9925 | }
|
---|
9926 | }
|
---|
9927 | return regex_key
|
---|
9928 | }
|
---|
9929 |
|
---|
9930 | function checkOptionalConfParm(key, expected_type) {
|
---|
9931 | if (typeof optional_conf_parm[key] === expected_type) {
|
---|
9932 | return true
|
---|
9933 | } else if (typeof optional_conf_parm[key] !== "undefined") {
|
---|
9934 | throw t("conf param unkown type", {
|
---|
9935 | key: key,
|
---|
9936 | given: typeof optional_conf_parm[key],
|
---|
9937 | expected: expected_type
|
---|
9938 | })
|
---|
9939 | }
|
---|
9940 | return false
|
---|
9941 | }
|
---|
9942 |
|
---|
9943 | function formatWarnErrorMessage(nrule, at, message) {
|
---|
9944 | if (typeof nrule === "number") {
|
---|
9945 | var pos = 0;
|
---|
9946 | if (nrule === -1) {
|
---|
9947 | pos = value.length - at
|
---|
9948 | } else {
|
---|
9949 | if (typeof tokens[nrule][0][at] === "undefined") {
|
---|
9950 | if (typeof tokens[nrule][0] && at === -1) {
|
---|
9951 | pos = value.length;
|
---|
9952 | if (typeof tokens[nrule + 1] === "object" && typeof tokens[nrule + 1][2] === "number") {
|
---|
9953 | pos -= tokens[nrule + 1][2]
|
---|
9954 | } else if (typeof tokens[nrule][2] === "number") {
|
---|
9955 | pos -= tokens[nrule][2]
|
---|
9956 | }
|
---|
9957 | } else {
|
---|
9958 | formatLibraryBugMessage("Bug in warning generation code which could not determine the exact position of the warning or error in value.");
|
---|
9959 | pos = value.length;
|
---|
9960 | if (typeof tokens[nrule][2] === "number") {
|
---|
9961 | pos -= tokens[nrule][2];
|
---|
9962 | console.warn("Last token for rule: " + tokens[nrule]);
|
---|
9963 | console.log(value.substring(0, pos) + " <--- (" + message + ")");
|
---|
9964 | console.log("\n")
|
---|
9965 | }
|
---|
9966 | {
|
---|
9967 | console.warn("tokens[nrule][2] is undefined. This is ok if nrule is the last rule.")
|
---|
9968 | }
|
---|
9969 | }
|
---|
9970 | } else {
|
---|
9971 | pos = value.length;
|
---|
9972 | if (typeof tokens[nrule][0][at + 1] === "object") {
|
---|
9973 | pos -= tokens[nrule][0][at + 1][2]
|
---|
9974 | } else if (typeof tokens[nrule][2] === "number") {
|
---|
9975 | pos -= tokens[nrule][2]
|
---|
9976 | }
|
---|
9977 | }
|
---|
9978 | }
|
---|
9979 | return value.substring(0, pos) + " <--- (" + message + ")"
|
---|
9980 | } else if (typeof nrule === "string") {
|
---|
9981 | return nrule.substring(0, at) + " <--- (" + message + ")"
|
---|
9982 | }
|
---|
9983 | }
|
---|
9984 |
|
---|
9985 | function formatLibraryBugMessage(message, text_template) {
|
---|
9986 | if (typeof message === "undefined") {
|
---|
9987 | message = ""
|
---|
9988 | } else {
|
---|
9989 | message = " " + message
|
---|
9990 | }
|
---|
9991 | if (typeof text_template !== "string") {
|
---|
9992 | text_template = "library bug"
|
---|
9993 | }
|
---|
9994 | message = t(text_template, {
|
---|
9995 | value: value,
|
---|
9996 | url: repository_url,
|
---|
9997 | message: message
|
---|
9998 | });
|
---|
9999 | console.error(message);
|
---|
10000 | return message
|
---|
10001 | }
|
---|
10002 |
|
---|
10003 | function tokenize(value) {
|
---|
10004 | var all_tokens = [];
|
---|
10005 | var curr_rule_tokens = [];
|
---|
10006 | var last_rule_fallback_terminated = false;
|
---|
10007 | while (value !== "") {
|
---|
10008 | var tmp;
|
---|
10009 | if (tmp = value.match(/^week\b/i)) {
|
---|
10010 | curr_rule_tokens.push([tmp[0].toLowerCase(), tmp[0].toLowerCase(), value.length]);
|
---|
10011 | value = value.substr(tmp[0].length)
|
---|
10012 | } else if (tmp = value.match(/^(?:off|closed|open|unknown)\b/i)) {
|
---|
10013 | curr_rule_tokens.push([tmp[0].toLowerCase(), "state", value.length]);
|
---|
10014 | value = value.substr(tmp[0].length)
|
---|
10015 | } else if (tmp = value.match(/^24\/7/i)) {
|
---|
10016 | curr_rule_tokens.push([tmp[0], tmp[0], value.length]);
|
---|
10017 | value = value.substr(tmp[0].length)
|
---|
10018 | } else if (tmp = value.match(/^(?:PH|SH)/i)) {
|
---|
10019 | curr_rule_tokens.push([tmp[0].toUpperCase(), "holiday", value.length]);
|
---|
10020 | value = value.substr(2)
|
---|
10021 | } else if (tmp = value.match(/^(&|_|→|–|−|—|ー|=|·|öffnungszeit(?:en)?:?|opening_hours\s*=|\?|~|~|:|°°|always (?:open|closed)|24x7|24 hours 7 days a week|24 hours|7 ?days(?:(?: a |\/)week)?|7j?\/7|all days?|every day|(:?bis|till?|-|–)? ?(?:open ?end|late)|(?:(?:one )?day (?:before|after) )?(?:school|public) holidays?|days?\b|до|рм|ам|jours fériés|on work days?|sonntags?|(?:nur |an )?sonn-?(?:(?: und |\/)feiertag(?:s|en?)?)?|(?:an )?feiertag(?:s|en?)?|(?:nach|on|by) (?:appointments?|vereinbarung|absprache)|p\.m\.|a\.m\.|[_a-zäößàáéøčěíúýřПнВсо]+\b|à|á|mo|tu|we|th|fr|sa|su|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\.?/i)) {
|
---|
10022 | var correct_val = returnCorrectWordOrToken(tmp[1].toLowerCase(), value.length);
|
---|
10023 | if (typeof correct_val === "object") {
|
---|
10024 | curr_rule_tokens.push([correct_val[0], correct_val[1], value.length]);
|
---|
10025 | value = value.substr(tmp[0].length)
|
---|
10026 | } else if (typeof correct_val === "string") {
|
---|
10027 | if (tmp[1].toLowerCase() === "a.m.") {
|
---|
10028 | tmp[1] = "am"
|
---|
10029 | }
|
---|
10030 | if (tmp[1].toLowerCase() === "p.m.") {
|
---|
10031 | tmp[1] = "pm"
|
---|
10032 | }
|
---|
10033 | if (tmp[1].toLowerCase() === "am" || tmp[1].toLowerCase() === "pm") {
|
---|
10034 | var hours_token_at = curr_rule_tokens.length - 1;
|
---|
10035 | var hours_token;
|
---|
10036 | if (hours_token_at >= 0) {
|
---|
10037 | if (hours_token_at - 2 >= 0 && matchTokens(curr_rule_tokens, hours_token_at - 2, "number", "timesep", "number")) {
|
---|
10038 | hours_token_at -= 2;
|
---|
10039 | hours_token = curr_rule_tokens[hours_token_at]
|
---|
10040 | } else if (matchTokens(curr_rule_tokens, hours_token_at, "number")) {
|
---|
10041 | hours_token = curr_rule_tokens[hours_token_at]
|
---|
10042 | }
|
---|
10043 | if (typeof hours_token === "object") {
|
---|
10044 | if (tmp[1].toLowerCase() === "pm" && hours_token[0] < 12) {
|
---|
10045 | hours_token[0] += 12
|
---|
10046 | }
|
---|
10047 | if (tmp[1].toLowerCase() === "am" && hours_token[0] === 12) {
|
---|
10048 | hours_token[0] = 0
|
---|
10049 | }
|
---|
10050 | curr_rule_tokens[hours_token_at] = hours_token
|
---|
10051 | }
|
---|
10052 | }
|
---|
10053 | }
|
---|
10054 | var correct_tokens = tokenize(correct_val)[0];
|
---|
10055 | if (correct_tokens[1] === true) {
|
---|
10056 | throw formatLibraryBugMessage()
|
---|
10057 | }
|
---|
10058 | for (var i = 0; i < correct_tokens[0].length; i++) {
|
---|
10059 | curr_rule_tokens.push([correct_tokens[0][i][0], correct_tokens[0][i][1], value.length])
|
---|
10060 | }
|
---|
10061 | value = value.substr(tmp[0].length)
|
---|
10062 | } else {
|
---|
10063 | curr_rule_tokens.push([value[0].toLowerCase(), value[0].toLowerCase(), value.length - 1]);
|
---|
10064 | value = value.substr(1)
|
---|
10065 | }
|
---|
10066 | } else if (tmp = value.match(/^\d+/)) {
|
---|
10067 | if (Number(tmp[0]) > 1900) {
|
---|
10068 | curr_rule_tokens.push([Number(tmp[0]), "year", value.length]);
|
---|
10069 | if (Number(tmp[0]) >= 2100)
|
---|
10070 | parsing_warnings.push([-1, value.length - 1, t("interpreted as year", {
|
---|
10071 | number: Number(tmp[0])
|
---|
10072 | })])
|
---|
10073 | } else {
|
---|
10074 | curr_rule_tokens.push([Number(tmp[0]), "number", value.length])
|
---|
10075 | }
|
---|
10076 | value = value.substr(tmp[0].length)
|
---|
10077 | } else if (tmp = value.match(/^"([^"]+)"/)) {
|
---|
10078 | curr_rule_tokens.push([tmp[1], "comment", value.length]);
|
---|
10079 | value = value.substr(tmp[0].length)
|
---|
10080 | } else if (tmp = value.match(/^(["'„“‚‘’«「『])([^"'“”‘’»」』;|]*)(["'”“‘’»」』])/)) {
|
---|
10081 | for (var pos = 1; pos <= 3; pos += 2) {
|
---|
10082 | var correct_val = returnCorrectWordOrToken(tmp[pos], value.length - (pos === 3 ? tmp[1].length + tmp[2].length : 0));
|
---|
10083 | if (typeof correct_val !== "string" && tmp[pos] !== '"') {
|
---|
10084 | throw formatLibraryBugMessage("A character for error tolerance was allowed in the regular expression" + " but is not covered by word_error_correction" + " which is needed to format a proper message for the user.")
|
---|
10085 | }
|
---|
10086 | }
|
---|
10087 | curr_rule_tokens.push([tmp[2], "comment", value.length]);
|
---|
10088 | value = value.substr(tmp[0].length)
|
---|
10089 | } else if (value.match(/^;/)) {
|
---|
10090 | all_tokens.push([curr_rule_tokens, last_rule_fallback_terminated, value.length]);
|
---|
10091 | value = value.substr(1);
|
---|
10092 | curr_rule_tokens = [];
|
---|
10093 | last_rule_fallback_terminated = false
|
---|
10094 | } else if (value.match(/^\|\|/)) {
|
---|
10095 | if (curr_rule_tokens.length === 0) {
|
---|
10096 | throw formatWarnErrorMessage(-1, value.length - 2, t("rule before fallback empty"))
|
---|
10097 | }
|
---|
10098 | all_tokens.push([curr_rule_tokens, last_rule_fallback_terminated, value.length]);
|
---|
10099 | curr_rule_tokens = [];
|
---|
10100 | value = value.substr(2);
|
---|
10101 | last_rule_fallback_terminated = true
|
---|
10102 | } else if (value.match(/^(?:␣|\s)/)) {
|
---|
10103 | value = value.substr(1)
|
---|
10104 | } else if (tmp = value.match(/^\s+/)) {
|
---|
10105 | value = value.substr(tmp[0].length)
|
---|
10106 | } else if (value.match(/^[:.]/)) {
|
---|
10107 | if (value[0] === "." && !done_with_warnings) {
|
---|
10108 | parsing_warnings.push([-1, value.length - 1, t("hour min separator")])
|
---|
10109 | }
|
---|
10110 | curr_rule_tokens.push([":", "timesep", value.length]);
|
---|
10111 | value = value.substr(1)
|
---|
10112 | } else {
|
---|
10113 | curr_rule_tokens.push([value[0].toLowerCase(), value[0].toLowerCase(), value.length]);
|
---|
10114 | value = value.substr(1)
|
---|
10115 | }
|
---|
10116 | }
|
---|
10117 | all_tokens.push([curr_rule_tokens, last_rule_fallback_terminated]);
|
---|
10118 | return all_tokens
|
---|
10119 | }
|
---|
10120 |
|
---|
10121 | function returnCorrectWordOrToken(word, value_length) {
|
---|
10122 | for (var token_name in word_error_correction) {
|
---|
10123 | for (var comment in word_error_correction[token_name]) {
|
---|
10124 | for (var old_val in word_error_correction[token_name][comment]) {
|
---|
10125 | if (word.match(new RegExp("^" + old_val + "$"))) {
|
---|
10126 | var val = word_error_correction[token_name][comment][old_val];
|
---|
10127 | if (comment === "default") {
|
---|
10128 | return [val, token_name]
|
---|
10129 | } else if (token_name === "wrong_words" && !done_with_warnings) {
|
---|
10130 | parsing_warnings.push([-1, value_length - word.length, comment.replace(/<ko>/, word).replace(/<ok>/, val)]);
|
---|
10131 | return val
|
---|
10132 | } else {
|
---|
10133 | var correct_abbr;
|
---|
10134 | for (correct_abbr in word_error_correction[token_name]["default"]) {
|
---|
10135 | if (word_error_correction[token_name]["default"][correct_abbr] === val)
|
---|
10136 | break
|
---|
10137 | }
|
---|
10138 | if (typeof correct_abbr === "undefined") {
|
---|
10139 | throw formatLibraryBugMessage("Please also include the stacktrace.")
|
---|
10140 | }
|
---|
10141 | if (token_name !== "timevar") {
|
---|
10142 | correct_abbr = correct_abbr.charAt(0).toUpperCase() + correct_abbr.slice(1)
|
---|
10143 | }
|
---|
10144 | if (!done_with_warnings)
|
---|
10145 | parsing_warnings.push([-1, value_length - word.length, comment.replace(/<ko>/, word).replace(/<ok>/, correct_abbr)]);
|
---|
10146 | return [val, token_name]
|
---|
10147 | }
|
---|
10148 | }
|
---|
10149 | }
|
---|
10150 | }
|
---|
10151 | }
|
---|
10152 | return undefined
|
---|
10153 | }
|
---|
10154 |
|
---|
10155 | function getWarnings(it) {
|
---|
10156 | if (warnings_severity < 4) {
|
---|
10157 | return []
|
---|
10158 | }
|
---|
10159 | if (!done_with_warnings && typeof it === "object") {
|
---|
10160 | var wide_range_selector_order = ["year", "month", "week", "holiday"];
|
---|
10161 | var small_range_selector_order = ["weekday", "time", "24/7", "state", "comment"];
|
---|
10162 | var used_selectors = [];
|
---|
10163 | var used_selectors_types_array = [];
|
---|
10164 | var has_token = {};
|
---|
10165 | for (var nrule = 0; nrule < new_tokens.length; nrule++) {
|
---|
10166 | if (new_tokens[nrule][0].length === 0)
|
---|
10167 | continue;
|
---|
10168 | var selector_start_end_type = [0, 0, undefined];
|
---|
10169 | used_selectors[nrule] = {};
|
---|
10170 | used_selectors_types_array[nrule] = [];
|
---|
10171 | do {
|
---|
10172 | selector_start_end_type = getSelectorRange(new_tokens[nrule][0], selector_start_end_type[1]);
|
---|
10173 | for (var token_pos = 0; token_pos <= selector_start_end_type[1]; token_pos++) {
|
---|
10174 | if (typeof new_tokens[nrule][0][token_pos] === "object" && new_tokens[nrule][0][token_pos][0] === "PH") {
|
---|
10175 | has_token["PH"] = true
|
---|
10176 | }
|
---|
10177 | }
|
---|
10178 | if (selector_start_end_type[0] === selector_start_end_type[1] && new_tokens[nrule][0][selector_start_end_type[0]][0] === "24/7") {
|
---|
10179 | has_token["24/7"] = true
|
---|
10180 | }
|
---|
10181 | if (typeof used_selectors[nrule][selector_start_end_type[2]] !== "object") {
|
---|
10182 | used_selectors[nrule][selector_start_end_type[2]] = [selector_start_end_type[1]]
|
---|
10183 | } else {
|
---|
10184 | used_selectors[nrule][selector_start_end_type[2]].push(selector_start_end_type[1])
|
---|
10185 | }
|
---|
10186 | used_selectors_types_array[nrule].push(selector_start_end_type[2]);
|
---|
10187 | selector_start_end_type[1]++
|
---|
10188 | } while (selector_start_end_type[1] < new_tokens[nrule][0].length)
|
---|
10189 | }
|
---|
10190 | for (var nrule = 0; nrule < used_selectors.length; nrule++) {
|
---|
10191 | for (var selector_type in used_selectors[nrule]) {
|
---|
10192 | if (used_selectors[nrule][selector_type].length > 1) {
|
---|
10193 | parsing_warnings.push([nrule, used_selectors[nrule][selector_type][used_selectors[nrule][selector_type].length - 1], t("use multi", {
|
---|
10194 | count: used_selectors[nrule][selector_type].length,
|
---|
10195 | part2: selector_type.match(/^(?:comment|state)/) ? t("selector multi 2a", {
|
---|
10196 | what: selector_type === "state" ? t("selector state") : t("comments")
|
---|
10197 | }) : t("selector multi 2b", {
|
---|
10198 | what: t(selector_type + (selector_type.match(/^(?:month|weekday)$/) ? "s" : " ranges"))
|
---|
10199 | })
|
---|
10200 | })]);
|
---|
10201 | done_with_selector_reordering = true
|
---|
10202 | }
|
---|
10203 | }
|
---|
10204 | if (typeof used_selectors[nrule].state === "object" && Object.keys(used_selectors[nrule]).length === 1) {
|
---|
10205 | if (nrule !== 0) {
|
---|
10206 | parsing_warnings.push([nrule, new_tokens[nrule][0].length - 1, t("default state")])
|
---|
10207 | }
|
---|
10208 | } else if (typeof used_selectors[nrule].time === "undefined") {
|
---|
10209 | if (typeof used_selectors[nrule].state === "object" && new_tokens[nrule][0][used_selectors[nrule].state[0]][0] === "open" && typeof used_selectors[nrule].comment === "undefined" || typeof used_selectors[nrule].comment === "undefined" && typeof used_selectors[nrule].state === "undefined" && typeof used_selectors[nrule]["24/7"] === "undefined") {
|
---|
10210 | parsing_warnings.push([nrule, new_tokens[nrule][0].length - 1, t("vague")])
|
---|
10211 | }
|
---|
10212 | }
|
---|
10213 | if (typeof used_selectors[nrule].comment === "object" && new_tokens[nrule][0][used_selectors[nrule].comment[0]][0].length === 0) {
|
---|
10214 | parsing_warnings.push([nrule, used_selectors[nrule].comment[0], t("empty comment")])
|
---|
10215 | }
|
---|
10216 | for (var i = 0; i < used_selectors_types_array[nrule].length - 1; i++) {
|
---|
10217 | var selector_type = used_selectors_types_array[nrule][i];
|
---|
10218 | var next_selector_type = used_selectors_types_array[nrule][i + 1];
|
---|
10219 | if (wide_range_selector_order.indexOf(selector_type) !== -1 && wide_range_selector_order.indexOf(next_selector_type) !== -1 || small_range_selector_order.indexOf(selector_type) !== -1 && small_range_selector_order.indexOf(next_selector_type) !== -1) {
|
---|
10220 | if (new_tokens[nrule][0][used_selectors[nrule][selector_type][0]][0] === ":") {
|
---|
10221 | parsing_warnings.push([nrule, used_selectors[nrule][selector_type][0], t("separator_for_readability")])
|
---|
10222 | }
|
---|
10223 | }
|
---|
10224 | }
|
---|
10225 | if (typeof new_tokens[nrule][0][0] === "object" && new_tokens[nrule][0][0][0] === "," && new_tokens[nrule][0][0][1] === "rule separator" && typeof used_selectors[nrule].state === "object" && (new_tokens[nrule][0][used_selectors[nrule].state[0]][0] === "closed" || new_tokens[nrule][0][used_selectors[nrule].state[0]][0] === "off")) {
|
---|
10226 | }
|
---|
10227 | }
|
---|
10228 | var has_advanced = it.advance();
|
---|
10229 | if (has_advanced === true && has_token["24/7"] && !done_with_warnings) {
|
---|
10230 | parsing_warnings.push([-1, 0, t("strange 24/7")])
|
---|
10231 | }
|
---|
10232 | if (warnings_severity >= 5 && !has_token["PH"] && !has_token["24/7"] && !done_with_warnings && (typeof oh_key === "string" && osm_tag_defaults[oh_regex_key]["warn_for_PH_missing"] || typeof oh_key !== "string")) {
|
---|
10233 | var keys_with_warn_for_PH_missing = [];
|
---|
10234 | for (var key in osm_tag_defaults) {
|
---|
10235 | if (osm_tag_defaults[key]["warn_for_PH_missing"]) {
|
---|
10236 | keys_with_warn_for_PH_missing.push(key)
|
---|
10237 | }
|
---|
10238 | }
|
---|
10239 | parsing_warnings.push([-1, 0, t("public holiday", {
|
---|
10240 | part2: typeof oh_key !== "string" ? t("public holiday part2", {
|
---|
10241 | keys: keys_with_warn_for_PH_missing.join(", ")
|
---|
10242 | }) : ""
|
---|
10243 | })])
|
---|
10244 | }
|
---|
10245 | prettifyValue()
|
---|
10246 | }
|
---|
10247 | done_with_warnings = true;
|
---|
10248 | var warnings = [];
|
---|
10249 | for (var i = 0; i < parsing_warnings.length; i++) {
|
---|
10250 | warnings.push(formatWarnErrorMessage(parsing_warnings[i][0], parsing_warnings[i][1], parsing_warnings[i][2]))
|
---|
10251 | }
|
---|
10252 | return warnings
|
---|
10253 | }
|
---|
10254 |
|
---|
10255 | function tokenIsTheBeginOfSelector(tokens, at) {
|
---|
10256 | if (typeof tokens[at][3] === "string") {
|
---|
10257 | return 3
|
---|
10258 | } else if (tokens[at][1] === "comment" || tokens[at][1] === "state" || tokens[at][1] === "24/7" || tokens[at][1] === "rule separator") {
|
---|
10259 | return 1
|
---|
10260 | } else {
|
---|
10261 | return false
|
---|
10262 | }
|
---|
10263 | }
|
---|
10264 |
|
---|
10265 | function getSelectorRange(tokens, at) {
|
---|
10266 | var selector_start = at,
|
---|
10267 | selector_end, pos_in_token_array;
|
---|
10268 | for (; selector_start >= 0; selector_start--) {
|
---|
10269 | pos_in_token_array = tokenIsTheBeginOfSelector(tokens, selector_start);
|
---|
10270 | if (pos_in_token_array)
|
---|
10271 | break
|
---|
10272 | }
|
---|
10273 | selector_end = selector_start;
|
---|
10274 | if (pos_in_token_array === 1) {
|
---|
10275 | if (selector_end + 1 < tokens.length && tokens[selector_end + 1][0] === ":")
|
---|
10276 | selector_end++;
|
---|
10277 | return [selector_start, selector_end, tokens[selector_start][pos_in_token_array]]
|
---|
10278 | }
|
---|
10279 | for (selector_end++; selector_end < tokens.length; selector_end++) {
|
---|
10280 | if (tokenIsTheBeginOfSelector(tokens, selector_end))
|
---|
10281 | return [selector_start, selector_end - 1, tokens[selector_start][pos_in_token_array]]
|
---|
10282 | }
|
---|
10283 | return [selector_start, selector_end - 1, tokens[selector_start][pos_in_token_array]]
|
---|
10284 | }
|
---|
10285 |
|
---|
10286 | function prettifyValue(argument_hash) {
|
---|
10287 | var user_conf = {};
|
---|
10288 | var get_internals = false;
|
---|
10289 | var rule_index;
|
---|
10290 | prettified_value = "";
|
---|
10291 | var prettified_value_array = [];
|
---|
10292 | if (typeof argument_hash === "object") {
|
---|
10293 | if (typeof argument_hash.conf === "object") {
|
---|
10294 | user_conf = argument_hash.conf
|
---|
10295 | }
|
---|
10296 | if (typeof argument_hash.rule_index === "number") {
|
---|
10297 | rule_index = argument_hash.rule_index
|
---|
10298 | }
|
---|
10299 | if (argument_hash.get_internals === true) {
|
---|
10300 | get_internals = true
|
---|
10301 | }
|
---|
10302 | }
|
---|
10303 | for (var key in default_prettify_conf) {
|
---|
10304 | if (typeof user_conf[key] === "undefined") {
|
---|
10305 | user_conf[key] = default_prettify_conf[key]
|
---|
10306 | }
|
---|
10307 | }
|
---|
10308 | if (typeof moment !== "undefined" && typeof user_conf["locale"] === "string" && user_conf["locale"] !== "en") {
|
---|
10309 | var global_locale = moment.locale();
|
---|
10310 | moment.locale("en");
|
---|
10311 | var weekdays_en = moment.weekdaysMin();
|
---|
10312 | var months_en = moment.months().map(function (month) {
|
---|
10313 | return month.substr(0, 3)
|
---|
10314 | });
|
---|
10315 | moment.locale(user_conf["locale"]);
|
---|
10316 | var weekdays_local = moment.weekdaysMin();
|
---|
10317 | var months_local = moment.months().map(function (month) {
|
---|
10318 | return month.substr(0, 3)
|
---|
10319 | });
|
---|
10320 | moment.locale(global_locale)
|
---|
10321 | }
|
---|
10322 | for (var nrule = 0; nrule < new_tokens.length; nrule++) {
|
---|
10323 | if (new_tokens[nrule][0].length === 0)
|
---|
10324 | continue;
|
---|
10325 | if (typeof rule_index === "number") {
|
---|
10326 | if (rule_index !== nrule)
|
---|
10327 | continue
|
---|
10328 | } else {
|
---|
10329 | if (nrule !== 0)
|
---|
10330 | prettified_value += new_tokens[nrule][1] ? user_conf.rule_sep_string + "|| " : (new_tokens[nrule][0][0][1] === "rule separator" ? "," : user_conf.print_semicolon ? ";" : "") + user_conf.rule_sep_string
|
---|
10331 | }
|
---|
10332 | var selector_start_end_type = [0, 0, undefined];
|
---|
10333 | var prettified_group_value = [];
|
---|
10334 | var count = 0;
|
---|
10335 | do {
|
---|
10336 | selector_start_end_type = getSelectorRange(new_tokens[nrule][0], selector_start_end_type[1]);
|
---|
10337 | if (count > 50) {
|
---|
10338 | throw formatLibraryBugMessage("Infinite loop.")
|
---|
10339 | }
|
---|
10340 | if (selector_start_end_type[2] !== "rule separator") {
|
---|
10341 | prettified_group_value.push([selector_start_end_type, prettifySelector(new_tokens[nrule][0], selector_start_end_type[0], selector_start_end_type[1], selector_start_end_type[2], user_conf)])
|
---|
10342 | }
|
---|
10343 | selector_start_end_type[1]++;
|
---|
10344 | count++
|
---|
10345 | } while (selector_start_end_type[1] < new_tokens[nrule][0].length);
|
---|
10346 | var not_sorted_prettified_group_value = prettified_group_value.slice();
|
---|
10347 | if (!done_with_selector_reordering) {
|
---|
10348 | prettified_group_value.sort(function (a, b) {
|
---|
10349 | var selector_order = ["year", "month", "week", "holiday", "weekday", "time", "24/7", "state", "comment"];
|
---|
10350 | return selector_order.indexOf(a[0][2]) - selector_order.indexOf(b[0][2])
|
---|
10351 | })
|
---|
10352 | }
|
---|
10353 | var old_prettified_value_length = prettified_value.length;
|
---|
10354 | if (typeof user_conf["locale"] === "string" && user_conf["locale"] !== "en") {
|
---|
10355 | var global_locale = i18n.lng();
|
---|
10356 | if (global_locale !== user_conf["locale"]) {
|
---|
10357 | i18n.setLng(user_conf["locale"])
|
---|
10358 | }
|
---|
10359 | for (var i = 0; i < prettified_group_value.length; i++) {
|
---|
10360 | var type = prettified_group_value[i][0][2];
|
---|
10361 | if (type === "weekday") {
|
---|
10362 | for (var key in weekdays_en) {
|
---|
10363 | prettified_group_value[i][1] = prettified_group_value[i][1].replace(new RegExp(weekdays_en[key], "g"), weekdays_local[key])
|
---|
10364 | }
|
---|
10365 | } else if (type === "month") {
|
---|
10366 | for (var key in months_en) {
|
---|
10367 | prettified_group_value[i][1] = prettified_group_value[i][1].replace(new RegExp(months_en[key], "g"), months_local[key])
|
---|
10368 | }
|
---|
10369 | } else {
|
---|
10370 | prettified_group_value[i][1] = i18n.t(["opening_hours:pretty." + prettified_group_value[i][1], prettified_group_value[i][1]])
|
---|
10371 | }
|
---|
10372 | }
|
---|
10373 | if (global_locale !== locale) {
|
---|
10374 | i18n.setLng(global_locale)
|
---|
10375 | }
|
---|
10376 | }
|
---|
10377 | prettified_value += prettified_group_value.map(function (array) {
|
---|
10378 | return array[1]
|
---|
10379 | }).join(" ");
|
---|
10380 | prettified_value_array.push(prettified_group_value);
|
---|
10381 | if (!done_with_selector_reordering_warnings) {
|
---|
10382 | for (var i = 0, l = not_sorted_prettified_group_value.length; i < l; i++) {
|
---|
10383 | if (not_sorted_prettified_group_value[i] !== prettified_group_value[i]) {
|
---|
10384 | var length = i + old_prettified_value_length;
|
---|
10385 | for (var x = 0; x <= i; x++) {
|
---|
10386 | length += prettified_group_value[x][1].length
|
---|
10387 | }
|
---|
10388 | parsing_warnings.push([prettified_value, length, t("switched", {
|
---|
10389 | first: prettified_group_value[i][0][2],
|
---|
10390 | second: not_sorted_prettified_group_value[i][0][2]
|
---|
10391 | })])
|
---|
10392 | }
|
---|
10393 | }
|
---|
10394 | }
|
---|
10395 | }
|
---|
10396 | done_with_selector_reordering_warnings = true;
|
---|
10397 | if (get_internals) {
|
---|
10398 | return [prettified_value_array, new_tokens]
|
---|
10399 | } else {
|
---|
10400 | return prettified_value
|
---|
10401 | }
|
---|
10402 | }
|
---|
10403 |
|
---|
10404 | function matchTokens(tokens, at) {
|
---|
10405 | if (at + arguments.length - 2 > tokens.length)
|
---|
10406 | return false;
|
---|
10407 | for (var i = 0; i < arguments.length - 2; i++) {
|
---|
10408 | if (tokens[at + i][1] !== arguments[i + 2])
|
---|
10409 | return false
|
---|
10410 | }
|
---|
10411 | return true
|
---|
10412 | }
|
---|
10413 |
|
---|
10414 | function generateDateShifter(func, shift) {
|
---|
10415 | return function (date) {
|
---|
10416 | var res = func(new Date(date.getTime() + shift));
|
---|
10417 | if (typeof res[1] === "undefined")
|
---|
10418 | return res;
|
---|
10419 | return [res[0], new Date(res[1].getTime() - shift)]
|
---|
10420 | }
|
---|
10421 | }
|
---|
10422 |
|
---|
10423 | function parseGroup(tokens, at, selectors, nrule) {
|
---|
10424 | var rule_modifier_specified = false;
|
---|
10425 | var last_selector = [];
|
---|
10426 | while (at < tokens.length) {
|
---|
10427 | if (matchTokens(tokens, at, "weekday")) {
|
---|
10428 | at = parseWeekdayRange(tokens, at, selectors)
|
---|
10429 | } else if (matchTokens(tokens, at, "24/7")) {
|
---|
10430 | selectors.time.push(function () {
|
---|
10431 | return [true]
|
---|
10432 | });
|
---|
10433 | at++
|
---|
10434 | } else if (matchTokens(tokens, at, "holiday")) {
|
---|
10435 | if (matchTokens(tokens, at + 1, ",")) {
|
---|
10436 | at = parseHoliday(tokens, at, selectors, true)
|
---|
10437 | } else {
|
---|
10438 | at = parseHoliday(tokens, at, selectors, false)
|
---|
10439 | }
|
---|
10440 | week_stable = false
|
---|
10441 | } else if (matchTokens(tokens, at, "month", "number") || matchTokens(tokens, at, "month", "weekday") || matchTokens(tokens, at, "year", "month", "number") || matchTokens(tokens, at, "year", "event") || matchTokens(tokens, at, "event")) {
|
---|
10442 | at = parseMonthdayRange(tokens, at, nrule);
|
---|
10443 | week_stable = false
|
---|
10444 | } else if (matchTokens(tokens, at, "year")) {
|
---|
10445 | at = parseYearRange(tokens, at);
|
---|
10446 | week_stable = false
|
---|
10447 | } else if (matchTokens(tokens, at, "month")) {
|
---|
10448 | at = parseMonthRange(tokens, at)
|
---|
10449 | } else if (matchTokens(tokens, at, "week")) {
|
---|
10450 | tokens[at][3] = "week";
|
---|
10451 | at = parseWeekRange(tokens, at)
|
---|
10452 | } else if (at !== 0 && at !== tokens.length - 1 && tokens[at][0] === ":" && !(typeof last_selector[1] === "string" && last_selector[1] === "time")) {
|
---|
10453 | if (!done_with_warnings && matchTokens(tokens, at - 1, "holiday")) {
|
---|
10454 | parsing_warnings.push([nrule, at, t("no colon after", {
|
---|
10455 | token: tokens[at - 1][1]
|
---|
10456 | })])
|
---|
10457 | }
|
---|
10458 | at++
|
---|
10459 | } else if (matchTokens(tokens, at, "number", "timesep") || matchTokens(tokens, at, "timevar") || matchTokens(tokens, at, "(", "timevar") || matchTokens(tokens, at, "number", "-")) {
|
---|
10460 | at = parseTimeRange(tokens, at, selectors, false);
|
---|
10461 | last_selector = [at, "time"]
|
---|
10462 | } else if (matchTokens(tokens, at, "state")) {
|
---|
10463 | if (tokens[at][0] === "open") {
|
---|
10464 | selectors.meaning = true
|
---|
10465 | } else if (tokens[at][0] === "closed" || tokens[at][0] === "off") {
|
---|
10466 | selectors.meaning = false
|
---|
10467 | } else {
|
---|
10468 | selectors.meaning = false;
|
---|
10469 | selectors.unknown = true
|
---|
10470 | }
|
---|
10471 | rule_modifier_specified = true;
|
---|
10472 | at++;
|
---|
10473 | if (typeof tokens[at] === "object" && tokens[at][0] === ",")
|
---|
10474 | at = [at + 1]
|
---|
10475 | } else if (matchTokens(tokens, at, "comment")) {
|
---|
10476 | selectors.comment = tokens[at][0];
|
---|
10477 | if (!rule_modifier_specified) {
|
---|
10478 | selectors.meaning = false;
|
---|
10479 | selectors.unknown = true
|
---|
10480 | }
|
---|
10481 | rule_modifier_specified = true;
|
---|
10482 | at++;
|
---|
10483 | if (typeof tokens[at] === "object" && tokens[at][0] === ",") {
|
---|
10484 | at = [at + 1]
|
---|
10485 | }
|
---|
10486 | } else if ((at === 0 || at === tokens.length - 1) && matchTokens(tokens, at, "rule separator")) {
|
---|
10487 | at++
|
---|
10488 | } else {
|
---|
10489 | var warnings = getWarnings();
|
---|
10490 | throw formatWarnErrorMessage(nrule, at, t("unexpected token", {
|
---|
10491 | token: tokens[at][1]
|
---|
10492 | })) + (warnings ? " " + warnings.join("; ") : "")
|
---|
10493 | }
|
---|
10494 | if (typeof at === "object") {
|
---|
10495 | tokens[at[0] - 1][1] = "rule separator";
|
---|
10496 | break
|
---|
10497 | }
|
---|
10498 | if (typeof last_selector[0] === "number" && last_selector[0] !== at) {
|
---|
10499 | last_selector = []
|
---|
10500 | }
|
---|
10501 | }
|
---|
10502 | return at
|
---|
10503 | }
|
---|
10504 |
|
---|
10505 | function dateAtDayMinutes(date, minutes) {
|
---|
10506 | return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, minutes)
|
---|
10507 | }
|
---|
10508 |
|
---|
10509 | function dateAtNextWeekday(date, weekday) {
|
---|
10510 | var delta = weekday - date.getDay();
|
---|
10511 | return new Date(date.getFullYear(), date.getMonth(), date.getDate() + delta + (delta < 0 ? 7 : 0))
|
---|
10512 | }
|
---|
10513 |
|
---|
10514 | function indexOf(needle) {
|
---|
10515 | if (typeof Array.prototype.indexOf === "function") {
|
---|
10516 | indexOf = Array.prototype.indexOf
|
---|
10517 | } else {
|
---|
10518 | indexOf = function (needle) {
|
---|
10519 | var i = -1,
|
---|
10520 | index = -1;
|
---|
10521 | for (i = 0; i < this.length; i++) {
|
---|
10522 | if (this[i] === needle) {
|
---|
10523 | index = i;
|
---|
10524 | break
|
---|
10525 | }
|
---|
10526 | }
|
---|
10527 | return index
|
---|
10528 | }
|
---|
10529 | }
|
---|
10530 | return indexOf.call(this, needle)
|
---|
10531 | }
|
---|
10532 |
|
---|
10533 | function parseNumRange(tokens, at, func) {
|
---|
10534 | for (; at < tokens.length; at++) {
|
---|
10535 | if (matchTokens(tokens, at, "number", "-", "number")) {
|
---|
10536 | func(tokens[at][0], tokens[at + 2][0], at);
|
---|
10537 | at += 3
|
---|
10538 | } else if (matchTokens(tokens, at, "-", "number")) {
|
---|
10539 | func(-tokens[at + 1][0], -tokens[at + 1][0], at);
|
---|
10540 | at += 2
|
---|
10541 | } else if (matchTokens(tokens, at, "number")) {
|
---|
10542 | func(tokens[at][0], tokens[at][0], at);
|
---|
10543 | at++
|
---|
10544 | } else {
|
---|
10545 | throw formatWarnErrorMessage(nrule, at + matchTokens(tokens, at, "-"), "Unexpected token in number range: " + tokens[at][1])
|
---|
10546 | }
|
---|
10547 | if (!matchTokens(tokens, at, ","))
|
---|
10548 | break
|
---|
10549 | }
|
---|
10550 | return at
|
---|
10551 | }
|
---|
10552 |
|
---|
10553 | function getConstrainedWeekday(tokens, at) {
|
---|
10554 | var number = 0;
|
---|
10555 | var endat = parseNumRange(tokens, at, function (from, to, at) {
|
---|
10556 | if (from === 0 || from < -5 || from > 5)
|
---|
10557 | throw formatWarnErrorMessage(nrule, at, t("number -5 to 5"));
|
---|
10558 | if (from === to) {
|
---|
10559 | if (number !== 0)
|
---|
10560 | throw formatWarnErrorMessage(nrule, at, t("one weekday constraint"));
|
---|
10561 | number = from
|
---|
10562 | } else {
|
---|
10563 | throw formatWarnErrorMessage(nrule, at + 2, t("range constrained weekdays"))
|
---|
10564 | }
|
---|
10565 | });
|
---|
10566 | if (!matchTokens(tokens, endat, "]"))
|
---|
10567 | throw formatWarnErrorMessage(nrule, endat, t("expected", {
|
---|
10568 | symbol: "]"
|
---|
10569 | }));
|
---|
10570 | return [number, endat + 1]
|
---|
10571 | }
|
---|
10572 |
|
---|
10573 | function checkPeriod(at, period, period_type, parm_string) {
|
---|
10574 | if (done_with_warnings)
|
---|
10575 | return;
|
---|
10576 | if (period === 0) {
|
---|
10577 | throw formatWarnErrorMessage(nrule, at, t("range zero", {
|
---|
10578 | type: period_type
|
---|
10579 | }))
|
---|
10580 | } else if (period === 1) {
|
---|
10581 | if (typeof parm_string === "string" && parm_string === "no_end_year")
|
---|
10582 | parsing_warnings.push([nrule, at, t("period one year+", {
|
---|
10583 | type: period_type
|
---|
10584 | })]);
|
---|
10585 | else
|
---|
10586 | parsing_warnings.push([nrule, at, t("period one", {
|
---|
10587 | type: period_type
|
---|
10588 | })])
|
---|
10589 | }
|
---|
10590 | }
|
---|
10591 |
|
---|
10592 | function getDateForConstrainedWeekday(year, month, weekday, constrained_weekday, add_days) {
|
---|
10593 | var tmp_date = dateAtNextWeekday(new Date(year, month + (constrained_weekday[0] > 0 ? 0 : 1), 1), weekday);
|
---|
10594 | tmp_date.setDate(tmp_date.getDate() + (constrained_weekday[0] + (constrained_weekday[0] > 0 ? -1 : 0)) * 7);
|
---|
10595 | if (typeof add_days === "object" && add_days[1])
|
---|
10596 | tmp_date.setDate(tmp_date.getDate() + add_days[0]);
|
---|
10597 | return tmp_date
|
---|
10598 | }
|
---|
10599 |
|
---|
10600 | function checkIfDateIsValid(month, day, nrule, at) {
|
---|
10601 | if (day < 1 || day > 31) {
|
---|
10602 | throw formatWarnErrorMessage(nrule, at, t("month 31", {
|
---|
10603 | month: months[month]
|
---|
10604 | }))
|
---|
10605 | } else if ((month === 3 || month === 5 || month === 8 || month === 10) && day === 31) {
|
---|
10606 | throw formatWarnErrorMessage(nrule, at, t("month 30", {
|
---|
10607 | month: months[month]
|
---|
10608 | }))
|
---|
10609 | } else if (month === 1 && day === 30) {
|
---|
10610 | throw formatWarnErrorMessage(nrule, at, t("month feb", {
|
---|
10611 | month: months[month]
|
---|
10612 | }))
|
---|
10613 | }
|
---|
10614 | }
|
---|
10615 |
|
---|
10616 | function parseTimeRange(tokens, at, selectors, extended_open_end) {
|
---|
10617 | if (!extended_open_end)
|
---|
10618 | tokens[at][3] = "time";
|
---|
10619 | for (; at < tokens.length; at++) {
|
---|
10620 | var has_time_var_calc = [],
|
---|
10621 | has_normal_time = [];
|
---|
10622 | has_normal_time[0] = matchTokens(tokens, at, "number", "timesep", "number");
|
---|
10623 | has_time_var_calc[0] = matchTokens(tokens, at, "(", "timevar");
|
---|
10624 | var minutes_from, minutes_to;
|
---|
10625 | if (has_normal_time[0] || matchTokens(tokens, at, "timevar") || has_time_var_calc[0]) {
|
---|
10626 | var is_point_in_time = false;
|
---|
10627 | var has_open_end = false;
|
---|
10628 | var timevar_add = [0, 0];
|
---|
10629 | var timevar_string = [];
|
---|
10630 | var point_in_time_period;
|
---|
10631 | if (has_normal_time[0]) {
|
---|
10632 | minutes_from = getMinutesByHoursMinutes(tokens, nrule, at + has_time_var_calc[0])
|
---|
10633 | } else {
|
---|
10634 | timevar_string[0] = tokens[at + has_time_var_calc[0]][0];
|
---|
10635 | minutes_from = word_value_replacement[timevar_string[0]];
|
---|
10636 | if (has_time_var_calc[0]) {
|
---|
10637 | timevar_add[0] = parseTimevarCalc(tokens, at);
|
---|
10638 | minutes_from += timevar_add[0]
|
---|
10639 | }
|
---|
10640 | }
|
---|
10641 | var at_end_time = at + (has_normal_time[0] ? 3 : has_time_var_calc[0] ? 7 : 1) + 1;
|
---|
10642 | if (!matchTokens(tokens, at_end_time - 1, "-")) {
|
---|
10643 | if (matchTokens(tokens, at_end_time - 1, "+")) {
|
---|
10644 | has_open_end = true
|
---|
10645 | } else {
|
---|
10646 | if (oh_mode === 0) {
|
---|
10647 | throw formatWarnErrorMessage(nrule, at + (has_normal_time[0] ? typeof tokens[at + 3] === "object" ? 3 : 2 : has_time_var_calc[0] ? 2 : typeof tokens[at + 1] === "object" ? 1 : 0), t("point in time", {
|
---|
10648 | calc: has_time_var_calc[0] ? t("calculation") + " " : "",
|
---|
10649 | libraryname: library_name
|
---|
10650 | }))
|
---|
10651 | } else {
|
---|
10652 | minutes_to = minutes_from + 1;
|
---|
10653 | is_point_in_time = true
|
---|
10654 | }
|
---|
10655 | }
|
---|
10656 | }
|
---|
10657 | if (has_open_end) {
|
---|
10658 | if (extended_open_end === 1) {
|
---|
10659 | minutes_from += minutes_in_day
|
---|
10660 | }
|
---|
10661 | if (minutes_from >= 22 * 60) {
|
---|
10662 | minutes_to = minutes_from + 8 * 60
|
---|
10663 | } else if (minutes_from >= 17 * 60) {
|
---|
10664 | minutes_to = minutes_from + 10 * 60
|
---|
10665 | } else {
|
---|
10666 | minutes_to = minutes_in_day
|
---|
10667 | }
|
---|
10668 | } else if (!is_point_in_time) {
|
---|
10669 | has_normal_time[1] = matchTokens(tokens, at_end_time, "number", "timesep", "number");
|
---|
10670 | has_time_var_calc[1] = matchTokens(tokens, at_end_time, "(", "timevar");
|
---|
10671 | if (!has_normal_time[1] && !matchTokens(tokens, at_end_time, "timevar") && !has_time_var_calc[1]) {
|
---|
10672 | throw formatWarnErrorMessage(nrule, at_end_time - (typeof tokens[at_end_time] === "object" ? 0 : 1), t("time range continue"))
|
---|
10673 | } else {
|
---|
10674 | if (has_normal_time[1]) {
|
---|
10675 | minutes_to = getMinutesByHoursMinutes(tokens, nrule, at_end_time)
|
---|
10676 | } else {
|
---|
10677 | timevar_string[1] = tokens[at_end_time + has_time_var_calc[1]][0];
|
---|
10678 | minutes_to = word_value_replacement[timevar_string[1]]
|
---|
10679 | }
|
---|
10680 | if (has_time_var_calc[1]) {
|
---|
10681 | timevar_add[1] = parseTimevarCalc(tokens, at_end_time);
|
---|
10682 | minutes_to += timevar_add[1]
|
---|
10683 | }
|
---|
10684 | }
|
---|
10685 | }
|
---|
10686 | at = at_end_time + (is_point_in_time ? -1 : has_normal_time[1] ? 3 : has_time_var_calc[1] ? 7 : !has_open_end);
|
---|
10687 | if (matchTokens(tokens, at, "/", "number")) {
|
---|
10688 | if (matchTokens(tokens, at + 2, "timesep", "number")) {
|
---|
10689 | point_in_time_period = getMinutesByHoursMinutes(tokens, nrule, at + 1);
|
---|
10690 | at += 4
|
---|
10691 | } else {
|
---|
10692 | point_in_time_period = tokens[at + 1][0];
|
---|
10693 | at += 2;
|
---|
10694 | if (matchTokens(tokens, at, "timesep"))
|
---|
10695 | throw formatWarnErrorMessage(nrule, at, t("period continue"))
|
---|
10696 | }
|
---|
10697 | if (oh_mode === 0) {
|
---|
10698 | throw formatWarnErrorMessage(nrule, at - 1, t("time range mode", {
|
---|
10699 | libraryname: library_name
|
---|
10700 | }))
|
---|
10701 | }
|
---|
10702 | is_point_in_time = true
|
---|
10703 | } else if (matchTokens(tokens, at, "+")) {
|
---|
10704 | parseTimeRange(tokens, at_end_time, selectors, minutes_to < minutes_from ? 1 : true);
|
---|
10705 | at++
|
---|
10706 | } else if (oh_mode === 1 && !is_point_in_time) {
|
---|
10707 | throw formatWarnErrorMessage(nrule, at_end_time, t("point in time mode", {
|
---|
10708 | libraryname: library_name
|
---|
10709 | }))
|
---|
10710 | }
|
---|
10711 | if (typeof lat === "string") {
|
---|
10712 | if (!has_normal_time[0] || !(has_normal_time[1] || has_open_end || is_point_in_time)) {
|
---|
10713 | week_stable = false
|
---|
10714 | }
|
---|
10715 | } else {
|
---|
10716 | timevar_string = []
|
---|
10717 | }
|
---|
10718 | if (!extended_open_end && minutes_from >= minutes_in_day) {
|
---|
10719 | throw formatWarnErrorMessage(nrule, at_end_time - 2, t("outside current day"))
|
---|
10720 | }
|
---|
10721 | if (minutes_to < minutes_from || has_normal_time[0] && has_normal_time[1] && minutes_from === minutes_to) {
|
---|
10722 | minutes_to += minutes_in_day
|
---|
10723 | }
|
---|
10724 | if (minutes_to > minutes_in_day * 2) {
|
---|
10725 | throw formatWarnErrorMessage(nrule, at_end_time + (has_normal_time[1] ? 4 : has_time_var_calc[1] ? 7 : 1) - 2, t("two midnights"))
|
---|
10726 | }
|
---|
10727 | if (minutes_from === 0 && minutes_to === minutes_in_day) {
|
---|
10728 | selectors.time.push(function () {
|
---|
10729 | return [true]
|
---|
10730 | })
|
---|
10731 | } else {
|
---|
10732 | if (minutes_to > minutes_in_day) {
|
---|
10733 | selectors.time.push(function (minutes_from, minutes_to, timevar_string, timevar_add, has_open_end, is_point_in_time, point_in_time_period, extended_open_end) {
|
---|
10734 | return function (date) {
|
---|
10735 | var ourminutes = date.getHours() * 60 + date.getMinutes();
|
---|
10736 | if (timevar_string[0]) {
|
---|
10737 | var date_from = SunCalc.getTimes(date, lat, lon)[timevar_string[0]];
|
---|
10738 | minutes_from = date_from.getHours() * 60 + date_from.getMinutes() + timevar_add[0]
|
---|
10739 | }
|
---|
10740 | if (timevar_string[1]) {
|
---|
10741 | var date_to = SunCalc.getTimes(date, lat, lon)[timevar_string[1]];
|
---|
10742 | minutes_to = date_to.getHours() * 60 + date_to.getMinutes() + timevar_add[1];
|
---|
10743 | minutes_to += minutes_in_day
|
---|
10744 | } else if (is_point_in_time && typeof point_in_time_period !== "number") {
|
---|
10745 | minutes_to = minutes_from + 1
|
---|
10746 | }
|
---|
10747 | if (typeof point_in_time_period === "number") {
|
---|
10748 | if (ourminutes < minutes_from) {
|
---|
10749 | return [false, dateAtDayMinutes(date, minutes_from)]
|
---|
10750 | } else if (ourminutes <= minutes_to) {
|
---|
10751 | for (var cur_min = minutes_from; ourminutes + point_in_time_period >= cur_min; cur_min += point_in_time_period) {
|
---|
10752 | if (cur_min === ourminutes) {
|
---|
10753 | return [true, dateAtDayMinutes(date, ourminutes + 1)]
|
---|
10754 | } else if (ourminutes < cur_min) {
|
---|
10755 | return [false, dateAtDayMinutes(date, cur_min)]
|
---|
10756 | }
|
---|
10757 | }
|
---|
10758 | }
|
---|
10759 | return [false, dateAtDayMinutes(date, minutes_in_day)]
|
---|
10760 | } else {
|
---|
10761 | if (ourminutes < minutes_from)
|
---|
10762 | return [false, dateAtDayMinutes(date, minutes_from)];
|
---|
10763 | else
|
---|
10764 | return [true, dateAtDayMinutes(date, minutes_to), has_open_end, extended_open_end]
|
---|
10765 | }
|
---|
10766 | }
|
---|
10767 | }(minutes_from, minutes_to, timevar_string, timevar_add, has_open_end, is_point_in_time, point_in_time_period, extended_open_end));
|
---|
10768 | selectors.wraptime.push(function (minutes_from, minutes_to, timevar_string, timevar_add, has_open_end, point_in_time_period, extended_open_end) {
|
---|
10769 | return function (date) {
|
---|
10770 | var ourminutes = date.getHours() * 60 + date.getMinutes();
|
---|
10771 | if (timevar_string[0]) {
|
---|
10772 | var date_from = SunCalc.getTimes(date, lat, lon)[timevar_string[0]];
|
---|
10773 | minutes_from = date_from.getHours() * 60 + date_from.getMinutes() + timevar_add[0]
|
---|
10774 | }
|
---|
10775 | if (timevar_string[1]) {
|
---|
10776 | var date_to = SunCalc.getTimes(date, lat, lon)[timevar_string[1]];
|
---|
10777 | minutes_to = date_to.getHours() * 60 + date_to.getMinutes() + timevar_add[1]
|
---|
10778 | }
|
---|
10779 | if (typeof point_in_time_period === "number") {
|
---|
10780 | if (ourminutes <= minutes_to) {
|
---|
10781 | for (var cur_min = 0; ourminutes + point_in_time_period >= cur_min; cur_min += point_in_time_period) {
|
---|
10782 | if (cur_min === ourminutes) {
|
---|
10783 | return [true, dateAtDayMinutes(date, ourminutes + 1)]
|
---|
10784 | } else if (ourminutes < cur_min) {
|
---|
10785 | return [false, dateAtDayMinutes(date, cur_min)]
|
---|
10786 | }
|
---|
10787 | }
|
---|
10788 | }
|
---|
10789 | } else {
|
---|
10790 | if (ourminutes < minutes_to)
|
---|
10791 | return [true, dateAtDayMinutes(date, minutes_to), has_open_end, extended_open_end]
|
---|
10792 | }
|
---|
10793 | return [false, undefined]
|
---|
10794 | }
|
---|
10795 | }(minutes_from, minutes_to - minutes_in_day, timevar_string, timevar_add, has_open_end, point_in_time_period, extended_open_end))
|
---|
10796 | } else {
|
---|
10797 | selectors.time.push(function (minutes_from, minutes_to, timevar_string, timevar_add, has_open_end, is_point_in_time, point_in_time_period) {
|
---|
10798 | return function (date) {
|
---|
10799 | var ourminutes = date.getHours() * 60 + date.getMinutes();
|
---|
10800 | if (timevar_string[0]) {
|
---|
10801 | var date_from = SunCalc.getTimes(date, lat, lon)[timevar_string[0]];
|
---|
10802 | minutes_from = date_from.getHours() * 60 + date_from.getMinutes() + timevar_add[0]
|
---|
10803 | }
|
---|
10804 | if (timevar_string[1]) {
|
---|
10805 | var date_to = SunCalc.getTimes(date, lat, lon)[timevar_string[1]];
|
---|
10806 | minutes_to = date_to.getHours() * 60 + date_to.getMinutes() + timevar_add[1]
|
---|
10807 | } else if (is_point_in_time && typeof point_in_time_period !== "number") {
|
---|
10808 | minutes_to = minutes_from + 1
|
---|
10809 | }
|
---|
10810 | if (typeof point_in_time_period === "number") {
|
---|
10811 | if (ourminutes < minutes_from) {
|
---|
10812 | return [false, dateAtDayMinutes(date, minutes_from)]
|
---|
10813 | } else if (ourminutes <= minutes_to) {
|
---|
10814 | for (var cur_min = minutes_from; ourminutes + point_in_time_period >= cur_min; cur_min += point_in_time_period) {
|
---|
10815 | if (cur_min === ourminutes) {
|
---|
10816 | return [true, dateAtDayMinutes(date, ourminutes + 1)]
|
---|
10817 | } else if (ourminutes < cur_min) {
|
---|
10818 | return [false, dateAtDayMinutes(date, cur_min)]
|
---|
10819 | }
|
---|
10820 | }
|
---|
10821 | }
|
---|
10822 | return [false, dateAtDayMinutes(date, minutes_in_day)]
|
---|
10823 | } else {
|
---|
10824 | if (ourminutes < minutes_from)
|
---|
10825 | return [false, dateAtDayMinutes(date, minutes_from)];
|
---|
10826 | else if (ourminutes < minutes_to)
|
---|
10827 | return [true, dateAtDayMinutes(date, minutes_to), has_open_end];
|
---|
10828 | else
|
---|
10829 | return [false, dateAtDayMinutes(date, minutes_from + minutes_in_day)]
|
---|
10830 | }
|
---|
10831 | }
|
---|
10832 | }(minutes_from, minutes_to, timevar_string, timevar_add, has_open_end, is_point_in_time, point_in_time_period))
|
---|
10833 | }
|
---|
10834 | }
|
---|
10835 | } else if (matchTokens(tokens, at, "number", "-", "number")) {
|
---|
10836 | minutes_from = tokens[at][0] * 60;
|
---|
10837 | minutes_to = tokens[at + 2][0] * 60;
|
---|
10838 | if (!done_with_warnings)
|
---|
10839 | parsing_warnings.push([nrule, at + 2, t("without minutes", {
|
---|
10840 | syntax: (tokens[at][0] < 10 ? "0" : "") + tokens[at][0] + ":00-" + (tokens[at + 2][0] < 10 ? "0" : "") + tokens[at + 2][0] + ":00"
|
---|
10841 | })]);
|
---|
10842 | if (minutes_from >= minutes_in_day)
|
---|
10843 | throw formatWarnErrorMessage(nrule, at, t("outside day"));
|
---|
10844 | if (minutes_to < minutes_from)
|
---|
10845 | minutes_to += minutes_in_day;
|
---|
10846 | if (minutes_to > minutes_in_day * 2)
|
---|
10847 | throw formatWarnErrorMessage(nrule, at + 2, t("two midnights"));
|
---|
10848 | if (minutes_to > minutes_in_day) {
|
---|
10849 | selectors.time.push(function (minutes_from, minutes_to) {
|
---|
10850 | return function (date) {
|
---|
10851 | var ourminutes = date.getHours() * 60 + date.getMinutes();
|
---|
10852 | if (ourminutes < minutes_from)
|
---|
10853 | return [false, dateAtDayMinutes(date, minutes_from)];
|
---|
10854 | else
|
---|
10855 | return [true, dateAtDayMinutes(date, minutes_to)]
|
---|
10856 | }
|
---|
10857 | }(minutes_from, minutes_to));
|
---|
10858 | selectors.wraptime.push(function (minutes_to) {
|
---|
10859 | return function (date) {
|
---|
10860 | var ourminutes = date.getHours() * 60 + date.getMinutes();
|
---|
10861 | if (ourminutes < minutes_to) {
|
---|
10862 | return [true, dateAtDayMinutes(date, minutes_to)]
|
---|
10863 | } else {
|
---|
10864 | return [false, undefined]
|
---|
10865 | }
|
---|
10866 | }
|
---|
10867 | }(minutes_to - minutes_in_day))
|
---|
10868 | } else {
|
---|
10869 | selectors.time.push(function (minutes_from, minutes_to) {
|
---|
10870 | return function (date) {
|
---|
10871 | var ourminutes = date.getHours() * 60 + date.getMinutes();
|
---|
10872 | if (ourminutes < minutes_from)
|
---|
10873 | return [false, dateAtDayMinutes(date, minutes_from)];
|
---|
10874 | else if (ourminutes < minutes_to)
|
---|
10875 | return [true, dateAtDayMinutes(date, minutes_to), has_open_end];
|
---|
10876 | else
|
---|
10877 | return [false, dateAtDayMinutes(date, minutes_from + minutes_in_day)]
|
---|
10878 | }
|
---|
10879 | }(minutes_from, minutes_to))
|
---|
10880 | }
|
---|
10881 | at += 3
|
---|
10882 | } else {
|
---|
10883 | if (matchTokens(tokens, at, "("))
|
---|
10884 | throw formatWarnErrorMessage(nrule, at, 'Missing variable time (e.g. sunrise) after: "' + tokens[at][1] + '"');
|
---|
10885 | if (matchTokens(tokens, at, "number", "timesep"))
|
---|
10886 | throw formatWarnErrorMessage(nrule, at + 1, 'Missing minutes in time range after: "' + tokens[at + 1][1] + '"');
|
---|
10887 | if (matchTokens(tokens, at, "number"))
|
---|
10888 | throw formatWarnErrorMessage(nrule, at + (typeof tokens[at + 1] === "object" ? 1 : 0), 'Missing time separator in time range after: "' + tokens[at][1] + '"');
|
---|
10889 | return [at]
|
---|
10890 | }
|
---|
10891 | if (!matchTokens(tokens, at, ","))
|
---|
10892 | break
|
---|
10893 | }
|
---|
10894 | return at
|
---|
10895 | }
|
---|
10896 |
|
---|
10897 | function getMinutesByHoursMinutes(tokens, nrule, at) {
|
---|
10898 | if (tokens[at + 2][0] > 59)
|
---|
10899 | throw formatWarnErrorMessage(nrule, at + 2, "Minutes are greater than 59.");
|
---|
10900 | return tokens[at][0] * 60 + tokens[at + 2][0]
|
---|
10901 | }
|
---|
10902 |
|
---|
10903 | function parseTimevarCalc(tokens, at) {
|
---|
10904 | var error;
|
---|
10905 | if (matchTokens(tokens, at + 2, "+") || matchTokens(tokens, at + 2, "-")) {
|
---|
10906 | if (matchTokens(tokens, at + 3, "number", "timesep", "number")) {
|
---|
10907 | if (matchTokens(tokens, at + 6, ")")) {
|
---|
10908 | var add_or_subtract = tokens[at + 2][0] === "+" ? "1" : "-1";
|
---|
10909 | var minutes = getMinutesByHoursMinutes(tokens, nrule, at + 3) * add_or_subtract;
|
---|
10910 | if (minutes === 0)
|
---|
10911 | parsing_warnings.push([nrule, at + 5, t("zero calculation")]);
|
---|
10912 | return minutes
|
---|
10913 | } else {
|
---|
10914 | error = [at + 6, ". " + t("missing", {
|
---|
10915 | symbol: ")"
|
---|
10916 | }) + "."]
|
---|
10917 | }
|
---|
10918 | } else {
|
---|
10919 | error = [at + 5, " " + t("(time)") + "."]
|
---|
10920 | }
|
---|
10921 | } else {
|
---|
10922 | error = [at + 2, ". " + t("expected", {
|
---|
10923 | symbol: '+" or "-'
|
---|
10924 | })]
|
---|
10925 | }
|
---|
10926 | if (error)
|
---|
10927 | throw formatWarnErrorMessage(nrule, error[0], t("calculation syntax") + error[1])
|
---|
10928 | }
|
---|
10929 |
|
---|
10930 | function parseWeekdayRange(tokens, at, selectors, in_holiday_selector) {
|
---|
10931 | if (!in_holiday_selector) {
|
---|
10932 | in_holiday_selector = true;
|
---|
10933 | tokens[at][3] = "weekday"
|
---|
10934 | }
|
---|
10935 | for (; at < tokens.length; at++) {
|
---|
10936 | if (matchTokens(tokens, at, "weekday", "[")) {
|
---|
10937 | var numbers = [];
|
---|
10938 | var endat = parseNumRange(tokens, at + 2, function (from, to, at) {
|
---|
10939 | if (from === 0 || from < -5 || from > 5)
|
---|
10940 | throw formatWarnErrorMessage(nrule, at, t("number -5 to 5"));
|
---|
10941 | if (from === to) {
|
---|
10942 | numbers.push(from)
|
---|
10943 | } else if (from < to) {
|
---|
10944 | for (var i = from; i <= to; i++) {
|
---|
10945 | if (i === 0 || i < -5 || i > 5)
|
---|
10946 | throw formatWarnErrorMessage(nrule, at + 2, t("number -5 to 5"));
|
---|
10947 | numbers.push(i)
|
---|
10948 | }
|
---|
10949 | } else {
|
---|
10950 | throw formatWarnErrorMessage(nrule, at + 2, t("bad range", {
|
---|
10951 | from: from,
|
---|
10952 | to: to
|
---|
10953 | }))
|
---|
10954 | }
|
---|
10955 | });
|
---|
10956 | if (!matchTokens(tokens, endat, "]"))
|
---|
10957 | throw formatWarnErrorMessage(nrule, endat, t("] or more numbers"));
|
---|
10958 | var add_days = getMoveDays(tokens, endat + 1, 6, "constrained weekdays");
|
---|
10959 | week_stable = false;
|
---|
10960 | for (var nnumber = 0; nnumber < numbers.length; nnumber++) {
|
---|
10961 | selectors.weekday.push(function (weekday, number, add_days) {
|
---|
10962 | return function (date) {
|
---|
10963 | var date_num = getValueForDate(date, false);
|
---|
10964 | var start_of_this_month = new Date(date.getFullYear(), date.getMonth(), 1);
|
---|
10965 | var start_of_next_month = new Date(date.getFullYear(), date.getMonth() + 1, 1);
|
---|
10966 | var target_day_this_month;
|
---|
10967 | target_day_this_month = getDateForConstrainedWeekday(date.getFullYear(), date.getMonth(), weekday, [number]);
|
---|
10968 | var target_day_with_added_days_this_month = new Date(target_day_this_month.getFullYear(), target_day_this_month.getMonth(), target_day_this_month.getDate() + add_days);
|
---|
10969 | if (target_day_with_added_days_this_month.getTime() < start_of_this_month.getTime()) {
|
---|
10970 | if (target_day_this_month.getTime() >= start_of_this_month.getTime()) {
|
---|
10971 | target_day_with_added_days_this_month = dateAtNextWeekday(new Date(date.getFullYear(), date.getMonth() + (number > 0 ? 0 : 1) + 1, 1), weekday);
|
---|
10972 | target_day_this_month.setDate(target_day_with_added_days_this_month.getDate() + (number + (number > 0 ? -1 : 0)) * 7 + add_days)
|
---|
10973 | } else {
|
---|
10974 | return [false, start_of_next_month]
|
---|
10975 | }
|
---|
10976 | } else if (target_day_with_added_days_this_month.getTime() >= start_of_next_month.getTime()) {
|
---|
10977 | if (target_day_this_month.getTime() >= start_of_next_month.getTime())
|
---|
10978 | return [false, start_of_next_month]
|
---|
10979 | }
|
---|
10980 | var target_day_with_added_moved_days_this_month;
|
---|
10981 | if (add_days > 0) {
|
---|
10982 | target_day_with_added_moved_days_this_month = dateAtNextWeekday(new Date(date.getFullYear(), date.getMonth() + (number > 0 ? 0 : 1) - 1, 1), weekday);
|
---|
10983 | target_day_with_added_moved_days_this_month.setDate(target_day_with_added_moved_days_this_month.getDate() + (number + (number > 0 ? -1 : 0)) * 7 + add_days);
|
---|
10984 | if (date_num === getValueForDate(target_day_with_added_moved_days_this_month, false))
|
---|
10985 | return [true, dateAtDayMinutes(date, minutes_in_day)]
|
---|
10986 | } else if (add_days < 0) {
|
---|
10987 | target_day_with_added_moved_days_this_month = dateAtNextWeekday(new Date(date.getFullYear(), date.getMonth() + (number > 0 ? 0 : 1) + 1, 1), weekday);
|
---|
10988 | target_day_with_added_moved_days_this_month.setDate(target_day_with_added_moved_days_this_month.getDate() + (number + (number > 0 ? -1 : 0)) * 7 + add_days);
|
---|
10989 | if (target_day_with_added_moved_days_this_month.getTime() >= start_of_next_month.getTime()) {
|
---|
10990 | if (target_day_with_added_days_this_month.getTime() >= start_of_next_month.getTime())
|
---|
10991 | return [false, target_day_with_added_moved_days_this_month]
|
---|
10992 | } else {
|
---|
10993 | if (target_day_with_added_days_this_month.getTime() < start_of_next_month.getTime() && getValueForDate(target_day_with_added_days_this_month, false) === date_num)
|
---|
10994 | return [true, dateAtDayMinutes(date, minutes_in_day)];
|
---|
10995 | target_day_with_added_days_this_month = target_day_with_added_moved_days_this_month
|
---|
10996 | }
|
---|
10997 | }
|
---|
10998 | if (date.getDate() === target_day_with_added_days_this_month.getDate()) {
|
---|
10999 | return [true, dateAtDayMinutes(date, minutes_in_day)]
|
---|
11000 | }
|
---|
11001 | if (date.getDate() < target_day_with_added_days_this_month.getDate()) {
|
---|
11002 | return [false, target_day_with_added_days_this_month]
|
---|
11003 | }
|
---|
11004 | return [false, start_of_next_month]
|
---|
11005 | }
|
---|
11006 | }(tokens[at][0], numbers[nnumber], add_days[0]))
|
---|
11007 | }
|
---|
11008 | at = endat + 1 + add_days[1]
|
---|
11009 | } else if (matchTokens(tokens, at, "weekday")) {
|
---|
11010 | var is_range = matchTokens(tokens, at + 1, "-", "weekday");
|
---|
11011 | var weekday_from = tokens[at][0];
|
---|
11012 | var weekday_to = is_range ? tokens[at + 2][0] : weekday_from;
|
---|
11013 | var inside = true;
|
---|
11014 | if (weekday_to < weekday_from) {
|
---|
11015 | var tmp = weekday_to;
|
---|
11016 | weekday_to = weekday_from - 1;
|
---|
11017 | weekday_from = tmp + 1;
|
---|
11018 | inside = false
|
---|
11019 | }
|
---|
11020 | if (weekday_to < weekday_from) {
|
---|
11021 | selectors.weekday.push(function () {
|
---|
11022 | return [true]
|
---|
11023 | })
|
---|
11024 | } else {
|
---|
11025 | selectors.weekday.push(function (weekday_from, weekday_to, inside) {
|
---|
11026 | return function (date) {
|
---|
11027 | var ourweekday = date.getDay();
|
---|
11028 | if (ourweekday < weekday_from || ourweekday > weekday_to) {
|
---|
11029 | return [!inside, dateAtNextWeekday(date, weekday_from)]
|
---|
11030 | } else {
|
---|
11031 | return [inside, dateAtNextWeekday(date, weekday_to + 1)]
|
---|
11032 | }
|
---|
11033 | }
|
---|
11034 | }(weekday_from, weekday_to, inside))
|
---|
11035 | }
|
---|
11036 | at += is_range ? 3 : 1
|
---|
11037 | } else if (matchTokens(tokens, at, "holiday")) {
|
---|
11038 | week_stable = false;
|
---|
11039 | return parseHoliday(tokens, at, selectors, true, in_holiday_selector)
|
---|
11040 | } else if (matchTokens(tokens, at - 1, ",")) {
|
---|
11041 | throw formatWarnErrorMessage(nrule, at - 1, t("additional rule no sense"))
|
---|
11042 | } else {
|
---|
11043 | throw formatWarnErrorMessage(nrule, at, t("unexpected token weekday range", {
|
---|
11044 | token: tokens[at][1]
|
---|
11045 | }))
|
---|
11046 | }
|
---|
11047 | if (!matchTokens(tokens, at, ","))
|
---|
11048 | break
|
---|
11049 | }
|
---|
11050 | return at
|
---|
11051 | }
|
---|
11052 |
|
---|
11053 | function getMoveDays(tokens, at, max_differ, name) {
|
---|
11054 | var add_days = [0, 0];
|
---|
11055 | add_days[0] = matchTokens(tokens, at, "+") || (matchTokens(tokens, at, "-") ? -1 : 0);
|
---|
11056 | if (add_days[0] !== 0 && matchTokens(tokens, at + 1, "number", "calcday")) {
|
---|
11057 | if (tokens[at + 1][0] > max_differ)
|
---|
11058 | throw formatWarnErrorMessage(nrule, at + 2, t("max differ", {
|
---|
11059 | maxdiffer: max_differ,
|
---|
11060 | name: name
|
---|
11061 | }));
|
---|
11062 | add_days[0] *= tokens[at + 1][0];
|
---|
11063 | if (add_days[0] === 0 && !done_with_warnings)
|
---|
11064 | parsing_warnings.push([nrule, at + 2, t("adding 0")]);
|
---|
11065 | add_days[1] = 3
|
---|
11066 | } else {
|
---|
11067 | add_days[0] = 0
|
---|
11068 | }
|
---|
11069 | return add_days
|
---|
11070 | }
|
---|
11071 |
|
---|
11072 | function parseHoliday(tokens, at, selectors, push_to_weekday, in_holiday_selector) {
|
---|
11073 | if (!in_holiday_selector) {
|
---|
11074 | if (push_to_weekday)
|
---|
11075 | tokens[at][3] = "weekday";
|
---|
11076 | else
|
---|
11077 | tokens[at][3] = "holiday"
|
---|
11078 | }
|
---|
11079 | for (; at < tokens.length; at++) {
|
---|
11080 | if (matchTokens(tokens, at, "holiday")) {
|
---|
11081 | if (tokens[at][0] === "PH") {
|
---|
11082 | var applying_holidays = getMatchingHoliday(tokens[at][0]);
|
---|
11083 | var add_days = getMoveDays(tokens, at + 1, 1, "public holiday");
|
---|
11084 | var selector = function (applying_holidays, add_days) {
|
---|
11085 | return function (date) {
|
---|
11086 | var holidays = getApplyingHolidaysForYear(applying_holidays, date.getFullYear(), add_days);
|
---|
11087 | var date_num = getValueForDate(date, true);
|
---|
11088 | for (var i = 0; i < holidays.length; i++) {
|
---|
11089 | var next_holiday_date_num = getValueForDate(holidays[i][0], true);
|
---|
11090 | if (date_num < next_holiday_date_num) {
|
---|
11091 | if (add_days[0] > 0) {
|
---|
11092 | var holidays_last_year = getApplyingHolidaysForYear(applying_holidays, date.getFullYear() - 1, add_days);
|
---|
11093 | var last_holiday_last_year = holidays_last_year[holidays_last_year.length - 1];
|
---|
11094 | var last_holiday_last_year_num = getValueForDate(last_holiday_last_year[0], true);
|
---|
11095 | if (date_num < last_holiday_last_year_num) {
|
---|
11096 | return [false, last_holiday_last_year[0]]
|
---|
11097 | } else if (date_num === last_holiday_last_year_num) {
|
---|
11098 | return [true, dateAtDayMinutes(last_holiday_last_year[0], minutes_in_day), "Day after " + last_holiday_last_year[1]]
|
---|
11099 | }
|
---|
11100 | }
|
---|
11101 | return [false, holidays[i][0]]
|
---|
11102 | } else if (date_num === next_holiday_date_num) {
|
---|
11103 | return [true, new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1), (add_days[0] > 0 ? "Day after " : add_days[0] < 0 ? "Day before " : "") + holidays[i][1]]
|
---|
11104 | }
|
---|
11105 | }
|
---|
11106 | if (add_days[0] < 0) {
|
---|
11107 | var holidays_next_year = getApplyingHolidaysForYear(applying_holidays, date.getFullYear() + 1, add_days);
|
---|
11108 | var first_holidays_next_year = holidays_next_year[0];
|
---|
11109 | var first_holidays_next_year_num = getValueForDate(first_holidays_next_year[0], true);
|
---|
11110 | if (date_num === first_holidays_next_year_num) {
|
---|
11111 | return [true, dateAtDayMinutes(first_holidays_next_year[0], minutes_in_day), "Day before " + first_holidays_next_year[1]]
|
---|
11112 | }
|
---|
11113 | }
|
---|
11114 | return [false, new Date(holidays[0][0].getFullYear() + 1, holidays[0][0].getMonth(), holidays[0][0].getDate())]
|
---|
11115 | }
|
---|
11116 | }(applying_holidays, add_days);
|
---|
11117 | if (push_to_weekday)
|
---|
11118 | selectors.weekday.push(selector);
|
---|
11119 | else
|
---|
11120 | selectors.holiday.push(selector);
|
---|
11121 | at += 1 + add_days[1]
|
---|
11122 | } else if (tokens[at][0] === "SH") {
|
---|
11123 | var applying_holidays = getMatchingHoliday(tokens[at][0]);
|
---|
11124 | var selector = function (applying_holidays) {
|
---|
11125 | return function (date) {
|
---|
11126 | var date_num = getValueForDate(date);
|
---|
11127 | for (var i = 0; i < applying_holidays.length; i++) {
|
---|
11128 | var holiday = getSHForYear(applying_holidays[i], date.getFullYear());
|
---|
11129 | for (var h = 0; h < holiday.length; h += 4) {
|
---|
11130 | var holiday_to_plus = new Date(date.getFullYear(), holiday[2 + h] - 1, holiday[3 + h] + 1);
|
---|
11131 | var holiday_from = (holiday[0 + h] - 1) * 100 + holiday[1 + h];
|
---|
11132 | var holiday_to = (holiday[2 + h] - 1) * 100 + holiday[3 + h];
|
---|
11133 | holiday_to_plus = getValueForDate(holiday_to_plus);
|
---|
11134 | var holiday_ends_next_year = holiday_to < holiday_from;
|
---|
11135 | if (date_num < holiday_from) {
|
---|
11136 | var last_year_holiday = getSHForYear(applying_holidays[applying_holidays.length - 1], date.getFullYear() - 1, false);
|
---|
11137 | if (typeof last_year_holiday === "object") {
|
---|
11138 | var last_year_holiday_from = (last_year_holiday[last_year_holiday.length - 4] - 1) * 100 + last_year_holiday[last_year_holiday.length - 3];
|
---|
11139 | var last_year_holiday_to = (last_year_holiday[last_year_holiday.length - 2] - 1) * 100 + last_year_holiday[last_year_holiday.length - 1];
|
---|
11140 | if (last_year_holiday_from > last_year_holiday_to && date_num <= last_year_holiday_to)
|
---|
11141 | return [true, new Date(date.getFullYear(), last_year_holiday[last_year_holiday.length - 2] - 1, last_year_holiday[last_year_holiday.length - 1] + 1), applying_holidays[applying_holidays.length - 1].name];
|
---|
11142 | else
|
---|
11143 | return [false, new Date(date.getFullYear(), holiday[0 + h] - 1, holiday[1 + h])]
|
---|
11144 | } else {
|
---|
11145 | return [false, new Date(date.getFullYear(), holiday[0 + h] - 1, holiday[1 + h])]
|
---|
11146 | }
|
---|
11147 | } else if (holiday_from <= date_num && (date_num < holiday_to_plus || holiday_ends_next_year)) {
|
---|
11148 | return [true, new Date(date.getFullYear() + holiday_ends_next_year, holiday[2 + h] - 1, holiday[3 + h] + 1), applying_holidays[i].name]
|
---|
11149 | } else if (holiday_to_plus === date_num) {
|
---|
11150 | if (h + 4 < holiday.length) {
|
---|
11151 | h += 4;
|
---|
11152 | return [false, new Date(date.getFullYear(), holiday[0 + h] - 1, holiday[1 + h])]
|
---|
11153 | } else {
|
---|
11154 | if (i + 1 === applying_holidays.length) {
|
---|
11155 | var holiday = getSHForYear(applying_holidays[0], date.getFullYear() + 1);
|
---|
11156 | return [false, new Date(date.getFullYear() + !holiday_ends_next_year, holiday[0 + h] - 1, holiday[1 + h])]
|
---|
11157 | } else {
|
---|
11158 | var holiday = getSHForYear(applying_holidays[i + 1], date.getFullYear());
|
---|
11159 | return [false, new Date(date.getFullYear(), holiday[0] - 1, holiday[1])]
|
---|
11160 | }
|
---|
11161 | }
|
---|
11162 | }
|
---|
11163 | }
|
---|
11164 | }
|
---|
11165 | return [false]
|
---|
11166 | }
|
---|
11167 | }(applying_holidays);
|
---|
11168 | if (push_to_weekday)
|
---|
11169 | selectors.weekday.push(selector);
|
---|
11170 | else
|
---|
11171 | selectors.holiday.push(selector);
|
---|
11172 | at += 1
|
---|
11173 | }
|
---|
11174 | } else if (matchTokens(tokens, at, "weekday")) {
|
---|
11175 | return parseWeekdayRange(tokens, at, selectors, true)
|
---|
11176 | } else if (matchTokens(tokens, at - 1, ",")) {
|
---|
11177 | throw formatWarnErrorMessage(nrule, at - 1, t("additional rule no sense"))
|
---|
11178 | } else {
|
---|
11179 | throw formatWarnErrorMessage(nrule, at, t("unexpected token holiday", {
|
---|
11180 | token: tokens[at][1]
|
---|
11181 | }))
|
---|
11182 | }
|
---|
11183 | if (!matchTokens(tokens, at, ","))
|
---|
11184 | break
|
---|
11185 | }
|
---|
11186 | return at
|
---|
11187 | }
|
---|
11188 |
|
---|
11189 | function getValueForDate(date, include_year) {
|
---|
11190 | return (include_year ? date.getFullYear() * 1e4 : 0) + date.getMonth() * 100 + date.getDate()
|
---|
11191 | }
|
---|
11192 |
|
---|
11193 | function getSHForYear(SH_hash, year, fatal) {
|
---|
11194 | if (typeof fatal !== "boolean") {
|
---|
11195 | fatal = true
|
---|
11196 | }
|
---|
11197 | var holiday = SH_hash[year];
|
---|
11198 | if (typeof holiday === "undefined") {
|
---|
11199 | holiday = SH_hash["default"];
|
---|
11200 | if (typeof holiday === "undefined") {
|
---|
11201 | if (fatal) {
|
---|
11202 | throw formatLibraryBugMessage(t("no SH definition", {
|
---|
11203 | name: SH_hash.name,
|
---|
11204 | year: year,
|
---|
11205 | repository_url: repository_url
|
---|
11206 | }), "library bug PR only")
|
---|
11207 | } else {
|
---|
11208 | return undefined
|
---|
11209 | }
|
---|
11210 | }
|
---|
11211 | }
|
---|
11212 | return holiday
|
---|
11213 | }
|
---|
11214 |
|
---|
11215 | function getMatchingHoliday(type_of_holidays) {
|
---|
11216 | if (typeof location_cc === "string") {
|
---|
11217 | if (holiday_definitions.hasOwnProperty(location_cc)) {
|
---|
11218 | if (typeof location_state === "string" && typeof holiday_definitions[location_cc][location_state] === "object" && typeof holiday_definitions[location_cc][location_state][type_of_holidays] === "object") {
|
---|
11219 | return holiday_definitions[location_cc][location_state][type_of_holidays]
|
---|
11220 | } else if (holiday_definitions[location_cc][type_of_holidays]) {
|
---|
11221 | var applying_holidays_for_country = holiday_definitions[location_cc][type_of_holidays];
|
---|
11222 | var matching_holiday = {};
|
---|
11223 | switch (type_of_holidays) {
|
---|
11224 | case "PH":
|
---|
11225 | for (var holiday_name in applying_holidays_for_country) {
|
---|
11226 | if (typeof applying_holidays_for_country[holiday_name][2] === "object") {
|
---|
11227 | if (-1 !== applying_holidays_for_country[holiday_name][2].indexOf(location_state)) {
|
---|
11228 | matching_holiday[holiday_name] = applying_holidays_for_country[holiday_name]
|
---|
11229 | }
|
---|
11230 | } else {
|
---|
11231 | matching_holiday[holiday_name] = applying_holidays_for_country[holiday_name]
|
---|
11232 | }
|
---|
11233 | }
|
---|
11234 | break;
|
---|
11235 | case "SH":
|
---|
11236 | matching_holiday = applying_holidays_for_country;
|
---|
11237 | break
|
---|
11238 | }
|
---|
11239 | if (Object.keys(matching_holiday).length === 0) {
|
---|
11240 | throw formatLibraryBugMessage(t("no holiday definition", {
|
---|
11241 | name: type_of_holidays,
|
---|
11242 | cc: location_cc
|
---|
11243 | }), "library bug PR only")
|
---|
11244 | }
|
---|
11245 | return matching_holiday
|
---|
11246 | } else {
|
---|
11247 | throw formatLibraryBugMessage(t("no holiday definition state", {
|
---|
11248 | name: type_of_holidays,
|
---|
11249 | cc: location_cc,
|
---|
11250 | state: location_state
|
---|
11251 | }), "library bug PR only")
|
---|
11252 | }
|
---|
11253 | } else {
|
---|
11254 | throw formatLibraryBugMessage(t("no holiday definition", {
|
---|
11255 | name: type_of_holidays,
|
---|
11256 | cc: location_cc
|
---|
11257 | }), "library bug PR only")
|
---|
11258 | }
|
---|
11259 | } else {
|
---|
11260 | throw t("no country code")
|
---|
11261 | }
|
---|
11262 | }
|
---|
11263 |
|
---|
11264 | function getMovableEventsForYear(year) {
|
---|
11265 | var C = Math.floor(year / 100);
|
---|
11266 | var N = year - 19 * Math.floor(year / 19);
|
---|
11267 | var K = Math.floor((C - 17) / 25);
|
---|
11268 | var I = C - Math.floor(C / 4) - Math.floor((C - K) / 3) + 19 * N + 15;
|
---|
11269 | I = I - 30 * Math.floor(I / 30);
|
---|
11270 | I = I - Math.floor(I / 28) * (1 - Math.floor(I / 28) * Math.floor(29 / (I + 1)) * Math.floor((21 - N) / 11));
|
---|
11271 | var J = year + Math.floor(year / 4) + I + 2 - C + Math.floor(C / 4);
|
---|
11272 | J = J - 7 * Math.floor(J / 7);
|
---|
11273 | var L = I - J;
|
---|
11274 | var M = 3 + Math.floor((L + 40) / 44);
|
---|
11275 | var D = L + 28 - 31 * Math.floor(M / 4);
|
---|
11276 | var oA = year % 4;
|
---|
11277 | var oB = year % 7;
|
---|
11278 | var oC = year % 19;
|
---|
11279 | var oD = (19 * oC + 15) % 30;
|
---|
11280 | var oE = (2 * oA + 4 * oB - oD + 34) % 7;
|
---|
11281 | var oF = oD + oE;
|
---|
11282 | var oDate;
|
---|
11283 | if (oF < 9) {
|
---|
11284 | oDate = new Date(year, 4 - 1, oF + 4)
|
---|
11285 | } else {
|
---|
11286 | if (oF + 4 < 31) {
|
---|
11287 | oDate = new Date(year, 4 - 1, oF + 4)
|
---|
11288 | } else {
|
---|
11289 | oDate = new Date(year, 5 - 1, oF - 26)
|
---|
11290 | }
|
---|
11291 | }
|
---|
11292 | var lastFebruaryDay = new Date(year, 2, 0);
|
---|
11293 | var lastFebruarySunday = lastFebruaryDay.getDate() - lastFebruaryDay.getDay();
|
---|
11294 | var may_24 = new Date(year, 4, 24);
|
---|
11295 | var victoriaDay = 24 - (6 + may_24.getDay()) % 7;
|
---|
11296 | var july_1 = new Date(year, 6, 1);
|
---|
11297 | var canadaDay = july_1.getDay() === 0 ? 2 : 1;
|
---|
11298 |
|
---|
11299 | function firstWeekdayOfMonth(month, weekday) {
|
---|
11300 | var first = new Date(year, month, 1);
|
---|
11301 | return 1 + (7 + weekday - first.getDay()) % 7
|
---|
11302 | }
|
---|
11303 |
|
---|
11304 | function lastWeekdayOfMonth(month, weekday) {
|
---|
11305 | var last = new Date(year, month + 1, 0);
|
---|
11306 | var offset = (7 + last.getDay() - weekday) % 7;
|
---|
11307 | return last.getDate() - offset
|
---|
11308 | }
|
---|
11309 |
|
---|
11310 | function getDateOfWeekdayInDateRange(weekday, start_date) {
|
---|
11311 | var days_to_dest_date = weekday - start_date.getDay();
|
---|
11312 | if (days_to_dest_date < 0) {
|
---|
11313 | days_to_dest_date += 7
|
---|
11314 | }
|
---|
11315 | start_date.setDate(start_date.getDate() + days_to_dest_date);
|
---|
11316 | return start_date
|
---|
11317 | }
|
---|
11318 | return {
|
---|
11319 | easter: new Date(year, M - 1, D),
|
---|
11320 | "orthodox easter": oDate,
|
---|
11321 | victoriaDay: new Date(year, 4, victoriaDay),
|
---|
11322 | canadaDay: new Date(year, 6, canadaDay),
|
---|
11323 | firstJanuaryMonday: new Date(year, 0, firstWeekdayOfMonth(0, 1)),
|
---|
11324 | firstFebruaryMonday: new Date(year, 1, firstWeekdayOfMonth(1, 1)),
|
---|
11325 | lastFebruarySunday: new Date(year, 1, lastFebruarySunday),
|
---|
11326 | firstMarchMonday: new Date(year, 2, firstWeekdayOfMonth(2, 1)),
|
---|
11327 | firstAprilMonday: new Date(year, 3, firstWeekdayOfMonth(3, 1)),
|
---|
11328 | firstMayMonday: new Date(year, 4, firstWeekdayOfMonth(4, 1)),
|
---|
11329 | firstJuneMonday: new Date(year, 5, firstWeekdayOfMonth(5, 1)),
|
---|
11330 | firstJulyMonday: new Date(year, 6, firstWeekdayOfMonth(6, 1)),
|
---|
11331 | firstAugustMonday: new Date(year, 7, firstWeekdayOfMonth(7, 1)),
|
---|
11332 | firstSeptemberMonday: new Date(year, 8, firstWeekdayOfMonth(8, 1)),
|
---|
11333 | firstSeptemberSunday: new Date(year, 8, firstWeekdayOfMonth(8, 0)),
|
---|
11334 | firstOctoberMonday: new Date(year, 9, firstWeekdayOfMonth(9, 1)),
|
---|
11335 | firstNovemberMonday: new Date(year, 10, firstWeekdayOfMonth(10, 1)),
|
---|
11336 | firstMarchTuesday: new Date(year, 2, firstWeekdayOfMonth(2, 2)),
|
---|
11337 | firstAugustTuesday: new Date(year, 7, firstWeekdayOfMonth(7, 2)),
|
---|
11338 | firstAugustFriday: new Date(year, 7, firstWeekdayOfMonth(7, 5)),
|
---|
11339 | firstNovemberThursday: new Date(year, 10, firstWeekdayOfMonth(10, 4)),
|
---|
11340 | lastMayMonday: new Date(year, 4, lastWeekdayOfMonth(4, 1)),
|
---|
11341 | lastMarchMonday: new Date(year, 2, lastWeekdayOfMonth(2, 1)),
|
---|
11342 | lastAprilMonday: new Date(year, 3, lastWeekdayOfMonth(3, 1)),
|
---|
11343 | lastAprilFriday: new Date(year, 3, lastWeekdayOfMonth(3, 5)),
|
---|
11344 | lastOctoberFriday: new Date(year, 9, lastWeekdayOfMonth(9, 5)),
|
---|
11345 | nextSaturday20Jun: getDateOfWeekdayInDateRange(6, new Date(year, 5, 20)),
|
---|
11346 | nextSaturday31Oct: getDateOfWeekdayInDateRange(6, new Date(year, 9, 31)),
|
---|
11347 | nextWednesday16Nov: getDateOfWeekdayInDateRange(3, new Date(year, 10, 16))
|
---|
11348 | }
|
---|
11349 | }
|
---|
11350 |
|
---|
11351 | function getApplyingHolidaysForYear(applying_holidays, year, add_days) {
|
---|
11352 | var movableDays = getMovableEventsForYear(year);
|
---|
11353 | var sorted_holidays = [];
|
---|
11354 | var next_holiday;
|
---|
11355 | for (var holiday_name in applying_holidays) {
|
---|
11356 | if (typeof applying_holidays[holiday_name][0] === "string") {
|
---|
11357 | var selected_movableDay = movableDays[applying_holidays[holiday_name][0]];
|
---|
11358 | if (!selected_movableDay)
|
---|
11359 | throw t("movable no formula", {
|
---|
11360 | name: applying_holidays[holiday_name][0]
|
---|
11361 | });
|
---|
11362 | next_holiday = new Date(selected_movableDay.getFullYear(), selected_movableDay.getMonth(), selected_movableDay.getDate() + applying_holidays[holiday_name][1]);
|
---|
11363 | if (year !== next_holiday.getFullYear())
|
---|
11364 | throw t("movable not in year", {
|
---|
11365 | name: applying_holidays[holiday_name][0],
|
---|
11366 | days: applying_holidays[holiday_name][1]
|
---|
11367 | })
|
---|
11368 | } else {
|
---|
11369 | next_holiday = new Date(year, applying_holidays[holiday_name][0] - 1, applying_holidays[holiday_name][1])
|
---|
11370 | }
|
---|
11371 | if (add_days[0])
|
---|
11372 | next_holiday.setDate(next_holiday.getDate() + add_days[0]);
|
---|
11373 | sorted_holidays.push([next_holiday, holiday_name])
|
---|
11374 | }
|
---|
11375 | sorted_holidays = sorted_holidays.sort(function (a, b) {
|
---|
11376 | if (a[0].getTime() < b[0].getTime())
|
---|
11377 | return -1;
|
---|
11378 | if (a[0].getTime() > b[0].getTime())
|
---|
11379 | return 1;
|
---|
11380 | return 0
|
---|
11381 | });
|
---|
11382 | return sorted_holidays
|
---|
11383 | }
|
---|
11384 |
|
---|
11385 | function parseYearRange(tokens, at) {
|
---|
11386 | tokens[at][3] = "year";
|
---|
11387 | for (; at < tokens.length; at++) {
|
---|
11388 | if (matchTokens(tokens, at, "year")) {
|
---|
11389 | var is_range = false,
|
---|
11390 | has_period, period;
|
---|
11391 | if (matchTokens(tokens, at + 1, "-", "year", "/", "number")) {
|
---|
11392 | is_range = true;
|
---|
11393 | has_period = true;
|
---|
11394 | period = parseInt(tokens[at + 4][0]);
|
---|
11395 | checkPeriod(at + 4, period, "year")
|
---|
11396 | } else {
|
---|
11397 | is_range = matchTokens(tokens, at + 1, "-", "year");
|
---|
11398 | has_period = matchTokens(tokens, at + 1, "/", "number");
|
---|
11399 | if (has_period) {
|
---|
11400 | period = parseInt(tokens[at + 2][0]);
|
---|
11401 | checkPeriod(at + 2, period, "year", "no_end_year")
|
---|
11402 | } else if (matchTokens(tokens, at + 1, "+")) {
|
---|
11403 | period = 1;
|
---|
11404 | has_period = 2
|
---|
11405 | }
|
---|
11406 | }
|
---|
11407 | var year_from = parseInt(tokens[at][0]);
|
---|
11408 | if (is_range && tokens[at + 2][0] <= year_from) {
|
---|
11409 | if (tokens[at + 2][0] === year_from) {
|
---|
11410 | throw formatWarnErrorMessage(nrule, at, t("year range one year", {
|
---|
11411 | year: year_from
|
---|
11412 | }))
|
---|
11413 | } else {
|
---|
11414 | throw formatWarnErrorMessage(nrule, at, t("year range reverse"))
|
---|
11415 | }
|
---|
11416 | }
|
---|
11417 | if (!is_range && year_from < (new Date).getFullYear()) {
|
---|
11418 | parsing_warnings.push([nrule, at, t("year past")])
|
---|
11419 | }
|
---|
11420 | if (is_range && tokens[at + 2][0] < (new Date).getFullYear()) {
|
---|
11421 | parsing_warnings.push([nrule, at + 2, t("year past")])
|
---|
11422 | }
|
---|
11423 | selectors.year.push(function (tokens, at, year_from, is_range, has_period, period) {
|
---|
11424 | return function (date) {
|
---|
11425 | var ouryear = date.getFullYear();
|
---|
11426 | var year_to = is_range ? parseInt(tokens[at + 2][0]) : year_from;
|
---|
11427 | if (ouryear < year_from) {
|
---|
11428 | return [false, new Date(year_from, 0, 1)]
|
---|
11429 | } else if (has_period) {
|
---|
11430 | if (year_from <= ouryear) {
|
---|
11431 | if (is_range && ouryear > year_to)
|
---|
11432 | return [false];
|
---|
11433 | if (period > 0) {
|
---|
11434 | if ((ouryear - year_from) % period === 0) {
|
---|
11435 | return [true, new Date(ouryear + 1, 0, 1)]
|
---|
11436 | } else {
|
---|
11437 | return [false, new Date(ouryear + period - 1, 0, 1)]
|
---|
11438 | }
|
---|
11439 | }
|
---|
11440 | }
|
---|
11441 | } else if (is_range) {
|
---|
11442 | if (ouryear <= year_to)
|
---|
11443 | return [true, new Date(year_to + 1, 0, 1)]
|
---|
11444 | } else if (ouryear === year_from) {
|
---|
11445 | return [true]
|
---|
11446 | }
|
---|
11447 | return [false]
|
---|
11448 | }
|
---|
11449 | }(tokens, at, year_from, is_range, has_period, period));
|
---|
11450 | at += 1 + (is_range ? 2 : 0) + (has_period ? has_period === 2 ? 1 : 2 : 0)
|
---|
11451 | } else if (matchTokens(tokens, at - 1, ",")) {
|
---|
11452 | throw formatWarnErrorMessage(nrule, at - 1, t("additional rule no sense"))
|
---|
11453 | } else {
|
---|
11454 | throw formatWarnErrorMessage(nrule, at, t("unexpected token year range", {
|
---|
11455 | token: tokens[at][1]
|
---|
11456 | }))
|
---|
11457 | }
|
---|
11458 | if (!matchTokens(tokens, at, ","))
|
---|
11459 | break
|
---|
11460 | }
|
---|
11461 | return at
|
---|
11462 | }
|
---|
11463 |
|
---|
11464 | function parseWeekRange(tokens, at) {
|
---|
11465 | for (; at < tokens.length; at++) {
|
---|
11466 | if (matchTokens(tokens, at, "week")) {
|
---|
11467 | at++
|
---|
11468 | }
|
---|
11469 | if (matchTokens(tokens, at, "number")) {
|
---|
11470 | var is_range = matchTokens(tokens, at + 1, "-", "number"),
|
---|
11471 | period = 0;
|
---|
11472 | var week_from = tokens[at][0];
|
---|
11473 | var week_to = is_range ? tokens[at + 2][0] : week_from;
|
---|
11474 | if (week_from > week_to) {
|
---|
11475 | throw formatWarnErrorMessage(nrule, at + 2, t("week range reverse"))
|
---|
11476 | }
|
---|
11477 | if (week_from < 1) {
|
---|
11478 | throw formatWarnErrorMessage(nrule, at, t("week negative"))
|
---|
11479 | }
|
---|
11480 | if (week_to > 53) {
|
---|
11481 | throw formatWarnErrorMessage(nrule, is_range ? at + 2 : at, t("week exceed"))
|
---|
11482 | }
|
---|
11483 | if (is_range) {
|
---|
11484 | period = matchTokens(tokens, at + 3, "/", "number");
|
---|
11485 | if (period) {
|
---|
11486 | period = tokens[at + 4][0];
|
---|
11487 | if (period < 2) {
|
---|
11488 | throw formatWarnErrorMessage(nrule, at + 4, t("week period less than 2", {
|
---|
11489 | weekfrom: week_from,
|
---|
11490 | weekto: week_to,
|
---|
11491 | period: period
|
---|
11492 | }))
|
---|
11493 | } else if (period > 26) {
|
---|
11494 | throw formatWarnErrorMessage(nrule, at + 4, t("week period greater than 26", {
|
---|
11495 | weekfrom: week_from
|
---|
11496 | }))
|
---|
11497 | }
|
---|
11498 | }
|
---|
11499 | }
|
---|
11500 | if (week_stable && (!(week_from <= 1 && week_to >= 53) || period)) {
|
---|
11501 | week_stable = false
|
---|
11502 | }
|
---|
11503 | if (!period && week_from === 1 && week_to === 53) {
|
---|
11504 | selectors.week.push(function () {
|
---|
11505 | return [true]
|
---|
11506 | })
|
---|
11507 | } else {
|
---|
11508 | selectors.week.push(function (week_from, week_to, period) {
|
---|
11509 | return function (date) {
|
---|
11510 | var ourweek = getWeekNumber(date);
|
---|
11511 | if (ourweek < week_from) {
|
---|
11512 | return [false, getNextDateOfISOWeek(week_from, date)]
|
---|
11513 | }
|
---|
11514 | if (ourweek > week_to) {
|
---|
11515 | return [false, getNextDateOfISOWeek(week_from, date)]
|
---|
11516 | }
|
---|
11517 | if (period) {
|
---|
11518 | var in_period = (ourweek - week_from) % period === 0;
|
---|
11519 | if (in_period) {
|
---|
11520 | return [true, getNextDateOfISOWeek(ourweek + 1, date)]
|
---|
11521 | } else {
|
---|
11522 | return [false, getNextDateOfISOWeek(ourweek + period - 1, date)]
|
---|
11523 | }
|
---|
11524 | }
|
---|
11525 | return [true, getNextDateOfISOWeek(week_to === 53 ? 1 : week_to + 1, date)]
|
---|
11526 | }
|
---|
11527 | }(week_from, week_to, period))
|
---|
11528 | }
|
---|
11529 | at += 1 + (is_range ? 2 : 0) + (period ? 2 : 0)
|
---|
11530 | } else if (matchTokens(tokens, at - 1, ",")) {
|
---|
11531 | throw formatWarnErrorMessage(nrule, at - 1, t("additional rule no sense"))
|
---|
11532 | } else {
|
---|
11533 | throw formatWarnErrorMessage(nrule, at, t("unexpected token week range", {
|
---|
11534 | token: tokens[at][1]
|
---|
11535 | }))
|
---|
11536 | }
|
---|
11537 | if (!matchTokens(tokens, at, ","))
|
---|
11538 | break
|
---|
11539 | }
|
---|
11540 | return at
|
---|
11541 | }
|
---|
11542 |
|
---|
11543 | function getWeekNumber(d) {
|
---|
11544 | d = new Date(+d);
|
---|
11545 | d.setHours(0, 0, 0, 0);
|
---|
11546 | d.setDate(d.getDate() + 4 - (d.getDay() || 7));
|
---|
11547 | var yearStart = new Date(d.getFullYear(), 0, 1);
|
---|
11548 | return Math.ceil(((d - yearStart) / 864e5 + 1) / 7)
|
---|
11549 | }
|
---|
11550 |
|
---|
11551 | function getDateOfISOWeek(w, year) {
|
---|
11552 | var simple = new Date(year, 0, 1 + (w - 1) * 7);
|
---|
11553 | var dow = simple.getDay();
|
---|
11554 | var ISOweekStart = simple;
|
---|
11555 | if (dow <= 4)
|
---|
11556 | ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
|
---|
11557 | else
|
---|
11558 | ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
|
---|
11559 | return ISOweekStart
|
---|
11560 | }
|
---|
11561 |
|
---|
11562 | function getNextDateOfISOWeek(week, date) {
|
---|
11563 | var next_date;
|
---|
11564 | for (var i = -1; i <= 1; i++) {
|
---|
11565 | next_date = getDateOfISOWeek(week, date.getFullYear() + i);
|
---|
11566 | if (next_date.getTime() > date.getTime()) {
|
---|
11567 | return next_date
|
---|
11568 | }
|
---|
11569 | }
|
---|
11570 | throw formatLibraryBugMessage()
|
---|
11571 | }
|
---|
11572 |
|
---|
11573 | function parseMonthRange(tokens, at, push_to_monthday, in_selector) {
|
---|
11574 | if (!in_selector)
|
---|
11575 | tokens[at][3] = "month";
|
---|
11576 | for (; at < tokens.length; at++) {
|
---|
11577 | if (matchTokens(tokens, at, "month", "number") && !matchTokens(tokens, at + 2, "timesep", "number")) {
|
---|
11578 | return parseMonthdayRange(tokens, at, nrule, true)
|
---|
11579 | } else if (matchTokens(tokens, at, "month")) {
|
---|
11580 | var is_range = matchTokens(tokens, at + 1, "-", "month");
|
---|
11581 | var month_from = tokens[at][0];
|
---|
11582 | var month_to = is_range ? tokens[at + 2][0] : month_from;
|
---|
11583 | if (is_range && week_stable) {
|
---|
11584 | if (month_from !== (month_to + 1) % 12)
|
---|
11585 | week_stable = false
|
---|
11586 | } else {
|
---|
11587 | week_stable = false
|
---|
11588 | }
|
---|
11589 | var inside = true;
|
---|
11590 | if (month_to < month_from) {
|
---|
11591 | var tmp = month_to;
|
---|
11592 | month_to = month_from - 1;
|
---|
11593 | month_from = tmp + 1;
|
---|
11594 | inside = false
|
---|
11595 | }
|
---|
11596 | var selector = function (month_from, month_to, inside) {
|
---|
11597 | return function (date) {
|
---|
11598 | var ourmonth = date.getMonth();
|
---|
11599 | if (month_to < month_from) {
|
---|
11600 | return [!inside]
|
---|
11601 | }
|
---|
11602 | if (ourmonth < month_from || ourmonth > month_to) {
|
---|
11603 | return [!inside, dateAtNextMonth(date, month_from)]
|
---|
11604 | } else {
|
---|
11605 | return [inside, dateAtNextMonth(date, month_to + 1)]
|
---|
11606 | }
|
---|
11607 | }
|
---|
11608 | }(month_from, month_to, inside);
|
---|
11609 | if (push_to_monthday === true)
|
---|
11610 | selectors.monthday.push(selector);
|
---|
11611 | else
|
---|
11612 | selectors.month.push(selector);
|
---|
11613 | at += is_range ? 3 : 1
|
---|
11614 | } else {
|
---|
11615 | throw formatWarnErrorMessage(nrule, at, t("unexpected token month range", {
|
---|
11616 | token: tokens[at][1]
|
---|
11617 | }))
|
---|
11618 | }
|
---|
11619 | if (!matchTokens(tokens, at, ","))
|
---|
11620 | break
|
---|
11621 | }
|
---|
11622 | return at
|
---|
11623 | }
|
---|
11624 |
|
---|
11625 | function dateAtNextMonth(date, month) {
|
---|
11626 | return new Date(date.getFullYear(), month < date.getMonth() ? month + 12 : month)
|
---|
11627 | }
|
---|
11628 |
|
---|
11629 | function parseMonthdayRange(tokens, at, nrule, push_to_month) {
|
---|
11630 | if (!push_to_month)
|
---|
11631 | tokens[at][3] = "month";
|
---|
11632 | for (; at < tokens.length; at++) {
|
---|
11633 | var has_year = [],
|
---|
11634 | has_month = [],
|
---|
11635 | has_event = [],
|
---|
11636 | has_calc = [],
|
---|
11637 | has_constrained_weekday = [];
|
---|
11638 | has_year[0] = matchTokens(tokens, at, "year");
|
---|
11639 | has_month[0] = matchTokens(tokens, at + has_year[0], "month", "number");
|
---|
11640 | has_event[0] = matchTokens(tokens, at + has_year[0], "event");
|
---|
11641 | if (has_event[0])
|
---|
11642 | has_calc[0] = getMoveDays(tokens, at + has_year[0] + 1, 200, "event like easter");
|
---|
11643 | var at_range_sep;
|
---|
11644 | if (matchTokens(tokens, at + has_year[0], "month", "weekday", "[")) {
|
---|
11645 | has_constrained_weekday[0] = getConstrainedWeekday(tokens, at + has_year[0] + 3);
|
---|
11646 | has_calc[0] = getMoveDays(tokens, has_constrained_weekday[0][1], 6, "constrained weekdays");
|
---|
11647 | at_range_sep = has_constrained_weekday[0][1] + (typeof has_calc[0] === "object" && has_calc[0][1] ? 3 : 0)
|
---|
11648 | } else {
|
---|
11649 | at_range_sep = at + has_year[0] + (has_event[0] ? typeof has_calc[0] === "object" && has_calc[0][1] ? 4 : 1 : 2)
|
---|
11650 | }
|
---|
11651 | var at_sec_event_or_month;
|
---|
11652 | if ((has_month[0] || has_event[0] || has_constrained_weekday[0]) && matchTokens(tokens, at_range_sep, "-")) {
|
---|
11653 | has_year[1] = matchTokens(tokens, at_range_sep + 1, "year");
|
---|
11654 | at_sec_event_or_month = at_range_sep + 1 + has_year[1];
|
---|
11655 | has_month[1] = matchTokens(tokens, at_sec_event_or_month, "month", "number");
|
---|
11656 | if (!has_month[1]) {
|
---|
11657 | has_event[1] = matchTokens(tokens, at_sec_event_or_month, "event");
|
---|
11658 | if (has_event[1]) {
|
---|
11659 | has_calc[1] = getMoveDays(tokens, at_sec_event_or_month + 1, 366, "event like easter")
|
---|
11660 | } else if (matchTokens(tokens, at_sec_event_or_month, "month", "weekday", "[")) {
|
---|
11661 | has_constrained_weekday[1] = getConstrainedWeekday(tokens, at_sec_event_or_month + 3);
|
---|
11662 | has_calc[1] = getMoveDays(tokens, has_constrained_weekday[1][1], 6, "constrained weekdays")
|
---|
11663 | }
|
---|
11664 | }
|
---|
11665 | }
|
---|
11666 | if (has_year[0] === has_year[1] && (has_month[1] || has_event[1] || has_constrained_weekday[1])) {
|
---|
11667 | if (has_month[0])
|
---|
11668 | checkIfDateIsValid(tokens[at + has_year[0]][0], tokens[at + has_year[0] + 1][0], nrule, at + has_year[0] + 1);
|
---|
11669 | if (has_month[1])
|
---|
11670 | checkIfDateIsValid(tokens[at_sec_event_or_month][0], tokens[at_sec_event_or_month + 1][0], nrule, at_sec_event_or_month + 1);
|
---|
11671 | var selector = function (tokens, at, nrule, has_year, has_event, has_calc, at_sec_event_or_month, has_constrained_weekday) {
|
---|
11672 | return function (date) {
|
---|
11673 | var start_of_next_year = new Date(date.getFullYear() + 1, 0, 1);
|
---|
11674 | var movableDays, from_date;
|
---|
11675 | if (has_event[0]) {
|
---|
11676 | movableDays = getMovableEventsForYear(has_year[0] ? parseInt(tokens[at][0]) : date.getFullYear());
|
---|
11677 | from_date = movableDays[tokens[at + has_year[0]][0]];
|
---|
11678 | if (typeof has_calc[0] === "object" && has_calc[0][1]) {
|
---|
11679 | var from_year_before_calc = from_date.getFullYear();
|
---|
11680 | from_date.setDate(from_date.getDate() + has_calc[0][0]);
|
---|
11681 | if (from_year_before_calc !== from_date.getFullYear())
|
---|
11682 | throw formatWarnErrorMessage(nrule, at + has_year[0] + has_calc[0][1] * 3, t("movable not in year", {
|
---|
11683 | name: tokens[at + has_year[0]][0],
|
---|
11684 | days: has_calc[0][0]
|
---|
11685 | }))
|
---|
11686 | }
|
---|
11687 | } else if (has_constrained_weekday[0]) {
|
---|
11688 | from_date = getDateForConstrainedWeekday(has_year[0] ? tokens[at][0] : date.getFullYear(), tokens[at + has_year[0]][0], tokens[at + has_year[0] + 1][0], has_constrained_weekday[0], has_calc[0])
|
---|
11689 | } else {
|
---|
11690 | from_date = new Date(has_year[0] ? tokens[at][0] : date.getFullYear(), tokens[at + has_year[0]][0], tokens[at + has_year[0] + 1][0])
|
---|
11691 | }
|
---|
11692 | var to_date;
|
---|
11693 | if (has_event[1]) {
|
---|
11694 | movableDays = getMovableEventsForYear(has_year[1] ? parseInt(tokens[at_sec_event_or_month - 1][0]) : date.getFullYear());
|
---|
11695 | to_date = movableDays[tokens[at_sec_event_or_month][0]];
|
---|
11696 | if (typeof has_calc[1] === "object" && has_calc[1][1]) {
|
---|
11697 | var to_year_before_calc = to_date.getFullYear();
|
---|
11698 | to_date.setDate(to_date.getDate() + has_calc[1][0]);
|
---|
11699 | if (to_year_before_calc !== to_date.getFullYear()) {
|
---|
11700 | throw formatWarnErrorMessage(nrule, at_sec_event_or_month + has_calc[1][1], t("movable not in year", {
|
---|
11701 | name: tokens[at_sec_event_or_month][0],
|
---|
11702 | days: has_calc[1][0]
|
---|
11703 | }))
|
---|
11704 | }
|
---|
11705 | }
|
---|
11706 | } else if (has_constrained_weekday[1]) {
|
---|
11707 | to_date = getDateForConstrainedWeekday(has_year[1] ? tokens[at_sec_event_or_month - 1][0] : date.getFullYear(), tokens[at_sec_event_or_month][0], tokens[at_sec_event_or_month + 1][0], has_constrained_weekday[1], has_calc[1])
|
---|
11708 | } else {
|
---|
11709 | to_date = new Date(has_year[1] ? tokens[at_sec_event_or_month - 1][0] : date.getFullYear(), tokens[at_sec_event_or_month][0], tokens[at_sec_event_or_month + 1][0] + 1)
|
---|
11710 | }
|
---|
11711 | var inside = true;
|
---|
11712 | if (to_date < from_date) {
|
---|
11713 | var tmp = to_date;
|
---|
11714 | to_date = from_date;
|
---|
11715 | from_date = tmp;
|
---|
11716 | inside = false
|
---|
11717 | }
|
---|
11718 | if (date.getTime() < from_date.getTime()) {
|
---|
11719 | return [!inside, from_date]
|
---|
11720 | } else if (date.getTime() < to_date.getTime()) {
|
---|
11721 | return [inside, to_date]
|
---|
11722 | } else {
|
---|
11723 | if (has_year[0]) {
|
---|
11724 | return [!inside]
|
---|
11725 | } else {
|
---|
11726 | return [!inside, start_of_next_year]
|
---|
11727 | }
|
---|
11728 | }
|
---|
11729 | }
|
---|
11730 | }(tokens, at, nrule, has_year, has_event, has_calc, at_sec_event_or_month, has_constrained_weekday);
|
---|
11731 | if (push_to_month === true)
|
---|
11732 | selectors.month.push(selector);
|
---|
11733 | else
|
---|
11734 | selectors.monthday.push(selector);
|
---|
11735 | at = (has_constrained_weekday[1] ? has_constrained_weekday[1][1] : at_sec_event_or_month + (has_event[1] ? 1 : 2)) + (typeof has_calc[1] === "object" ? has_calc[1][1] : 0)
|
---|
11736 | } else if (has_month[0]) {
|
---|
11737 | has_year = has_year[0];
|
---|
11738 | var year = tokens[at][0];
|
---|
11739 | var month = tokens[at + has_year][0];
|
---|
11740 | var first_round = true;
|
---|
11741 | do {
|
---|
11742 | var range_from = tokens[at + 1 + has_year][0];
|
---|
11743 | var is_range = matchTokens(tokens, at + 2 + has_year, "-", "number");
|
---|
11744 | var period = undefined;
|
---|
11745 | var range_to = tokens[at + has_year + (is_range ? 3 : 1)][0] + 1;
|
---|
11746 | if (is_range && matchTokens(tokens, at + has_year + 4, "/", "number")) {
|
---|
11747 | period = tokens[at + has_year + 5][0];
|
---|
11748 | checkPeriod(at + has_year + 5, period, "day")
|
---|
11749 | }
|
---|
11750 | if (first_round) {
|
---|
11751 | var at_timesep_if_monthRange = at + has_year + 1 + (is_range ? 2 : 0) + (period ? 2 : 0) + !(is_range || period);
|
---|
11752 | if (matchTokens(tokens, at_timesep_if_monthRange, "timesep", "number") && (matchTokens(tokens, at_timesep_if_monthRange + 2, "+") || matchTokens(tokens, at_timesep_if_monthRange + 2, "-") || oh_mode !== 0)) {
|
---|
11753 | return parseMonthRange(tokens, at, true, true)
|
---|
11754 | }
|
---|
11755 | }
|
---|
11756 | if (range_to < range_from)
|
---|
11757 | throw formatWarnErrorMessage(nrule, at + has_year + 3, t("day range reverse"));
|
---|
11758 | checkIfDateIsValid(month, range_from, nrule, at + 1 + has_year);
|
---|
11759 | checkIfDateIsValid(month, range_to - 1, nrule, at + has_year + (is_range ? 3 : 1));
|
---|
11760 | var selector = function (year, has_year, month, range_from, range_to, period) {
|
---|
11761 | return function (date) {
|
---|
11762 | var start_of_next_year = new Date(date.getFullYear() + 1, 0, 1);
|
---|
11763 | var from_date = new Date(has_year ? year : date.getFullYear(), month, range_from);
|
---|
11764 | if (month === 1 && range_from !== from_date.getDate())
|
---|
11765 | return [false];
|
---|
11766 | var to_date = new Date(from_date.getFullYear(), month, range_to);
|
---|
11767 | if (month === 1 && is_range && range_to !== to_date.getDate())
|
---|
11768 | return [false];
|
---|
11769 | if (date.getTime() < from_date.getTime())
|
---|
11770 | return [false, from_date];
|
---|
11771 | else if (date.getTime() >= to_date.getTime())
|
---|
11772 | return [false, start_of_next_year];
|
---|
11773 | else if (!period)
|
---|
11774 | return [true, to_date];
|
---|
11775 | var nday = Math.floor((date.getTime() - from_date.getTime()) / msec_in_day);
|
---|
11776 | var in_period = nday % period;
|
---|
11777 | if (in_period === 0)
|
---|
11778 | return [true, new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1)];
|
---|
11779 | else
|
---|
11780 | return [false, new Date(date.getFullYear(), date.getMonth(), date.getDate() + period - in_period)]
|
---|
11781 | }
|
---|
11782 | }(year, has_year, month, range_from, range_to, period);
|
---|
11783 | if (push_to_month === true)
|
---|
11784 | selectors.month.push(selector);
|
---|
11785 | else
|
---|
11786 | selectors.monthday.push(selector);
|
---|
11787 | at += 2 + has_year + (is_range ? 2 : 0) + (period ? 2 : 0);
|
---|
11788 | first_round = false
|
---|
11789 | } while (matchTokens(tokens, at, ",", "number"))
|
---|
11790 | } else if (has_event[0]) {
|
---|
11791 | var selector = function (tokens, at, nrule, has_year, add_days) {
|
---|
11792 | return function (date) {
|
---|
11793 | var movableDays = getMovableEventsForYear(has_year ? tokens[at][0] : date.getFullYear());
|
---|
11794 | var event_date = movableDays[tokens[at + has_year][0]];
|
---|
11795 | if (!event_date)
|
---|
11796 | throw t("movable no formula", {
|
---|
11797 | name: tokens[at + has_year][0]
|
---|
11798 | });
|
---|
11799 | if (add_days[0]) {
|
---|
11800 | event_date.setDate(event_date.getDate() + add_days[0]);
|
---|
11801 | if (date.getFullYear() !== event_date.getFullYear())
|
---|
11802 | throw formatWarnErrorMessage(nrule, at + has_year + add_days[1], t("movable not in year", {
|
---|
11803 | name: tokens[at + has_year][0],
|
---|
11804 | days: add_days[0]
|
---|
11805 | }))
|
---|
11806 | }
|
---|
11807 | if (date.getTime() < event_date.getTime())
|
---|
11808 | return [false, event_date];
|
---|
11809 | else if (event_date.getMonth() * 100 + event_date.getDate() === date.getMonth() * 100 + date.getDate())
|
---|
11810 | return [true, new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1)];
|
---|
11811 | else
|
---|
11812 | return [false, new Date(date.getFullYear() + 1, 0, 1)]
|
---|
11813 | }
|
---|
11814 | }(tokens, at, nrule, has_year[0], has_calc[0]);
|
---|
11815 | if (push_to_month === true)
|
---|
11816 | selectors.month.push(selector);
|
---|
11817 | else
|
---|
11818 | selectors.monthday.push(selector);
|
---|
11819 | at += has_year[0] + has_event[0] + (typeof has_calc[0][1] === "number" && has_calc[0][1] ? 3 : 0)
|
---|
11820 | } else if (has_constrained_weekday[0]) {
|
---|
11821 | at = parseMonthRange(tokens, at)
|
---|
11822 | } else if (matchTokens(tokens, at, "month")) {
|
---|
11823 | return parseMonthRange(tokens, at, true, true)
|
---|
11824 | } else {
|
---|
11825 | return at
|
---|
11826 | }
|
---|
11827 | if (!matchTokens(tokens, at, ","))
|
---|
11828 | break
|
---|
11829 | }
|
---|
11830 | return at
|
---|
11831 | }
|
---|
11832 | this.getStatePair = function (date) {
|
---|
11833 | var resultstate = false;
|
---|
11834 | var changedate;
|
---|
11835 | var unknown = false;
|
---|
11836 | var comment;
|
---|
11837 | var match_rule;
|
---|
11838 | var date_matching_rules = [];
|
---|
11839 | for (var nrule = 0; nrule < rules.length; nrule++) {
|
---|
11840 | var matching_date_rule = true;
|
---|
11841 | for (var ndateselector = 0; ndateselector < rules[nrule].date.length; ndateselector++) {
|
---|
11842 | var dateselectors = rules[nrule].date[ndateselector];
|
---|
11843 | var has_matching_selector = false;
|
---|
11844 | for (var datesel = 0; datesel < dateselectors.length; datesel++) {
|
---|
11845 | var res = dateselectors[datesel](date);
|
---|
11846 | if (res[0]) {
|
---|
11847 | has_matching_selector = true;
|
---|
11848 | if (typeof res[2] === "string") {
|
---|
11849 | comment = [res[2], nrule]
|
---|
11850 | }
|
---|
11851 | }
|
---|
11852 | if (typeof changedate === "undefined" || typeof res[1] === "object" && res[1].getTime() < changedate.getTime())
|
---|
11853 | changedate = res[1]
|
---|
11854 | }
|
---|
11855 | if (!has_matching_selector) {
|
---|
11856 | matching_date_rule = false;
|
---|
11857 | break
|
---|
11858 | }
|
---|
11859 | }
|
---|
11860 | if (matching_date_rule) {
|
---|
11861 | if ((rules[nrule].date.length > 0 || nrule > 0 && rules[nrule].meaning && rules[nrule - 1].date.length === 0) && (rules[nrule].meaning || rules[nrule].unknown) && !rules[nrule].wrapped && !rules[nrule].additional && !rules[nrule].fallback) {
|
---|
11862 | date_matching_rules = []
|
---|
11863 | }
|
---|
11864 | date_matching_rules.push(nrule)
|
---|
11865 | }
|
---|
11866 | }
|
---|
11867 | for (var nrule = 0; nrule < date_matching_rules.length; nrule++) {
|
---|
11868 | var rule = date_matching_rules[nrule];
|
---|
11869 | if (rules[rule].time.length === 0) {
|
---|
11870 | if (!rules[rule].fallback || rules[rule].fallback && !(resultstate || unknown)) {
|
---|
11871 | resultstate = rules[rule].meaning;
|
---|
11872 | unknown = rules[rule].unknown;
|
---|
11873 | match_rule = rule
|
---|
11874 | }
|
---|
11875 | }
|
---|
11876 | for (var timesel = 0; timesel < rules[rule].time.length; timesel++) {
|
---|
11877 | var res = rules[rule].time[timesel](date);
|
---|
11878 | if (res[0]) {
|
---|
11879 | if (!rules[rule].fallback || rules[rule].fallback && !(resultstate || unknown)) {
|
---|
11880 | resultstate = rules[rule].meaning;
|
---|
11881 | unknown = rules[rule].unknown;
|
---|
11882 | match_rule = rule;
|
---|
11883 | if (typeof comment === "object" && comment[0] === t("open end"))
|
---|
11884 | comment = undefined;
|
---|
11885 | if (res[2] === true && (resultstate || unknown)) {
|
---|
11886 | comment = [t("open end"), match_rule];
|
---|
11887 | resultstate = false;
|
---|
11888 | unknown = true;
|
---|
11889 | if (typeof rules[rule].time[timesel + 1] === "function") {
|
---|
11890 | var next_res = rules[rule].time[timesel + 1](date);
|
---|
11891 | if (!next_res[0] && typeof next_res[1] === "object" && rules[rule].time[timesel](new Date(date.getTime() - 1))[0]) {
|
---|
11892 | resultstate = false;
|
---|
11893 | unknown = false
|
---|
11894 | }
|
---|
11895 | }
|
---|
11896 | if (false && typeof rules[rule - 1] === "object" && rules[rule].build_from_token_rule.toString() === rules[rule - 1].build_from_token_rule.toString() && typeof rules[rule] === "object" && rules[rule].build_from_token_rule.toString() === rules[rule].build_from_token_rule.toString()) {
|
---|
11897 | var last_wrapping_time_selector = rules[rule].time[rules[rule].time.length - 1];
|
---|
11898 | var last_w_res = last_wrapping_time_selector(new Date(date.getTime() - 1));
|
---|
11899 | if (last_w_res[0] && typeof last_w_res[2] === "undefined" && (typeof last_w_res[2] === "undefined" || last_w_res[2] === false) && typeof last_w_res[1] === "object" && date.getTime() === last_w_res[1].getTime()) {
|
---|
11900 | resultstate = false;
|
---|
11901 | unknown = false
|
---|
11902 | }
|
---|
11903 | }
|
---|
11904 | }
|
---|
11905 | if (rules[rule].fallback) {
|
---|
11906 | if (typeof changedate === "undefined" || typeof res[1] !== "undefined" && res[1] < changedate) {
|
---|
11907 | changedate = res[1]
|
---|
11908 | }
|
---|
11909 | }
|
---|
11910 | }
|
---|
11911 | }
|
---|
11912 | if (typeof changedate === "undefined" || typeof res[1] === "object" && res[1] < changedate)
|
---|
11913 | changedate = res[1]
|
---|
11914 | }
|
---|
11915 | }
|
---|
11916 | if (typeof rules[match_rule] === "object" && typeof rules[match_rule].comment === "string") {
|
---|
11917 | comment = rules[match_rule].comment
|
---|
11918 | } else if (typeof comment === "object") {
|
---|
11919 | if (comment[1] === match_rule) {
|
---|
11920 | comment = comment[0]
|
---|
11921 | } else {
|
---|
11922 | comment = undefined
|
---|
11923 | }
|
---|
11924 | }
|
---|
11925 | return [resultstate, changedate, unknown, comment, match_rule]
|
---|
11926 | };
|
---|
11927 |
|
---|
11928 | function prettifySelector(tokens, selector_start, selector_end, selector_type, conf) {
|
---|
11929 | var prettified_value = "";
|
---|
11930 | var at = selector_start;
|
---|
11931 | while (at <= selector_end) {
|
---|
11932 | if (matchTokens(tokens, at, "weekday")) {
|
---|
11933 | if (!conf.leave_weekday_sep_one_day_betw && at - selector_start > 1 && (matchTokens(tokens, at - 1, ",") || matchTokens(tokens, at - 1, "-")) && matchTokens(tokens, at - 2, "weekday") && tokens[at][0] === (tokens[at - 2][0] + 1) % 7) {
|
---|
11934 | prettified_value = prettified_value.substring(0, prettified_value.length - 1) + conf.sep_one_day_between
|
---|
11935 | }
|
---|
11936 | prettified_value += weekdays[tokens[at][0]]
|
---|
11937 | } else if (at - selector_start > 0 && selector_type === "time" && matchTokens(tokens, at - 1, "timesep") && matchTokens(tokens, at, "number")) {
|
---|
11938 | prettified_value += (tokens[at][0] < 10 ? "0" : "") + tokens[at][0].toString()
|
---|
11939 | } else if (selector_type === "time" && conf.zero_pad_hour && at !== tokens.length && matchTokens(tokens, at, "number") && matchTokens(tokens, at + 1, "timesep")) {
|
---|
11940 | prettified_value += (tokens[at][0] < 10 ? tokens[at][0] === 0 && conf.one_zero_if_hour_zero ? "" : "0" : "") + tokens[at][0].toString()
|
---|
11941 | } else if (selector_type === "time" && at + 2 <= selector_end && matchTokens(tokens, at, "number") && matchTokens(tokens, at + 1, "-") && matchTokens(tokens, at + 2, "number")) {
|
---|
11942 | prettified_value += (tokens[at][0] < 10 ? tokens[at][0] === 0 && conf.one_zero_if_hour_zero ? "" : "0" : "") + tokens[at][0].toString();
|
---|
11943 | prettified_value += ":00-" + (tokens[at + 2][0] < 10 ? "0" : "") + tokens[at + 2][0].toString() + ":00";
|
---|
11944 | at += 2
|
---|
11945 | } else if (matchTokens(tokens, at, "comment")) {
|
---|
11946 | prettified_value += '"' + tokens[at][0].toString() + '"'
|
---|
11947 | } else if (matchTokens(tokens, at, "closed")) {
|
---|
11948 | prettified_value += conf.leave_off_closed ? tokens[at][0] : conf.keyword_for_off_closed
|
---|
11949 | } else if (at - selector_start > 0 && matchTokens(tokens, at, "number") && (matchTokens(tokens, at - 1, "month") && selector_type === "month" || matchTokens(tokens, at - 1, "week") && selector_type === "week")) {
|
---|
11950 | prettified_value += " " + (conf.zero_pad_month_and_week_numbers && tokens[at][0] < 10 ? "0" : "") + tokens[at][0]
|
---|
11951 | } else if (at - selector_start > 0 && matchTokens(tokens, at, "month") && matchTokens(tokens, at - 1, "year")) {
|
---|
11952 | prettified_value += " " + months[[tokens[at][0]]]
|
---|
11953 | } else if (at - selector_start > 0 && matchTokens(tokens, at, "event") && matchTokens(tokens, at - 1, "year")) {
|
---|
11954 | prettified_value += " " + tokens[at][0]
|
---|
11955 | } else if (matchTokens(tokens, at, "month")) {
|
---|
11956 | prettified_value += months[[tokens[at][0]]];
|
---|
11957 | if (at + 1 <= selector_end && matchTokens(tokens, at + 1, "weekday"))
|
---|
11958 | prettified_value += " "
|
---|
11959 | } else if (at + 2 <= selector_end && (matchTokens(tokens, at, "-") || matchTokens(tokens, at, "+")) && matchTokens(tokens, at + 1, "number", "calcday")) {
|
---|
11960 | prettified_value += " " + tokens[at][0] + tokens[at + 1][0] + " day" + (Math.abs(tokens[at + 1][0]) === 1 ? "" : "s");
|
---|
11961 | at += 2
|
---|
11962 | } else if (at === selector_end && selector_type === "weekday" && tokens[at][0] === ":") {
|
---|
11963 | } else {
|
---|
11964 | prettified_value += tokens[at][0].toString()
|
---|
11965 | }
|
---|
11966 | at++
|
---|
11967 | }
|
---|
11968 | return prettified_value
|
---|
11969 | }
|
---|
11970 | this.getState = function (date) {
|
---|
11971 | var it = this.getIterator(date);
|
---|
11972 | return it.getState()
|
---|
11973 | };
|
---|
11974 | this.getUnknown = function (date) {
|
---|
11975 | var it = this.getIterator(date);
|
---|
11976 | return it.getUnknown()
|
---|
11977 | };
|
---|
11978 | this.getStateString = function (date, past) {
|
---|
11979 | var it = this.getIterator(date);
|
---|
11980 | return it.getStateString(past)
|
---|
11981 | };
|
---|
11982 | this.getComment = function (date) {
|
---|
11983 | var it = this.getIterator(date);
|
---|
11984 | return it.getComment()
|
---|
11985 | };
|
---|
11986 | this.getMatchingRule = function (date) {
|
---|
11987 | var it = this.getIterator(date);
|
---|
11988 | return it.getMatchingRule()
|
---|
11989 | };
|
---|
11990 | this.getWarnings = function () {
|
---|
11991 | var it = this.getIterator();
|
---|
11992 | return getWarnings(it)
|
---|
11993 | };
|
---|
11994 | this.prettifyValue = function (argument_hash) {
|
---|
11995 | this.getWarnings();
|
---|
11996 | return prettifyValue(argument_hash)
|
---|
11997 | };
|
---|
11998 | this.getNextChange = function (date, maxdate) {
|
---|
11999 | var it = this.getIterator(date);
|
---|
12000 | if (!it.advance(maxdate))
|
---|
12001 | return undefined;
|
---|
12002 | return it.getDate()
|
---|
12003 | };
|
---|
12004 | this.isWeekStable = function () {
|
---|
12005 | return week_stable
|
---|
12006 | };
|
---|
12007 | this.isEqualTo = function (second_oh_object, start_date) {
|
---|
12008 | if (typeof start_date === "undefined") {
|
---|
12009 | var start_date = new Date
|
---|
12010 | }
|
---|
12011 | var datelimit;
|
---|
12012 | if (this.isWeekStable() && second_oh_object.isWeekStable()) {
|
---|
12013 | datelimit = new Date(start_date.getTime() + msec_in_day * 10)
|
---|
12014 | } else {
|
---|
12015 | datelimit = new Date(start_date.getTime() + msec_in_day * 366 * 5)
|
---|
12016 | }
|
---|
12017 | var first_it = this.getIterator(start_date);
|
---|
12018 | var second_it = second_oh_object.getIterator(start_date);
|
---|
12019 | while (first_it.advance(datelimit)) {
|
---|
12020 | second_it.advance(datelimit);
|
---|
12021 | var not_equal = [];
|
---|
12022 | if (first_it.getDate().getTime() !== second_it.getDate().getTime()) {
|
---|
12023 | not_equal.push("getDate")
|
---|
12024 | }
|
---|
12025 | if (first_it.getState() !== second_it.getState()) {
|
---|
12026 | not_equal.push("getState")
|
---|
12027 | }
|
---|
12028 | if (first_it.getUnknown() !== second_it.getUnknown()) {
|
---|
12029 | not_equal.push("getUnknown")
|
---|
12030 | }
|
---|
12031 | if (first_it.getComment() !== second_it.getComment()) {
|
---|
12032 | not_equal.push("getComment")
|
---|
12033 | }
|
---|
12034 | if (not_equal.length) {
|
---|
12035 | var deviation_for_time = {};
|
---|
12036 | deviation_for_time[first_it.getDate().getTime()] = not_equal;
|
---|
12037 | return [false, {
|
---|
12038 | matching_rule: first_it.getMatchingRule(),
|
---|
12039 | matching_rule_other: second_it.getMatchingRule(),
|
---|
12040 | deviation_for_time: deviation_for_time
|
---|
12041 | }]
|
---|
12042 | }
|
---|
12043 | }
|
---|
12044 | return [true]
|
---|
12045 | };
|
---|
12046 | this.getOpenIntervals = function (from, to) {
|
---|
12047 | var res = [];
|
---|
12048 | var it = this.getIterator(from);
|
---|
12049 | if (it.getState() || it.getUnknown()) {
|
---|
12050 | res.push([from, undefined, it.getUnknown(), it.getComment()])
|
---|
12051 | }
|
---|
12052 | while (it.advance(to)) {
|
---|
12053 | if (it.getState() || it.getUnknown()) {
|
---|
12054 | if (res.length !== 0 && typeof res[res.length - 1][1] === "undefined") {
|
---|
12055 | res[res.length - 1][1] = it.getDate()
|
---|
12056 | }
|
---|
12057 | res.push([it.getDate(), undefined, it.getUnknown(), it.getComment()])
|
---|
12058 | } else {
|
---|
12059 | if (res.length !== 0 && typeof res[res.length - 1][1] === "undefined") {
|
---|
12060 | res[res.length - 1][1] = it.getDate()
|
---|
12061 | }
|
---|
12062 | }
|
---|
12063 | }
|
---|
12064 | if (res.length > 0 && typeof res[res.length - 1][1] === "undefined") {
|
---|
12065 | res[res.length - 1][1] = to
|
---|
12066 | }
|
---|
12067 | return res
|
---|
12068 | };
|
---|
12069 | this.getOpenDuration = function (from, to) {
|
---|
12070 | var open = 0;
|
---|
12071 | var unknown = 0;
|
---|
12072 | var it = this.getIterator(from);
|
---|
12073 | var prevdate = it.getState() || it.getUnknown() ? from : undefined;
|
---|
12074 | var prevstate = it.getState();
|
---|
12075 | var prevunknown = it.getUnknown();
|
---|
12076 | while (it.advance(to)) {
|
---|
12077 | if (it.getState() || it.getUnknown()) {
|
---|
12078 | if (typeof prevdate === "object") {
|
---|
12079 | if (prevunknown)
|
---|
12080 | unknown += it.getDate().getTime() - prevdate.getTime();
|
---|
12081 | else if (prevstate)
|
---|
12082 | open += it.getDate().getTime() - prevdate.getTime()
|
---|
12083 | }
|
---|
12084 | prevdate = it.getDate();
|
---|
12085 | prevstate = it.getState();
|
---|
12086 | prevunknown = it.getUnknown()
|
---|
12087 | } else {
|
---|
12088 | if (typeof prevdate === "object") {
|
---|
12089 | if (prevunknown)
|
---|
12090 | unknown += it.getDate().getTime() - prevdate.getTime();
|
---|
12091 | else
|
---|
12092 | open += it.getDate().getTime() - prevdate.getTime();
|
---|
12093 | prevdate = undefined
|
---|
12094 | }
|
---|
12095 | }
|
---|
12096 | }
|
---|
12097 | if (typeof prevdate === "object") {
|
---|
12098 | if (prevunknown)
|
---|
12099 | unknown += to.getTime() - prevdate.getTime();
|
---|
12100 | else
|
---|
12101 | open += to.getTime() - prevdate.getTime()
|
---|
12102 | }
|
---|
12103 | return [open, unknown]
|
---|
12104 | };
|
---|
12105 | this.getIterator = function (date) {
|
---|
12106 | return new function (oh) {
|
---|
12107 | if (typeof date === "undefined")
|
---|
12108 | date = new Date;
|
---|
12109 | var prevstate = [undefined, date, undefined, undefined, undefined];
|
---|
12110 | var state = oh.getStatePair(date);
|
---|
12111 | this.getDate = function () {
|
---|
12112 | return prevstate[1]
|
---|
12113 | };
|
---|
12114 | this.setDate = function (date) {
|
---|
12115 | if (typeof date !== "object")
|
---|
12116 | throw t("date parameter needed");
|
---|
12117 | prevstate = [undefined, date, undefined, undefined, undefined];
|
---|
12118 | state = oh.getStatePair(date)
|
---|
12119 | };
|
---|
12120 | this.getState = function () {
|
---|
12121 | return state[0]
|
---|
12122 | };
|
---|
12123 | this.getUnknown = function () {
|
---|
12124 | return state[2]
|
---|
12125 | };
|
---|
12126 | this.getStateString = function (past) {
|
---|
12127 | return state[0] ? "open" : state[2] ? "unknown" : past ? "closed" : "close"
|
---|
12128 | };
|
---|
12129 | this.getComment = function () {
|
---|
12130 | return state[3]
|
---|
12131 | };
|
---|
12132 | this.getMatchingRule = function () {
|
---|
12133 | if (typeof state[4] === "undefined")
|
---|
12134 | return undefined;
|
---|
12135 | return rules[state[4]].build_from_token_rule[2]
|
---|
12136 | };
|
---|
12137 | this.advance = function (datelimit) {
|
---|
12138 | if (typeof datelimit === "undefined") {
|
---|
12139 | datelimit = new Date(prevstate[1].getTime() + msec_in_day * 366 * 5)
|
---|
12140 | } else if (datelimit.getTime() <= prevstate[1].getTime()) {
|
---|
12141 | return false
|
---|
12142 | }
|
---|
12143 | do {
|
---|
12144 | if (typeof state[1] === "undefined") {
|
---|
12145 | return false
|
---|
12146 | }
|
---|
12147 | if (state[1].getTime() <= prevstate[1].getTime()) {
|
---|
12148 | throw "Fatal: infinite loop in nextChange"
|
---|
12149 | }
|
---|
12150 | if (state[1].getTime() >= datelimit.getTime()) {
|
---|
12151 | return false
|
---|
12152 | }
|
---|
12153 | prevstate = state;
|
---|
12154 | state = oh.getStatePair(prevstate[1])
|
---|
12155 | } while (state[0] === prevstate[0] && state[2] === prevstate[2] && state[3] === prevstate[3]);
|
---|
12156 | return true
|
---|
12157 | }
|
---|
12158 | }(this)
|
---|
12159 | }
|
---|
12160 | }
|
---|
12161 | })
|
---|
12162 | }, {
|
---|
12163 | "./locales/core": 1,
|
---|
12164 | moment: "moment",
|
---|
12165 | suncalc: 2
|
---|
12166 | }]
|
---|
12167 | }, {}, []);
|
---|