@hebcal/core 3.48.3 → 3.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +200 -94
- package/dist/bundle.js +111 -133
- package/dist/bundle.min.js +2 -2
- package/dist/greg0.mjs +1 -1
- package/dist/hdate-bundle.js +106 -129
- package/dist/hdate-bundle.min.js +2 -2
- package/dist/hdate.js +33 -44
- package/dist/hdate.mjs +34 -39
- package/dist/hdate0-bundle.js +1 -1
- package/dist/hdate0-bundle.min.js +1 -1
- package/dist/hdate0.mjs +1 -1
- package/dist/index.js +35 -46
- package/dist/index.mjs +35 -46
- package/package.json +6 -6
- package/po/he.po +6 -6
package/dist/greg0.mjs
CHANGED
package/dist/hdate-bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.49.0 */
|
|
2
2
|
var hebcal = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -159,20 +159,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
159
159
|
});
|
|
160
160
|
return Constructor;
|
|
161
161
|
}
|
|
162
|
-
function _defineProperty(obj, key, value) {
|
|
163
|
-
key = _toPropertyKey(key);
|
|
164
|
-
if (key in obj) {
|
|
165
|
-
Object.defineProperty(obj, key, {
|
|
166
|
-
value: value,
|
|
167
|
-
enumerable: true,
|
|
168
|
-
configurable: true,
|
|
169
|
-
writable: true
|
|
170
|
-
});
|
|
171
|
-
} else {
|
|
172
|
-
obj[key] = value;
|
|
173
|
-
}
|
|
174
|
-
return obj;
|
|
175
|
-
}
|
|
176
162
|
function _toPrimitive(input, hint) {
|
|
177
163
|
if (typeof input !== "object" || input === null) return input;
|
|
178
164
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -336,107 +322,99 @@ function abs2greg(abs) {
|
|
|
336
322
|
return dt;
|
|
337
323
|
}
|
|
338
324
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
function greg() {
|
|
344
|
-
_classCallCheck(this, greg);
|
|
345
|
-
}
|
|
346
|
-
_createClass(greg, null, [{
|
|
347
|
-
key: "isLeapYear",
|
|
348
|
-
value:
|
|
349
|
-
/**
|
|
350
|
-
* Long names of the Gregorian months (1='January', 12='December')
|
|
351
|
-
* @readonly
|
|
352
|
-
* @type {string[]}
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Returns true if the Gregorian year is a leap year
|
|
357
|
-
* @param {number} year Gregorian year
|
|
358
|
-
* @return {boolean}
|
|
359
|
-
*/
|
|
360
|
-
function isLeapYear(year) {
|
|
361
|
-
return isLeapYear$1(year);
|
|
362
|
-
}
|
|
325
|
+
/*
|
|
326
|
+
Hebcal - A Jewish Calendar Generator
|
|
327
|
+
Copyright (c) 1994-2020 Danny Sadinoff
|
|
328
|
+
Portions copyright Eyal Schachter and Michael J. Radwin
|
|
363
329
|
|
|
364
|
-
|
|
365
|
-
* Number of days in the Gregorian month for given year
|
|
366
|
-
* @param {number} month Gregorian month (1=January, 12=December)
|
|
367
|
-
* @param {number} year Gregorian year
|
|
368
|
-
* @return {number}
|
|
369
|
-
*/
|
|
370
|
-
}, {
|
|
371
|
-
key: "daysInMonth",
|
|
372
|
-
value: function daysInMonth(month, year) {
|
|
373
|
-
return daysInMonth$1(month, year);
|
|
374
|
-
}
|
|
330
|
+
https://github.com/hebcal/hebcal-es6
|
|
375
331
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
*/
|
|
381
|
-
}, {
|
|
382
|
-
key: "isDate",
|
|
383
|
-
value: function isDate$1(obj) {
|
|
384
|
-
return isDate(obj);
|
|
385
|
-
}
|
|
332
|
+
This program is free software; you can redistribute it and/or
|
|
333
|
+
modify it under the terms of the GNU General Public License
|
|
334
|
+
as published by the Free Software Foundation; either version 2
|
|
335
|
+
of the License, or (at your option) any later version.
|
|
386
336
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
* @return {number}
|
|
392
|
-
*/
|
|
393
|
-
}, {
|
|
394
|
-
key: "dayOfYear",
|
|
395
|
-
value: function dayOfYear(date) {
|
|
396
|
-
if (!isDate(date)) {
|
|
397
|
-
throw new TypeError("Argument not a Date: ".concat(date));
|
|
398
|
-
}
|
|
399
|
-
var month = date.getMonth();
|
|
400
|
-
var doy = date.getDate() + 31 * month;
|
|
401
|
-
if (month > 1) {
|
|
402
|
-
// FEB
|
|
403
|
-
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
404
|
-
if (isLeapYear$1(date.getFullYear())) {
|
|
405
|
-
doy++;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return doy;
|
|
409
|
-
}
|
|
337
|
+
This program is distributed in the hope that it will be useful,
|
|
338
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
339
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
340
|
+
GNU General Public License for more details.
|
|
410
341
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
* @return {number}
|
|
415
|
-
*/
|
|
416
|
-
}, {
|
|
417
|
-
key: "greg2abs",
|
|
418
|
-
value: function greg2abs$1(date) {
|
|
419
|
-
return greg2abs(date);
|
|
420
|
-
}
|
|
342
|
+
You should have received a copy of the GNU General Public License
|
|
343
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
344
|
+
*/
|
|
421
345
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
346
|
+
/**
|
|
347
|
+
* Gregorian date helper functions.
|
|
348
|
+
*/
|
|
349
|
+
var greg = {
|
|
350
|
+
/**
|
|
351
|
+
* Long names of the Gregorian months (1='January', 12='December')
|
|
352
|
+
* @readonly
|
|
353
|
+
* @type {string[]}
|
|
354
|
+
*/
|
|
355
|
+
monthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
356
|
+
/**
|
|
357
|
+
* Returns true if the Gregorian year is a leap year
|
|
358
|
+
* @function
|
|
359
|
+
* @param {number} year Gregorian year
|
|
360
|
+
* @return {boolean}
|
|
361
|
+
*/
|
|
362
|
+
isLeapYear: isLeapYear$1,
|
|
363
|
+
/**
|
|
364
|
+
* Number of days in the Gregorian month for given year
|
|
365
|
+
* @function
|
|
366
|
+
* @param {number} month Gregorian month (1=January, 12=December)
|
|
367
|
+
* @param {number} year Gregorian year
|
|
368
|
+
* @return {number}
|
|
369
|
+
*/
|
|
370
|
+
daysInMonth: daysInMonth$1,
|
|
371
|
+
/**
|
|
372
|
+
* Returns true if the object is a Javascript Date
|
|
373
|
+
* @function
|
|
374
|
+
* @param {Object} obj
|
|
375
|
+
* @return {boolean}
|
|
376
|
+
*/
|
|
377
|
+
isDate: isDate,
|
|
378
|
+
/**
|
|
379
|
+
* Returns number of days since January 1 of that year
|
|
380
|
+
* @deprecated
|
|
381
|
+
* @param {Date} date Gregorian date
|
|
382
|
+
* @return {number}
|
|
383
|
+
*/
|
|
384
|
+
dayOfYear: function dayOfYear(date) {
|
|
385
|
+
if (!isDate(date)) {
|
|
386
|
+
throw new TypeError("Argument not a Date: ".concat(date));
|
|
387
|
+
}
|
|
388
|
+
var month = date.getMonth();
|
|
389
|
+
var doy = date.getDate() + 31 * month;
|
|
390
|
+
if (month > 1) {
|
|
391
|
+
// FEB
|
|
392
|
+
doy -= Math.floor((4 * (month + 1) + 23) / 10);
|
|
393
|
+
if (isLeapYear$1(date.getFullYear())) {
|
|
394
|
+
doy++;
|
|
395
|
+
}
|
|
435
396
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
397
|
+
return doy;
|
|
398
|
+
},
|
|
399
|
+
/**
|
|
400
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
401
|
+
* @function
|
|
402
|
+
* @param {Date} date Gregorian date
|
|
403
|
+
* @return {number}
|
|
404
|
+
*/
|
|
405
|
+
greg2abs: greg2abs,
|
|
406
|
+
/**
|
|
407
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
408
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
409
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
410
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
411
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
412
|
+
* @function
|
|
413
|
+
* @param {number} theDate - R.D. number of days
|
|
414
|
+
* @return {Date}
|
|
415
|
+
*/
|
|
416
|
+
abs2greg: abs2greg
|
|
417
|
+
};
|
|
440
418
|
|
|
441
419
|
var noopLocale = {
|
|
442
420
|
headers: {
|
|
@@ -453,6 +431,13 @@ var alias = {
|
|
|
453
431
|
'': 'en'
|
|
454
432
|
};
|
|
455
433
|
|
|
434
|
+
/** @private */
|
|
435
|
+
var locales = Object.create(null);
|
|
436
|
+
/** @private */
|
|
437
|
+
var activeLocale = null;
|
|
438
|
+
/** @private */
|
|
439
|
+
var activeName = null;
|
|
440
|
+
|
|
456
441
|
/**
|
|
457
442
|
* A locale in Hebcal is used for translations/transliterations of
|
|
458
443
|
* holidays. `@hebcal/core` supports four locales by default
|
|
@@ -467,12 +452,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
467
452
|
}
|
|
468
453
|
_createClass(Locale, null, [{
|
|
469
454
|
key: "lookupTranslation",
|
|
470
|
-
value:
|
|
471
|
-
|
|
472
|
-
/** @private */
|
|
473
|
-
|
|
474
|
-
/** @private */
|
|
475
|
-
|
|
455
|
+
value:
|
|
476
456
|
/**
|
|
477
457
|
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
478
458
|
* Otherwise, returns `undefined`.
|
|
@@ -482,7 +462,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
482
462
|
*/
|
|
483
463
|
function lookupTranslation(id, locale) {
|
|
484
464
|
var locale0 = locale && locale.toLowerCase();
|
|
485
|
-
var loc = typeof locale == 'string' &&
|
|
465
|
+
var loc = typeof locale == 'string' && locales[locale0] || activeLocale;
|
|
486
466
|
var array = loc[id];
|
|
487
467
|
if (array && array.length && array[0].length) {
|
|
488
468
|
return array[0];
|
|
@@ -517,7 +497,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
517
497
|
if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
|
|
518
498
|
throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
|
|
519
499
|
}
|
|
520
|
-
|
|
500
|
+
locales[locale.toLowerCase()] = data.contexts[''];
|
|
521
501
|
}
|
|
522
502
|
|
|
523
503
|
/**
|
|
@@ -531,13 +511,13 @@ var Locale = /*#__PURE__*/function () {
|
|
|
531
511
|
key: "useLocale",
|
|
532
512
|
value: function useLocale(locale) {
|
|
533
513
|
var locale0 = locale.toLowerCase();
|
|
534
|
-
var obj =
|
|
514
|
+
var obj = locales[locale0];
|
|
535
515
|
if (!obj) {
|
|
536
516
|
throw new RangeError("Locale '".concat(locale, "' not found"));
|
|
537
517
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return
|
|
518
|
+
activeName = alias[locale0] || locale0;
|
|
519
|
+
activeLocale = obj;
|
|
520
|
+
return activeLocale;
|
|
541
521
|
}
|
|
542
522
|
|
|
543
523
|
/**
|
|
@@ -547,7 +527,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
547
527
|
}, {
|
|
548
528
|
key: "getLocaleName",
|
|
549
529
|
value: function getLocaleName() {
|
|
550
|
-
return
|
|
530
|
+
return activeName;
|
|
551
531
|
}
|
|
552
532
|
|
|
553
533
|
/**
|
|
@@ -557,7 +537,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
557
537
|
}, {
|
|
558
538
|
key: "getLocaleNames",
|
|
559
539
|
value: function getLocaleNames() {
|
|
560
|
-
return Object.keys(
|
|
540
|
+
return Object.keys(locales).sort();
|
|
561
541
|
}
|
|
562
542
|
|
|
563
543
|
/**
|
|
@@ -569,7 +549,7 @@ var Locale = /*#__PURE__*/function () {
|
|
|
569
549
|
key: "ordinal",
|
|
570
550
|
value: function ordinal(n, locale) {
|
|
571
551
|
var locale1 = locale && locale.toLowerCase();
|
|
572
|
-
var locale0 = locale1 ||
|
|
552
|
+
var locale0 = locale1 || activeName;
|
|
573
553
|
if (!locale0) {
|
|
574
554
|
return this.getEnOrdinal(n);
|
|
575
555
|
}
|
|
@@ -619,9 +599,6 @@ var Locale = /*#__PURE__*/function () {
|
|
|
619
599
|
}]);
|
|
620
600
|
return Locale;
|
|
621
601
|
}();
|
|
622
|
-
_defineProperty(Locale, "locales", Object.create(null));
|
|
623
|
-
_defineProperty(Locale, "activeLocale", null);
|
|
624
|
-
_defineProperty(Locale, "activeName", null);
|
|
625
602
|
Locale.addLocale('en', noopLocale);
|
|
626
603
|
Locale.addLocale('s', noopLocale);
|
|
627
604
|
Locale.addLocale('', noopLocale);
|
|
@@ -1893,7 +1870,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1893
1870
|
return new HDate(day, month, hyear);
|
|
1894
1871
|
}
|
|
1895
1872
|
|
|
1896
|
-
var version="3.
|
|
1873
|
+
var version="3.49.0";
|
|
1897
1874
|
|
|
1898
1875
|
var headers={"plural-forms":"nplurals=2; plural=(n > 1);"};var contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
|
|
1899
1876
|
|
package/dist/hdate-bundle.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
2
|
-
var hebcal=function(e){"use strict";function t(e){switch(e){case 1:return"א";case 2:return"ב";case 3:return"ג";case 4:return"ד";case 5:return"ה";case 6:return"ו";case 7:return"ז";case 8:return"ח";case 9:return"ט";case 10:return"י";case 20:return"כ";case 30:return"ל";case 40:return"מ";case 50:return"נ";case 60:return"ס";case 70:return"ע";case 80:return"פ";case 90:return"צ";case 100:return"ק";case 200:return"ר";case 300:return"ש";case 400:return"ת";default:return"*INVALID*"}}function r(e){for(var t=[];e>0;){if(15===e||16===e){t.push(9),t.push(e-9);break}var r=100,n=void 0;for(n=400;n>e;n-=r)n===r&&(r/=10);t.push(n),e-=n}return t}function n(e){var n=parseInt(e,10);if(!n)throw new TypeError("invalid parameter to gematriya ".concat(e));var a="",o=Math.floor(n/1e3);if(o>0&&5!==o){for(var u=r(o),i=0;i<u.length;i++)a+=t(u[i]);a+="׳"}var c=r(n%1e3);if(1==c.length)return a+t(c[0])+"׳";for(var s=0;s<c.length;s++)s+1===c.length&&(a+="״"),a+=t(c[s]);return a}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var h=[0,31,28,31,30,31,30,31,31,30,31,30,31],l=[h,h.slice()];function f(e,t){return e-t*Math.floor(e/t)}function y(e,t){return Math.floor(e/t)}function v(e){return!(e%4||!(e%100)&&e%400)}function m(e){return"object"===a(e)&&Date.prototype===e.__proto__}function d(e){if(!m(e))throw new TypeError("Argument not a Date: ".concat(e));return g(e.getFullYear(),e.getMonth()+1,e.getDate())}function g(e,t,r){var n=e-1;return 365*n+y(n,4)-y(n,100)+y(n,400)+y(367*t-362,12)+(t<=2?0:v(e)?-1:-2)+r}function b(e){if("number"!=typeof e)throw new TypeError("Argument not a Number: ".concat(e));var t=function(e){var t=e-1,r=y(t,146097),n=f(t,146097),a=y(n,36524),o=f(n,36524),u=y(o,1461),i=y(f(o,1461),365),c=400*r+100*a+4*u+i;return 4!=a&&4!=i?c+1:c}(e=Math.trunc(e)),r=y(12*(e-g(t,1,1)+(e<g(t,3,1)?0:v(t)?1:2))+373,367),n=e-g(t,r,1)+1,a=new Date(t,r-1,n);return t<100&&t>=0&&a.setFullYear(t),a}l[1][2]=29;var w=function(){function e(){o(this,e)}return i(e,null,[{key:"isLeapYear",value:function(e){return v(e)}},{key:"daysInMonth",value:function(e,t){return function(e,t){return l[+v(t)][e]}(e,t)}},{key:"isDate",value:function(e){return m(e)}},{key:"dayOfYear",value:function(e){if(!m(e))throw new TypeError("Argument not a Date: ".concat(e));var t=e.getMonth(),r=e.getDate()+31*t;return t>1&&(r-=Math.floor((4*(t+1)+23)/10),v(e.getFullYear())&&r++),r}},{key:"greg2abs",value:function(e){return d(e)}},{key:"abs2greg",value:function(e){return b(e)}}]),e}();c(w,"monthNames",["","January","February","March","April","May","June","July","August","September","October","November","December"]);var k={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},p={h:"he",a:"ashkenazi",s:"en","":"en"},A=function(){function e(){o(this,e)}return i(e,null,[{key:"lookupTranslation",value:function(e,t){var r=t&&t.toLowerCase(),n=("string"==typeof t&&this.locales[r]||this.activeLocale)[e];if(n&&n.length&&n[0].length)return n[0]}},{key:"gettext",value:function(e,t){var r=this.lookupTranslation(e,t);return void 0===r?e:r}},{key:"addLocale",value:function(e,t){if("object"!==a(t.contexts)||"object"!==a(t.contexts[""]))throw new TypeError("Locale '".concat(e,"' invalid compact format"));this.locales[e.toLowerCase()]=t.contexts[""]}},{key:"useLocale",value:function(e){var t=e.toLowerCase(),r=this.locales[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return this.activeName=p[t]||t,this.activeLocale=r,this.activeLocale}},{key:"getLocaleName",value:function(){return this.activeName}},{key:"getLocaleNames",value:function(){return Object.keys(this.locales).sort()}},{key:"ordinal",value:function(e,t){var r=t&&t.toLowerCase()||this.activeName;if(!r)return this.getEnOrdinal(e);switch(r){case"en":case"s":case"a":case"ashkenazi":case"ashkenazi_litvish":case"ashkenazi_poylish":case"ashkenazi_standard":return this.getEnOrdinal(e);case"es":return e+"º";case"h":case"he":case"he-x-nonikud":return String(e);default:return e+"."}}},{key:"getEnOrdinal",value:function(e){var t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])}},{key:"hebrewStripNikkud",value:function(e){return e.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}}]),e}();c(A,"locales",Object.create(null)),c(A,"activeLocale",null),c(A,"activeName",null),A.addLocale("en",k),A.addLocale("s",k),A.addLocale("",k),A.useLocale("en");var I={NISAN:1,IYYAR:2,SIVAN:3,TAMUZ:4,AV:5,ELUL:6,TISHREI:7,CHESHVAN:8,KISLEV:9,TEVET:10,SHVAT:11,ADAR_I:12,ADAR_II:13},N=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],E=[N.concat(["Adar","Nisan"]),N.concat(["Adar I","Adar II","Nisan"])],T=Object.create(null),D=-1373428;function L(e,t,r){if(e<1)throw new RangeError("hebrew2abs: invalid year ".concat(e));var n=r;if(t<7){for(var a=7;a<=H(e);a++)n+=R(a,e);for(var o=1;o<t;o++)n+=R(o,e)}else for(var u=7;u<t;u++)n+=R(u,e);return D+V(e)+n-1}function M(e){return D+V(e)}function S(e){if("number"!=typeof e||isNaN(e))throw new TypeError("invalid parameter to abs2hebrew ".concat(e));if((e=Math.trunc(e))<=D)throw new RangeError("abs2hebrew: ".concat(e," is before epoch"));for(var t=Math.floor((e-D)/365.24682220597794);M(t)<=e;)++t;for(var r=e<L(--t,1,1)?7:1;e>L(t,r,R(r,t));)++r;return{yy:t,mm:r,dd:1+e-L(t,r,1)}}function Y(e){return(1+7*e)%19<7}function H(e){return 12+Y(e)}function R(e,t){switch(e){case 2:case 4:case 6:case 10:case 13:return 29}return 12===e&&!Y(t)||8===e&&!_(t)||9===e&&C(t)?29:30}function O(e,t){if("number"!=typeof e||isNaN(e)||e<1||e>14)throw new TypeError("bad month argument ".concat(e));return E[+Y(t)][e]}function V(e){var t=T[e]=T[e]||function(e){var t=e-1,r=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),n=204+r%1080*793,a=5+12*r+793*Math.floor(r/1080)+Math.floor(n/1080),o=n%1080+a%24*1080,u=1+29*r+Math.floor(a/24),i=u+(o>=19440||2==u%7&&o>=9924&&!Y(e)||1==u%7&&o>=16789&&Y(t));return i+(i%7==0||i%7==3||i%7==5)}(e);return t}function F(e){return V(e+1)-V(e)}function _(e){return F(e)%10==5}function C(e){return F(e)%10==3}function j(e){throw new TypeError(e)}var x="day",z="week",U="month",K="year",B={d:x,w:z,M:U,y:K},P={day:x,week:z,month:U,year:K},J=function(){function e(t,r,n){if(o(this,e),2==arguments.length||arguments.length>3)throw new TypeError("HDate constructor requires 0, 1 or 3 arguments");if(3==arguments.length){if(this.day=this.month=1,n=parseInt(n,10),isNaN(n))throw new TypeError("HDate called with bad year argument: ".concat(n));if(this.year=n,this.setMonth(r),t=parseInt(t,10),isNaN(t))throw new TypeError("HDate called with bad day argument: ".concat(t));this.setDate(t)}else{void 0===t&&(t=new Date);var a="number"!=typeof t||isNaN(t)?m(t)?d(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:j("HDate called with bad argument: ".concat(t)):t,u="number"==typeof a,i=u?S(a):a;this.day=i.dd,this.month=i.mm,this.year=i.yy,u&&(this.abs0=a)}}return i(e,[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return Y(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var e=H(this.getFullYear());return(this.getMonth()+e-6)%e||e}},{key:"daysInMonth",value:function(){return R(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return f(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,Z(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),Z(this),this}},{key:"setDate",value:function(e){return this.day=e,Z(this),this}},{key:"greg",value:function(){return b(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=L(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return O(this.getMonth(),this.getFullYear())}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t||A.getLocaleName(),a=this.getDate(),o=A.gettext(this.getMonthName(),n),u=A.ordinal(a,n),i=e.getDayOfTranslation(n),c="".concat(u).concat(i," ").concat(o);if(r){var s=this.getFullYear();return"".concat(c,", ").concat(s)}return c}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=A.gettext(this.getMonthName(),"he"),r=this.getFullYear();return n(e)+" "+t+" "+n(r)}},{key:"before",value:function(e){return q(e,this,-1)}},{key:"onOrBefore",value:function(e){return q(e,this,0)}},{key:"nearest",value:function(e){return q(e,this,3)}},{key:"onOrAfter",value:function(e){return q(e,this,6)}},{key:"after",value:function(e){return q(e,this,7)}},{key:"next",value:function(){return new e(this.abs()+1)}},{key:"prev",value:function(){return new e(this.abs()-1)}},{key:"add",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";if(!(t=parseInt(t,10)))return new e(this);if((r=e.standardizeUnits(r))===x)return new e(this.abs()+t);if(r===z)return new e(this.abs()+7*t);if(r===K)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===U){var n=new e(this),a=t>0?1:-1;t=Math.abs(t);for(var o=0;o<t;o++)n=new e(n.abs()+a*n.daysInMonth());return n}}},{key:"subtract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";return this.add(-1*e,t)}},{key:"deltaDays",value:function(t){if(!e.isHDate(t))throw new TypeError("Bad argument: ".concat(t));return this.abs()-t.abs()}},{key:"isSameDate",value:function(t){return!!e.isHDate(t)&&(this.year==t.year&&this.month==t.month&&this.day==t.day)}},{key:"toString",value:function(){var e=this.getDate(),t=this.getFullYear(),r=this.getMonthName();return"".concat(e," ").concat(r," ").concat(t)}}],[{key:"hebrew2abs",value:function(e,t,r){return L(e,t,r)}},{key:"abs2hebrew",value:function(e){return S(e)}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=A.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=B[e]||String(e||"").toLowerCase().replace(/s$/,"");return P[t]||j("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return Y(e)}},{key:"monthsInYear",value:function(e){return H(e)}},{key:"daysInMonth",value:function(e,t){return R(e,t)}},{key:"getMonthName",value:function(e,t){return O(e,t)}},{key:"monthNum",value:function(t){if("number"==typeof t){if(isNaN(t)||t>14)throw new RangeError("Invalid month number: ".concat(t));return t}return t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):e.monthFromName(t)}},{key:"daysInYear",value:function(e){return F(e)}},{key:"longCheshvan",value:function(e){return _(e)}},{key:"shortKislev",value:function(e){return C(e)}},{key:"monthFromName",value:function(e){if("number"==typeof e){if(isNaN(e)||e<1||e>14)throw new RangeError("Invalid month name: ".concat(e));return e}var t=e.toLowerCase();switch(t[0]){case"n":case"נ":if("o"==t[1])break;return I.NISAN;case"i":return I.IYYAR;case"e":return I.ELUL;case"c":case"ח":return I.CHESHVAN;case"k":case"כ":return I.KISLEV;case"s":switch(t[1]){case"i":return I.SIVAN;case"h":return I.SHVAT}case"t":switch(t[1]){case"a":return I.TAMUZ;case"i":return I.TISHREI;case"e":return I.TEVET}break;case"a":switch(t[1]){case"v":return I.AV;case"d":return/(1|[^i]i|a|א)$/i.test(e)?I.ADAR_I:I.ADAR_II}break;case"ס":return I.SIVAN;case"ט":return I.TEVET;case"ש":return I.SHVAT;case"א":switch(t[1]){case"ב":return I.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?I.ADAR_I:I.ADAR_II;case"י":return I.IYYAR;case"ל":return I.ELUL}break;case"ת":switch(t[1]){case"מ":return I.TAMUZ;case"ש":return I.TISHREI}}throw new RangeError("Unable to parse month name: ".concat(e))}},{key:"dayOnOrBefore",value:function(e,t){return t-(t-e)%7}},{key:"isHDate",value:function(e){return null!==e&&"object"===a(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}]),e}();function Z(e){$(e),function(e){e.day<1&&(e.month==I.TISHREI&&(e.year-=1),e.day+=R(e.month,e.year),e.month-=1,Z(e));e.day>R(e.month,e.year)&&(e.month===I.ELUL&&(e.year+=1),e.day-=R(e.month,e.year),e.month+=1,Z(e));$(e)}(e)}function $(e){e.month!==I.ADAR_II||e.isLeapYear()?e.month<1?(e.month+=H(e.year),e.year-=1,Z(e)):e.month>H(e.year)&&(e.month-=H(e.year),e.year+=1,Z(e)):(e.month-=1,Z(e)),delete e.abs0}function q(e,t,r){return new J(J.dayOnOrBefore(e,t.abs()+r))}var G=I.NISAN,Q=I.CHESHVAN,W=I.KISLEV,X=I.TEVET,ee=I.SHVAT,te=I.ADAR_I,re=I.ADAR_II;var ne={headers:{"plural-forms":"nplurals=2; plural=(n > 1);"},contexts:{"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}}};A.addLocale("he",ne),A.addLocale("h",ne);var ae=ne.contexts[""],oe={};return Object.keys(ae).forEach((function(e){oe[e]=[A.hebrewStripNikkud(ae[e][0])]})),A.addLocale("he-x-NoNikud",{headers:ne.headers,contexts:{"":oe}}),e.HDate=J,e.Locale=A,e.gematriya=n,e.getBirthdayOrAnniversary=function(e,t){var r=J.isHDate(t)?t:new J(t),n=r.getFullYear();if(!(e<=n)){var a=Y(n),o=r.getMonth(),u=r.getDate();return o==te&&!a||o==re&&a?o=H(e):o!=Q||30!=u||_(e)?o==W&&30==u&&C(e)?(o=X,u=1):o==te&&30==u&&a&&!Y(e)&&(o=G,u=1):(o=W,u=1),new J(u,o,e)}},e.getYahrzeit=function(e,t){var r=J.isHDate(t)?t:new J(t),n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=n.yy))return n.mm!=Q||30!=n.dd||_(n.yy+1)?n.mm==W&&30==n.dd&&C(n.yy+1)?n=S(L(e,X,1)-1):n.mm==re?n.mm=H(e):n.mm!=te||30!=n.dd||Y(e)||(n.dd=30,n.mm=ee):n=S(L(e,W,1)-1),n.mm!=Q||30!=n.dd||_(e)?n.mm==W&&30==n.dd&&C(e)&&(n.mm=X,n.dd=1):(n.mm=W,n.dd=1),new J(n.dd,n.mm,e)},e.greg=w,e.months=I,e.version="3.48.3",e}({});
|
|
1
|
+
/*! @hebcal/core v3.49.0 */
|
|
2
|
+
var hebcal=function(e){"use strict";function t(e){switch(e){case 1:return"א";case 2:return"ב";case 3:return"ג";case 4:return"ד";case 5:return"ה";case 6:return"ו";case 7:return"ז";case 8:return"ח";case 9:return"ט";case 10:return"י";case 20:return"כ";case 30:return"ל";case 40:return"מ";case 50:return"נ";case 60:return"ס";case 70:return"ע";case 80:return"פ";case 90:return"צ";case 100:return"ק";case 200:return"ר";case 300:return"ש";case 400:return"ת";default:return"*INVALID*"}}function r(e){for(var t=[];e>0;){if(15===e||16===e){t.push(9),t.push(e-9);break}var r=100,n=void 0;for(n=400;n>e;n-=r)n===r&&(r/=10);t.push(n),e-=n}return t}function n(e){var n=parseInt(e,10);if(!n)throw new TypeError("invalid parameter to gematriya ".concat(e));var a="",o=Math.floor(n/1e3);if(o>0&&5!==o){for(var u=r(o),i=0;i<u.length;i++)a+=t(u[i]);a+="׳"}var s=r(n%1e3);if(1==s.length)return a+t(s[0])+"׳";for(var c=0;c<s.length;c++)c+1===s.length&&(a+="״"),a+=t(s[c]);return a}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(a=n.key,o=void 0,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?o:String(o)),n)}var a,o}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=[0,31,28,31,30,31,30,31,31,30,31,30,31],c=[s,s.slice()];function h(e,t){return e-t*Math.floor(e/t)}function l(e,t){return Math.floor(e/t)}function f(e){return!(e%4||!(e%100)&&e%400)}function y(e){return"object"===a(e)&&Date.prototype===e.__proto__}function v(e){if(!y(e))throw new TypeError("Argument not a Date: ".concat(e));return d(e.getFullYear(),e.getMonth()+1,e.getDate())}function d(e,t,r){var n=e-1;return 365*n+l(n,4)-l(n,100)+l(n,400)+l(367*t-362,12)+(t<=2?0:f(e)?-1:-2)+r}function m(e){if("number"!=typeof e)throw new TypeError("Argument not a Number: ".concat(e));var t=function(e){var t=e-1,r=l(t,146097),n=h(t,146097),a=l(n,36524),o=h(n,36524),u=l(o,1461),i=l(h(o,1461),365),s=400*r+100*a+4*u+i;return 4!=a&&4!=i?s+1:s}(e=Math.trunc(e)),r=l(12*(e-d(t,1,1)+(e<d(t,3,1)?0:f(t)?1:2))+373,367),n=e-d(t,r,1)+1,a=new Date(t,r-1,n);return t<100&&t>=0&&a.setFullYear(t),a}c[1][2]=29;var g={monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],isLeapYear:f,daysInMonth:function(e,t){return c[+f(t)][e]},isDate:y,dayOfYear:function(e){if(!y(e))throw new TypeError("Argument not a Date: ".concat(e));var t=e.getMonth(),r=e.getDate()+31*t;return t>1&&(r-=Math.floor((4*(t+1)+23)/10),f(e.getFullYear())&&r++),r},greg2abs:v,abs2greg:m},b={headers:{"plural-forms":"nplurals=2; plural=(n!=1);"},contexts:{"":{}}},w={h:"he",a:"ashkenazi",s:"en","":"en"},p=Object.create(null),k=null,A=null,I=function(){function e(){o(this,e)}return i(e,null,[{key:"lookupTranslation",value:function(e,t){var r=t&&t.toLowerCase(),n=("string"==typeof t&&p[r]||k)[e];if(n&&n.length&&n[0].length)return n[0]}},{key:"gettext",value:function(e,t){var r=this.lookupTranslation(e,t);return void 0===r?e:r}},{key:"addLocale",value:function(e,t){if("object"!==a(t.contexts)||"object"!==a(t.contexts[""]))throw new TypeError("Locale '".concat(e,"' invalid compact format"));p[e.toLowerCase()]=t.contexts[""]}},{key:"useLocale",value:function(e){var t=e.toLowerCase(),r=p[t];if(!r)throw new RangeError("Locale '".concat(e,"' not found"));return A=w[t]||t,k=r}},{key:"getLocaleName",value:function(){return A}},{key:"getLocaleNames",value:function(){return Object.keys(p).sort()}},{key:"ordinal",value:function(e,t){var r=t&&t.toLowerCase()||A;if(!r)return this.getEnOrdinal(e);switch(r){case"en":case"s":case"a":case"ashkenazi":case"ashkenazi_litvish":case"ashkenazi_poylish":case"ashkenazi_standard":return this.getEnOrdinal(e);case"es":return e+"º";case"h":case"he":case"he-x-nonikud":return String(e);default:return e+"."}}},{key:"getEnOrdinal",value:function(e){var t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])}},{key:"hebrewStripNikkud",value:function(e){return e.replace(/[\u0590-\u05bd]/g,"").replace(/[\u05bf-\u05c7]/g,"")}}]),e}();I.addLocale("en",b),I.addLocale("s",b),I.addLocale("",b),I.useLocale("en");var N={NISAN:1,IYYAR:2,SIVAN:3,TAMUZ:4,AV:5,ELUL:6,TISHREI:7,CHESHVAN:8,KISLEV:9,TEVET:10,SHVAT:11,ADAR_I:12,ADAR_II:13},E=["","Nisan","Iyyar","Sivan","Tamuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Sh'vat"],T=[E.concat(["Adar","Nisan"]),E.concat(["Adar I","Adar II","Nisan"])],D=Object.create(null),M=-1373428;function S(e,t,r){if(e<1)throw new RangeError("hebrew2abs: invalid year ".concat(e));var n=r;if(t<7){for(var a=7;a<=R(e);a++)n+=V(a,e);for(var o=1;o<t;o++)n+=V(o,e)}else for(var u=7;u<t;u++)n+=V(u,e);return M+F(e)+n-1}function L(e){return M+F(e)}function Y(e){if("number"!=typeof e||isNaN(e))throw new TypeError("invalid parameter to abs2hebrew ".concat(e));if((e=Math.trunc(e))<=M)throw new RangeError("abs2hebrew: ".concat(e," is before epoch"));for(var t=Math.floor((e-M)/365.24682220597794);L(t)<=e;)++t;for(var r=e<S(--t,1,1)?7:1;e>S(t,r,V(r,t));)++r;return{yy:t,mm:r,dd:1+e-S(t,r,1)}}function H(e){return(1+7*e)%19<7}function R(e){return 12+H(e)}function V(e,t){switch(e){case 2:case 4:case 6:case 10:case 13:return 29}return 12===e&&!H(t)||8===e&&!C(t)||9===e&&x(t)?29:30}function O(e,t){if("number"!=typeof e||isNaN(e)||e<1||e>14)throw new TypeError("bad month argument ".concat(e));return T[+H(t)][e]}function F(e){var t=D[e]=D[e]||function(e){var t=e-1,r=235*Math.floor(t/19)+t%19*12+Math.floor((t%19*7+1)/19),n=204+r%1080*793,a=5+12*r+793*Math.floor(r/1080)+Math.floor(n/1080),o=n%1080+a%24*1080,u=1+29*r+Math.floor(a/24),i=u+(o>=19440||2==u%7&&o>=9924&&!H(e)||1==u%7&&o>=16789&&H(t));return i+(i%7==0||i%7==3||i%7==5)}(e);return t}function _(e){return F(e+1)-F(e)}function C(e){return _(e)%10==5}function x(e){return _(e)%10==3}function j(e){throw new TypeError(e)}var z="day",U="week",K="month",B="year",P={d:z,w:U,M:K,y:B},J={day:z,week:U,month:K,year:B},Z=function(){function e(t,r,n){if(o(this,e),2==arguments.length||arguments.length>3)throw new TypeError("HDate constructor requires 0, 1 or 3 arguments");if(3==arguments.length){if(this.day=this.month=1,n=parseInt(n,10),isNaN(n))throw new TypeError("HDate called with bad year argument: ".concat(n));if(this.year=n,this.setMonth(r),t=parseInt(t,10),isNaN(t))throw new TypeError("HDate called with bad day argument: ".concat(t));this.setDate(t)}else{void 0===t&&(t=new Date);var a="number"!=typeof t||isNaN(t)?y(t)?v(t):e.isHDate(t)?{dd:t.day,mm:t.month,yy:t.year}:j("HDate called with bad argument: ".concat(t)):t,u="number"==typeof a,i=u?Y(a):a;this.day=i.dd,this.month=i.mm,this.year=i.yy,u&&(this.abs0=a)}}return i(e,[{key:"getFullYear",value:function(){return this.year}},{key:"isLeapYear",value:function(){return H(this.year)}},{key:"getMonth",value:function(){return this.month}},{key:"getTishreiMonth",value:function(){var e=R(this.getFullYear());return(this.getMonth()+e-6)%e||e}},{key:"daysInMonth",value:function(){return V(this.getMonth(),this.getFullYear())}},{key:"getDate",value:function(){return this.day}},{key:"getDay",value:function(){return h(this.abs(),7)}},{key:"setFullYear",value:function(e){return this.year=e,$(this),this}},{key:"setMonth",value:function(t){return this.month=e.monthNum(t),$(this),this}},{key:"setDate",value:function(e){return this.day=e,$(this),this}},{key:"greg",value:function(){return m(this.abs())}},{key:"abs",value:function(){return"number"!=typeof this.abs0&&(this.abs0=S(this.year,this.month,this.day)),this.abs0}},{key:"getMonthName",value:function(){return O(this.getMonth(),this.getFullYear())}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t||I.getLocaleName(),a=this.getDate(),o=I.gettext(this.getMonthName(),n),u=I.ordinal(a,n),i=e.getDayOfTranslation(n),s="".concat(u).concat(i," ").concat(o);if(r){var c=this.getFullYear();return"".concat(s,", ").concat(c)}return s}},{key:"renderGematriya",value:function(){var e=this.getDate(),t=I.gettext(this.getMonthName(),"he"),r=this.getFullYear();return n(e)+" "+t+" "+n(r)}},{key:"before",value:function(e){return G(e,this,-1)}},{key:"onOrBefore",value:function(e){return G(e,this,0)}},{key:"nearest",value:function(e){return G(e,this,3)}},{key:"onOrAfter",value:function(e){return G(e,this,6)}},{key:"after",value:function(e){return G(e,this,7)}},{key:"next",value:function(){return new e(this.abs()+1)}},{key:"prev",value:function(){return new e(this.abs()-1)}},{key:"add",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";if(!(t=parseInt(t,10)))return new e(this);if((r=e.standardizeUnits(r))===z)return new e(this.abs()+t);if(r===U)return new e(this.abs()+7*t);if(r===B)return new e(this.getDate(),this.getMonth(),this.getFullYear()+t);if(r===K){var n=new e(this),a=t>0?1:-1;t=Math.abs(t);for(var o=0;o<t;o++)n=new e(n.abs()+a*n.daysInMonth());return n}}},{key:"subtract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"d";return this.add(-1*e,t)}},{key:"deltaDays",value:function(t){if(!e.isHDate(t))throw new TypeError("Bad argument: ".concat(t));return this.abs()-t.abs()}},{key:"isSameDate",value:function(t){return!!e.isHDate(t)&&(this.year==t.year&&this.month==t.month&&this.day==t.day)}},{key:"toString",value:function(){var e=this.getDate(),t=this.getFullYear(),r=this.getMonthName();return"".concat(e," ").concat(r," ").concat(t)}}],[{key:"hebrew2abs",value:function(e,t,r){return S(e,t,r)}},{key:"abs2hebrew",value:function(e){return Y(e)}},{key:"getDayOfTranslation",value:function(e){switch(e){case"en":case"s":case"a":case"ashkenazi":return" of"}var t=I.lookupTranslation("of",e);return t?" "+t:"ashkenazi"===e.substring(0,9)?" of":""}},{key:"standardizeUnits",value:function(e){var t=P[e]||String(e||"").toLowerCase().replace(/s$/,"");return J[t]||j("Invalid units '".concat(e,"'"))}},{key:"isLeapYear",value:function(e){return H(e)}},{key:"monthsInYear",value:function(e){return R(e)}},{key:"daysInMonth",value:function(e,t){return V(e,t)}},{key:"getMonthName",value:function(e,t){return O(e,t)}},{key:"monthNum",value:function(t){if("number"==typeof t){if(isNaN(t)||t>14)throw new RangeError("Invalid month number: ".concat(t));return t}return t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57?parseInt(t,10):e.monthFromName(t)}},{key:"daysInYear",value:function(e){return _(e)}},{key:"longCheshvan",value:function(e){return C(e)}},{key:"shortKislev",value:function(e){return x(e)}},{key:"monthFromName",value:function(e){if("number"==typeof e){if(isNaN(e)||e<1||e>14)throw new RangeError("Invalid month name: ".concat(e));return e}var t=e.toLowerCase();switch(t[0]){case"n":case"נ":if("o"==t[1])break;return N.NISAN;case"i":return N.IYYAR;case"e":return N.ELUL;case"c":case"ח":return N.CHESHVAN;case"k":case"כ":return N.KISLEV;case"s":switch(t[1]){case"i":return N.SIVAN;case"h":return N.SHVAT}case"t":switch(t[1]){case"a":return N.TAMUZ;case"i":return N.TISHREI;case"e":return N.TEVET}break;case"a":switch(t[1]){case"v":return N.AV;case"d":return/(1|[^i]i|a|א)$/i.test(e)?N.ADAR_I:N.ADAR_II}break;case"ס":return N.SIVAN;case"ט":return N.TEVET;case"ש":return N.SHVAT;case"א":switch(t[1]){case"ב":return N.AV;case"ד":return/(1|[^i]i|a|א)$/i.test(e)?N.ADAR_I:N.ADAR_II;case"י":return N.IYYAR;case"ל":return N.ELUL}break;case"ת":switch(t[1]){case"מ":return N.TAMUZ;case"ש":return N.TISHREI}}throw new RangeError("Unable to parse month name: ".concat(e))}},{key:"dayOnOrBefore",value:function(e,t){return t-(t-e)%7}},{key:"isHDate",value:function(e){return null!==e&&"object"===a(e)&&"number"==typeof e.year&&"number"==typeof e.month&&"number"==typeof e.day&&"function"==typeof e.greg&&"function"==typeof e.abs}}]),e}();function $(e){q(e),function(e){e.day<1&&(e.month==N.TISHREI&&(e.year-=1),e.day+=V(e.month,e.year),e.month-=1,$(e));e.day>V(e.month,e.year)&&(e.month===N.ELUL&&(e.year+=1),e.day-=V(e.month,e.year),e.month+=1,$(e));q(e)}(e)}function q(e){e.month!==N.ADAR_II||e.isLeapYear()?e.month<1?(e.month+=R(e.year),e.year-=1,$(e)):e.month>R(e.year)&&(e.month-=R(e.year),e.year+=1,$(e)):(e.month-=1,$(e)),delete e.abs0}function G(e,t,r){return new Z(Z.dayOnOrBefore(e,t.abs()+r))}var Q=N.NISAN,W=N.CHESHVAN,X=N.KISLEV,ee=N.TEVET,te=N.SHVAT,re=N.ADAR_I,ne=N.ADAR_II;var ae={headers:{"plural-forms":"nplurals=2; plural=(n > 1);"},contexts:{"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}}};I.addLocale("he",ae),I.addLocale("h",ae);var oe=ae.contexts[""],ue={};return Object.keys(oe).forEach((function(e){ue[e]=[I.hebrewStripNikkud(oe[e][0])]})),I.addLocale("he-x-NoNikud",{headers:ae.headers,contexts:{"":ue}}),e.HDate=Z,e.Locale=I,e.gematriya=n,e.getBirthdayOrAnniversary=function(e,t){var r=Z.isHDate(t)?t:new Z(t),n=r.getFullYear();if(!(e<=n)){var a=H(n),o=r.getMonth(),u=r.getDate();return o==re&&!a||o==ne&&a?o=R(e):o!=W||30!=u||C(e)?o==X&&30==u&&x(e)?(o=ee,u=1):o==re&&30==u&&a&&!H(e)&&(o=Q,u=1):(o=X,u=1),new Z(u,o,e)}},e.getYahrzeit=function(e,t){var r=Z.isHDate(t)?t:new Z(t),n={yy:r.getFullYear(),mm:r.getMonth(),dd:r.getDate()};if(!(e<=n.yy))return n.mm!=W||30!=n.dd||C(n.yy+1)?n.mm==X&&30==n.dd&&x(n.yy+1)?n=Y(S(e,ee,1)-1):n.mm==ne?n.mm=R(e):n.mm!=re||30!=n.dd||H(e)||(n.dd=30,n.mm=te):n=Y(S(e,X,1)-1),n.mm!=W||30!=n.dd||C(e)?n.mm==X&&30==n.dd&&x(e)&&(n.mm=ee,n.dd=1):(n.mm=X,n.dd=1),new Z(n.dd,n.mm,e)},e.greg=g,e.months=N,e.version="3.49.0",e}({});
|
package/dist/hdate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v3.
|
|
1
|
+
/*! @hebcal/core v3.49.0 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const GERESH = '׳';
|
|
@@ -299,49 +299,42 @@ function abs2greg(abs) {
|
|
|
299
299
|
/**
|
|
300
300
|
* Gregorian date helper functions.
|
|
301
301
|
*/
|
|
302
|
-
|
|
302
|
+
const greg = {
|
|
303
303
|
/**
|
|
304
304
|
* Long names of the Gregorian months (1='January', 12='December')
|
|
305
305
|
* @readonly
|
|
306
306
|
* @type {string[]}
|
|
307
307
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
monthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
310
309
|
/**
|
|
311
310
|
* Returns true if the Gregorian year is a leap year
|
|
311
|
+
* @function
|
|
312
312
|
* @param {number} year Gregorian year
|
|
313
313
|
* @return {boolean}
|
|
314
314
|
*/
|
|
315
|
-
|
|
316
|
-
return isLeapYear$1(year);
|
|
317
|
-
}
|
|
318
|
-
|
|
315
|
+
isLeapYear: isLeapYear$1,
|
|
319
316
|
/**
|
|
320
317
|
* Number of days in the Gregorian month for given year
|
|
318
|
+
* @function
|
|
321
319
|
* @param {number} month Gregorian month (1=January, 12=December)
|
|
322
320
|
* @param {number} year Gregorian year
|
|
323
321
|
* @return {number}
|
|
324
322
|
*/
|
|
325
|
-
|
|
326
|
-
return daysInMonth$1(month, year);
|
|
327
|
-
}
|
|
328
|
-
|
|
323
|
+
daysInMonth: daysInMonth$1,
|
|
329
324
|
/**
|
|
330
325
|
* Returns true if the object is a Javascript Date
|
|
326
|
+
* @function
|
|
331
327
|
* @param {Object} obj
|
|
332
328
|
* @return {boolean}
|
|
333
329
|
*/
|
|
334
|
-
|
|
335
|
-
return isDate(obj);
|
|
336
|
-
}
|
|
337
|
-
|
|
330
|
+
isDate: isDate,
|
|
338
331
|
/**
|
|
339
332
|
* Returns number of days since January 1 of that year
|
|
340
333
|
* @deprecated
|
|
341
334
|
* @param {Date} date Gregorian date
|
|
342
335
|
* @return {number}
|
|
343
336
|
*/
|
|
344
|
-
|
|
337
|
+
dayOfYear: function (date) {
|
|
345
338
|
if (!isDate(date)) {
|
|
346
339
|
throw new TypeError(`Argument not a Date: ${date}`);
|
|
347
340
|
}
|
|
@@ -355,30 +348,26 @@ class greg {
|
|
|
355
348
|
}
|
|
356
349
|
}
|
|
357
350
|
return doy;
|
|
358
|
-
}
|
|
359
|
-
|
|
351
|
+
},
|
|
360
352
|
/**
|
|
361
353
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
354
|
+
* @function
|
|
362
355
|
* @param {Date} date Gregorian date
|
|
363
356
|
* @return {number}
|
|
364
357
|
*/
|
|
365
|
-
|
|
366
|
-
return greg2abs(date);
|
|
367
|
-
}
|
|
368
|
-
|
|
358
|
+
greg2abs: greg2abs,
|
|
369
359
|
/**
|
|
370
360
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
371
361
|
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
372
362
|
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
373
363
|
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
374
364
|
* (April, 1993), pages 383-404 for an explanation.
|
|
365
|
+
* @function
|
|
375
366
|
* @param {number} theDate - R.D. number of days
|
|
376
367
|
* @return {Date}
|
|
377
368
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
}
|
|
369
|
+
abs2greg: abs2greg
|
|
370
|
+
};
|
|
382
371
|
|
|
383
372
|
const noopLocale = {
|
|
384
373
|
headers: {
|
|
@@ -395,6 +384,13 @@ const alias = {
|
|
|
395
384
|
'': 'en'
|
|
396
385
|
};
|
|
397
386
|
|
|
387
|
+
/** @private */
|
|
388
|
+
const locales = Object.create(null);
|
|
389
|
+
/** @private */
|
|
390
|
+
let activeLocale = null;
|
|
391
|
+
/** @private */
|
|
392
|
+
let activeName = null;
|
|
393
|
+
|
|
398
394
|
/**
|
|
399
395
|
* A locale in Hebcal is used for translations/transliterations of
|
|
400
396
|
* holidays. `@hebcal/core` supports four locales by default
|
|
@@ -404,13 +400,6 @@ const alias = {
|
|
|
404
400
|
* * `he-x-NoNikud` - Hebrew without nikud (e.g. "שבת")
|
|
405
401
|
*/
|
|
406
402
|
class Locale {
|
|
407
|
-
/** @private */
|
|
408
|
-
static locales = Object.create(null);
|
|
409
|
-
/** @private */
|
|
410
|
-
static activeLocale = null;
|
|
411
|
-
/** @private */
|
|
412
|
-
static activeName = null;
|
|
413
|
-
|
|
414
403
|
/**
|
|
415
404
|
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
416
405
|
* Otherwise, returns `undefined`.
|
|
@@ -420,7 +409,7 @@ class Locale {
|
|
|
420
409
|
*/
|
|
421
410
|
static lookupTranslation(id, locale) {
|
|
422
411
|
const locale0 = locale && locale.toLowerCase();
|
|
423
|
-
const loc = typeof locale == 'string' &&
|
|
412
|
+
const loc = typeof locale == 'string' && locales[locale0] || activeLocale;
|
|
424
413
|
const array = loc[id];
|
|
425
414
|
if (array && array.length && array[0].length) {
|
|
426
415
|
return array[0];
|
|
@@ -451,7 +440,7 @@ class Locale {
|
|
|
451
440
|
if (typeof data.contexts !== 'object' || typeof data.contexts[''] !== 'object') {
|
|
452
441
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
453
442
|
}
|
|
454
|
-
|
|
443
|
+
locales[locale.toLowerCase()] = data.contexts[''];
|
|
455
444
|
}
|
|
456
445
|
|
|
457
446
|
/**
|
|
@@ -463,13 +452,13 @@ class Locale {
|
|
|
463
452
|
*/
|
|
464
453
|
static useLocale(locale) {
|
|
465
454
|
const locale0 = locale.toLowerCase();
|
|
466
|
-
const obj =
|
|
455
|
+
const obj = locales[locale0];
|
|
467
456
|
if (!obj) {
|
|
468
457
|
throw new RangeError(`Locale '${locale}' not found`);
|
|
469
458
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
return
|
|
459
|
+
activeName = alias[locale0] || locale0;
|
|
460
|
+
activeLocale = obj;
|
|
461
|
+
return activeLocale;
|
|
473
462
|
}
|
|
474
463
|
|
|
475
464
|
/**
|
|
@@ -477,7 +466,7 @@ class Locale {
|
|
|
477
466
|
* @return {string}
|
|
478
467
|
*/
|
|
479
468
|
static getLocaleName() {
|
|
480
|
-
return
|
|
469
|
+
return activeName;
|
|
481
470
|
}
|
|
482
471
|
|
|
483
472
|
/**
|
|
@@ -485,7 +474,7 @@ class Locale {
|
|
|
485
474
|
* @return {string[]}
|
|
486
475
|
*/
|
|
487
476
|
static getLocaleNames() {
|
|
488
|
-
return Object.keys(
|
|
477
|
+
return Object.keys(locales).sort();
|
|
489
478
|
}
|
|
490
479
|
|
|
491
480
|
/**
|
|
@@ -495,7 +484,7 @@ class Locale {
|
|
|
495
484
|
*/
|
|
496
485
|
static ordinal(n, locale) {
|
|
497
486
|
const locale1 = locale && locale.toLowerCase();
|
|
498
|
-
const locale0 = locale1 ||
|
|
487
|
+
const locale0 = locale1 || activeName;
|
|
499
488
|
if (!locale0) {
|
|
500
489
|
return this.getEnOrdinal(n);
|
|
501
490
|
}
|
|
@@ -1739,7 +1728,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
|
|
|
1739
1728
|
return new HDate(day, month, hyear);
|
|
1740
1729
|
}
|
|
1741
1730
|
|
|
1742
|
-
const version="3.
|
|
1731
|
+
const version="3.49.0";
|
|
1743
1732
|
|
|
1744
1733
|
const headers={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts={"":{Adar:["אַדָר"],"Adar I":["אַדָר א׳"],"Adar II":["אַדָר ב׳"],Av:["אָב"],Cheshvan:["חֶשְׁוָן"],Elul:["אֱלוּל"],Iyyar:["אִיָיר"],Kislev:["כִּסְלֵו"],Nisan:["נִיסָן"],"Sh'vat":["שְׁבָט"],Sivan:["סִיוָן"],Tamuz:["תַּמּוּז"],Tevet:["טֵבֵת"],Tishrei:["תִשְׁרֵי"]}};var poHeMin = {headers:headers,contexts:contexts};
|
|
1745
1734
|
|