@hebcal/core 4.5.1 → 5.0.0-rc2
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 +1109 -457
- package/dist/bundle.js +5124 -1331
- package/dist/bundle.min.js +2 -2
- package/dist/index.js +2216 -1525
- package/dist/index.mjs +2215 -1524
- package/hebcal.d.ts +28 -95
- package/package.json +10 -8
- package/dist/greg0.mjs +0 -159
- package/dist/hdate-bundle.js +0 -1864
- package/dist/hdate-bundle.min.js +0 -2
- package/dist/hdate.js +0 -1853
- package/dist/hdate.mjs +0 -1909
- package/dist/hdate0-bundle.js +0 -444
- package/dist/hdate0-bundle.min.js +0 -2
- package/dist/hdate0.mjs +0 -465
- package/po/a.txt +0 -576
- package/po/b.txt +0 -264
package/hebcal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { GeoLocation } from '@hebcal/noaa';
|
|
2
2
|
|
|
3
3
|
declare module '@hebcal/core' {
|
|
4
4
|
export const version: string;
|
|
@@ -16,8 +16,6 @@ declare module '@hebcal/core' {
|
|
|
16
16
|
*/
|
|
17
17
|
constructor(date: HDate, desc: string, mask?: number, attrs?: any);
|
|
18
18
|
getFlags(): number;
|
|
19
|
-
/** @deprecated */
|
|
20
|
-
getAttrs(): any;
|
|
21
19
|
getDesc(): string;
|
|
22
20
|
basename(): string;
|
|
23
21
|
url(): string;
|
|
@@ -283,7 +281,7 @@ declare module '@hebcal/core' {
|
|
|
283
281
|
/**
|
|
284
282
|
* A Hebcal location is used for Zmanim and a latitude, longitude, timezone, and more
|
|
285
283
|
*/
|
|
286
|
-
export class Location {
|
|
284
|
+
export class Location extends GeoLocation {
|
|
287
285
|
/**
|
|
288
286
|
* Initialize a Location instance
|
|
289
287
|
* @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
|
|
@@ -292,9 +290,10 @@ declare module '@hebcal/core' {
|
|
|
292
290
|
* @param tzid - Olson timezone ID, e.g. "America/Chicago"
|
|
293
291
|
* @param cityName - optional descriptive city name
|
|
294
292
|
* @param countryCode - ISO 3166 alpha-2 country code (e.g. "FR")
|
|
295
|
-
* @param geoid - optional string or numeric geographic ID
|
|
293
|
+
* @param [geoid] - optional string or numeric geographic ID
|
|
294
|
+
* @param [elevation] - in meters (default `0`)
|
|
296
295
|
*/
|
|
297
|
-
constructor(latitude: number, longitude: number, il: boolean, tzid: string, cityName?: string, countryCode?: string, geoid?: string);
|
|
296
|
+
constructor(latitude: number, longitude: number, il: boolean, tzid: string, cityName?: string, countryCode?: string, geoid?: string, elevation?: number);
|
|
298
297
|
/**
|
|
299
298
|
* Creates a location object from one of 60 "classic" Hebcal city names.
|
|
300
299
|
* The following city names are supported:
|
|
@@ -328,22 +327,6 @@ declare module '@hebcal/core' {
|
|
|
328
327
|
* Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location
|
|
329
328
|
*/
|
|
330
329
|
getTimeFormatter(): Intl.DateTimeFormat;
|
|
331
|
-
/** @deprecated */
|
|
332
|
-
sunset(hdate: Date | HDate): Date;
|
|
333
|
-
/**
|
|
334
|
-
* @deprecated
|
|
335
|
-
* @param [angle=8.5] optional time for solar depression.
|
|
336
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
337
|
-
*/
|
|
338
|
-
tzeit(hdate: Date | HDate, angle?: number): Date;
|
|
339
|
-
/**
|
|
340
|
-
* Builds a city description from geonameid string components
|
|
341
|
-
* @deprecated
|
|
342
|
-
* @param cityName e.g. 'Tel Aviv' or 'Chicago'
|
|
343
|
-
* @param admin1 e.g. 'England' or 'Massachusetts'
|
|
344
|
-
* @param countryName full country name, e.g. 'Israel' or 'United States'
|
|
345
|
-
*/
|
|
346
|
-
static geonameCityDescr(cityName: string, admin1: string, countryName: string): string;
|
|
347
330
|
/**
|
|
348
331
|
* Converts timezone info from Zip-Codes.com to a standard Olson tzid.
|
|
349
332
|
* @example
|
|
@@ -367,26 +350,6 @@ declare module '@hebcal/core' {
|
|
|
367
350
|
static addLocation(cityName: string, location: Location): boolean;
|
|
368
351
|
}
|
|
369
352
|
|
|
370
|
-
export interface ZmanimTimesResult {
|
|
371
|
-
dawn: Date;
|
|
372
|
-
dusk: Date;
|
|
373
|
-
goldenHour: Date;
|
|
374
|
-
goldenHourEnd: Date;
|
|
375
|
-
nauticalDawn: Date;
|
|
376
|
-
nauticalDusk: Date;
|
|
377
|
-
night: Date;
|
|
378
|
-
nightEnd: Date;
|
|
379
|
-
solarNoon: Date;
|
|
380
|
-
sunrise: Date;
|
|
381
|
-
sunriseEnd: Date;
|
|
382
|
-
sunset: Date;
|
|
383
|
-
sunsetStart: Date;
|
|
384
|
-
alotHaShachar: Date;
|
|
385
|
-
misheyakir: Date;
|
|
386
|
-
misheyakirMachmir: Date;
|
|
387
|
-
tzeit: Date;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
353
|
/**
|
|
391
354
|
* Calculate halachic times (zmanim / זְמַנִּים) for a given day and location.
|
|
392
355
|
* Calculations are available for tzeit / tzais (nightfall),
|
|
@@ -399,12 +362,11 @@ declare module '@hebcal/core' {
|
|
|
399
362
|
export class Zmanim {
|
|
400
363
|
/**
|
|
401
364
|
* Initialize a Zmanim instance
|
|
365
|
+
* @param gloc GeoLocation including latitude, longitude, and timezone
|
|
402
366
|
* @param date Regular or Hebrew Date. If `date` is a regular `Date`,
|
|
403
367
|
* hours, minutes, seconds and milliseconds are ignored
|
|
404
|
-
* @param latitude
|
|
405
|
-
* @param longitude
|
|
406
368
|
*/
|
|
407
|
-
constructor(date: Date | HDate
|
|
369
|
+
constructor(gloc: GeoLocation, date: Date | HDate);
|
|
408
370
|
|
|
409
371
|
/**
|
|
410
372
|
* Returns a string like "2022-04-01T13:06:00-11:00"
|
|
@@ -429,8 +391,6 @@ declare module '@hebcal/core' {
|
|
|
429
391
|
*/
|
|
430
392
|
timeAtAngle(angle: number, rising: boolean): Date;
|
|
431
393
|
|
|
432
|
-
/** @deprecated */
|
|
433
|
-
suntime(): ZmanimTimesResult;
|
|
434
394
|
/** Upper edge of the Sun appears over the eastern horizon in the morning (0.833° above horizon) */
|
|
435
395
|
sunrise(): Date;
|
|
436
396
|
/** When the upper edge of the Sun disappears below the horizon (0.833° below horizon) */
|
|
@@ -439,12 +399,7 @@ declare module '@hebcal/core' {
|
|
|
439
399
|
dawn(): Date;
|
|
440
400
|
/** Civil dusk; Sun is 6° below the horizon in the evening */
|
|
441
401
|
dusk(): Date;
|
|
442
|
-
hour(): number;
|
|
443
|
-
hourMins(): number;
|
|
444
402
|
gregEve(): Date;
|
|
445
|
-
nightHour(): number;
|
|
446
|
-
nightHourMins(): number;
|
|
447
|
-
hourOffset(hours: number): Date;
|
|
448
403
|
/** Midday – Chatzot; Sunrise plus 6 halachic hours */
|
|
449
404
|
chatzot(): Date;
|
|
450
405
|
/** Midnight – Chatzot; Sunset plus 6 halachic hours */
|
|
@@ -490,18 +445,6 @@ declare module '@hebcal/core' {
|
|
|
490
445
|
* @param roundMinute round time to nearest minute (default true)
|
|
491
446
|
*/
|
|
492
447
|
sunsetOffset(offset: number, roundMinute?: boolean): Date;
|
|
493
|
-
/**
|
|
494
|
-
* Returns an array with sunset + offset Date object, and a 24-hour string formatted time.
|
|
495
|
-
* @deprecated
|
|
496
|
-
*/
|
|
497
|
-
sunsetOffsetTime(offset: number, timeFormat: Intl.DateTimeFormat): any[];
|
|
498
|
-
/**
|
|
499
|
-
* Returns an array with tzeit Date object and a 24-hour string formatted time.
|
|
500
|
-
* @deprecated
|
|
501
|
-
* @param angle optional time for solar depression.
|
|
502
|
-
* Default is 8.5 degrees for 3 small stars, use 7.083 degrees for 3 medium-sized stars.
|
|
503
|
-
*/
|
|
504
|
-
tzeitTime(angle: number, timeFormat: Intl.DateTimeFormat): any[];
|
|
505
448
|
}
|
|
506
449
|
|
|
507
450
|
export interface Headers {
|
|
@@ -575,18 +518,6 @@ declare module '@hebcal/core' {
|
|
|
575
518
|
static hebrewStripNikkud(str: string): string;
|
|
576
519
|
}
|
|
577
520
|
|
|
578
|
-
/**
|
|
579
|
-
* A simple Hebrew date
|
|
580
|
-
*/
|
|
581
|
-
export type SimpleHebrewDate = {
|
|
582
|
-
/** Hebrew year */
|
|
583
|
-
yy: number;
|
|
584
|
-
/** Hebrew month of year (1=NISAN, 7=TISHREI) */
|
|
585
|
-
mm: number;
|
|
586
|
-
/** Day of month (1-30) */
|
|
587
|
-
dd: number;
|
|
588
|
-
};
|
|
589
|
-
|
|
590
521
|
export interface DailyLearningOptions {
|
|
591
522
|
[key: string]: any;
|
|
592
523
|
}
|
|
@@ -878,46 +809,48 @@ declare module '@hebcal/core' {
|
|
|
878
809
|
/**
|
|
879
810
|
* Gregorian date helper functions.
|
|
880
811
|
*/
|
|
881
|
-
export
|
|
812
|
+
export declare namespace greg {
|
|
882
813
|
/**
|
|
883
814
|
* Long names of the Gregorian months (1='January', 12='December')
|
|
815
|
+
* @readonly
|
|
816
|
+
* @type {string[]}
|
|
884
817
|
*/
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Returns true if the object is a Javascript Date
|
|
888
|
-
*/
|
|
889
|
-
static isDate(obj: any): boolean;
|
|
818
|
+
const monthNames: string[];
|
|
890
819
|
/**
|
|
891
820
|
* Returns true if the Gregorian year is a leap year
|
|
892
|
-
* @param year
|
|
821
|
+
* @param {number} year Gregorian year
|
|
822
|
+
* @return {boolean}
|
|
893
823
|
*/
|
|
894
|
-
|
|
824
|
+
function isLeapYear(year: number): boolean;
|
|
895
825
|
/**
|
|
896
826
|
* Number of days in the Gregorian month for given year
|
|
897
|
-
* @param month
|
|
898
|
-
* @param year
|
|
827
|
+
* @param {number} month Gregorian month (1=January, 12=December)
|
|
828
|
+
* @param {number} year Gregorian year
|
|
829
|
+
* @return {number}
|
|
899
830
|
*/
|
|
900
|
-
|
|
831
|
+
function daysInMonth(month: number, year: number): number;
|
|
901
832
|
/**
|
|
902
|
-
* Returns
|
|
903
|
-
* @
|
|
904
|
-
* @
|
|
833
|
+
* Returns true if the object is a Javascript Date
|
|
834
|
+
* @param {Object} obj
|
|
835
|
+
* @return {boolean}
|
|
905
836
|
*/
|
|
906
|
-
|
|
837
|
+
function isDate(obj: any): boolean;
|
|
907
838
|
/**
|
|
908
839
|
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
909
|
-
* @param date
|
|
840
|
+
* @param {Date} date Gregorian date
|
|
841
|
+
* @return {number}
|
|
910
842
|
*/
|
|
911
|
-
|
|
843
|
+
function greg2abs(date: Date): number;
|
|
912
844
|
/**
|
|
913
845
|
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
914
846
|
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
915
847
|
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
916
848
|
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
917
849
|
* (April, 1993), pages 383-404 for an explanation.
|
|
918
|
-
* @param
|
|
850
|
+
* @param {number} abs - R.D. number of days
|
|
851
|
+
* @return {Date}
|
|
919
852
|
*/
|
|
920
|
-
|
|
853
|
+
function abs2greg(abs: number): Date;
|
|
921
854
|
}
|
|
922
855
|
|
|
923
856
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc2",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -60,23 +60,25 @@
|
|
|
60
60
|
"verbose": true
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@babel/core": "^7.23.
|
|
64
|
-
"@babel/preset-env": "^7.23.
|
|
63
|
+
"@babel/core": "^7.23.3",
|
|
64
|
+
"@babel/preset-env": "^7.23.3",
|
|
65
65
|
"@babel/register": "^7.22.15",
|
|
66
|
-
"@hebcal/
|
|
66
|
+
"@hebcal/hdate": "^0.8.1",
|
|
67
|
+
"@hebcal/noaa": "^0.8.6",
|
|
67
68
|
"@rollup/plugin-babel": "^6.0.4",
|
|
68
69
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
69
70
|
"@rollup/plugin-json": "^6.0.1",
|
|
70
71
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
71
72
|
"@rollup/plugin-terser": "^0.4.4",
|
|
72
73
|
"ava": "^5.3.1",
|
|
73
|
-
"core-js": "^3.33.
|
|
74
|
-
"eslint": "^8.
|
|
74
|
+
"core-js": "^3.33.3",
|
|
75
|
+
"eslint": "^8.54.0",
|
|
75
76
|
"eslint-config-google": "^0.14.0",
|
|
76
77
|
"jsdoc": "^4.0.2",
|
|
77
78
|
"jsdoc-to-markdown": "^8.0.0",
|
|
78
79
|
"nyc": "^15.1.0",
|
|
79
|
-
"rollup": "^4.
|
|
80
|
-
"
|
|
80
|
+
"rollup": "^4.5.1",
|
|
81
|
+
"temporal-polyfill": "^0.1.1",
|
|
82
|
+
"ttag-cli": "^1.10.9"
|
|
81
83
|
}
|
|
82
84
|
}
|
package/dist/greg0.mjs
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/*! @hebcal/core v4.5.1 */
|
|
2
|
-
/*
|
|
3
|
-
* More minimal greg routines
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** @private */
|
|
7
|
-
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
8
|
-
/** @private */
|
|
9
|
-
const monthLengths = [
|
|
10
|
-
lengths,
|
|
11
|
-
lengths.slice(),
|
|
12
|
-
];
|
|
13
|
-
monthLengths[1][2] = 29;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
* @param {number} x
|
|
18
|
-
* @param {number} y
|
|
19
|
-
* @return {number}
|
|
20
|
-
*/
|
|
21
|
-
function mod(x, y) {
|
|
22
|
-
return x - y * Math.floor(x / y);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @private
|
|
27
|
-
* @param {number} x
|
|
28
|
-
* @param {number} y
|
|
29
|
-
* @return {number}
|
|
30
|
-
*/
|
|
31
|
-
function quotient(x, y) {
|
|
32
|
-
return Math.floor(x / y);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Returns true if the Gregorian year is a leap year
|
|
37
|
-
* @private
|
|
38
|
-
* @param {number} year Gregorian year
|
|
39
|
-
* @return {boolean}
|
|
40
|
-
*/
|
|
41
|
-
function isLeapYear(year) {
|
|
42
|
-
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Number of days in the Gregorian month for given year
|
|
47
|
-
* @private
|
|
48
|
-
* @param {number} month Gregorian month (1=January, 12=December)
|
|
49
|
-
* @param {number} year Gregorian year
|
|
50
|
-
* @return {number}
|
|
51
|
-
*/
|
|
52
|
-
function daysInMonth(month, year) {
|
|
53
|
-
// 1 based months
|
|
54
|
-
return monthLengths[+isLeapYear(year)][month];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Returns true if the object is a Javascript Date
|
|
59
|
-
* @private
|
|
60
|
-
* @param {Object} obj
|
|
61
|
-
* @return {boolean}
|
|
62
|
-
*/
|
|
63
|
-
function isDate(obj) {
|
|
64
|
-
return typeof obj === 'object' && Date.prototype === obj.__proto__;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/*
|
|
68
|
-
const ABS_14SEP1752 = 639797;
|
|
69
|
-
const ABS_2SEP1752 = 639785;
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
74
|
-
* @private
|
|
75
|
-
* @param {Date} date Gregorian date
|
|
76
|
-
* @return {number}
|
|
77
|
-
*/
|
|
78
|
-
function greg2abs(date) {
|
|
79
|
-
if (!isDate(date)) {
|
|
80
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
81
|
-
}
|
|
82
|
-
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
83
|
-
/*
|
|
84
|
-
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
85
|
-
throw new RangeError(`Invalid Date: ${date}`);
|
|
86
|
-
}
|
|
87
|
-
*/
|
|
88
|
-
return abs;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @private
|
|
93
|
-
* @param {number} abs - R.D. number of days
|
|
94
|
-
* @return {number}
|
|
95
|
-
*/
|
|
96
|
-
function yearFromFixed(abs) {
|
|
97
|
-
const l0 = abs - 1;
|
|
98
|
-
const n400 = quotient(l0, 146097);
|
|
99
|
-
const d1 = mod(l0, 146097);
|
|
100
|
-
const n100 = quotient(d1, 36524);
|
|
101
|
-
const d2 = mod(d1, 36524);
|
|
102
|
-
const n4 = quotient(d2, 1461);
|
|
103
|
-
const d3 = mod(d2, 1461);
|
|
104
|
-
const n1 = quotient(d3, 365);
|
|
105
|
-
const year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
|
|
106
|
-
return n100 != 4 && n1 != 4 ? year + 1 : year;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @private
|
|
111
|
-
* @param {number} year
|
|
112
|
-
* @param {number} month (1-12)
|
|
113
|
-
* @param {number} day (1-31)
|
|
114
|
-
* @return {number}
|
|
115
|
-
*/
|
|
116
|
-
function toFixed(year, month, day) {
|
|
117
|
-
const py = year - 1;
|
|
118
|
-
return 365 * py +
|
|
119
|
-
quotient(py, 4) -
|
|
120
|
-
quotient(py, 100) +
|
|
121
|
-
quotient(py, 400) +
|
|
122
|
-
quotient((367 * month - 362), 12) +
|
|
123
|
-
(month <= 2 ? 0 : (isLeapYear(year) ? -1 : -2)) +
|
|
124
|
-
day;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
129
|
-
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
130
|
-
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
131
|
-
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
132
|
-
* (April, 1993), pages 383-404 for an explanation.
|
|
133
|
-
* @private
|
|
134
|
-
* @param {number} abs - R.D. number of days
|
|
135
|
-
* @return {Date}
|
|
136
|
-
*/
|
|
137
|
-
function abs2greg(abs) {
|
|
138
|
-
if (typeof abs !== 'number') {
|
|
139
|
-
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
140
|
-
}
|
|
141
|
-
abs = Math.trunc(abs);
|
|
142
|
-
/*
|
|
143
|
-
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
144
|
-
throw new RangeError(`Invalid Date: ${abs}`);
|
|
145
|
-
}
|
|
146
|
-
*/
|
|
147
|
-
const year = yearFromFixed(abs);
|
|
148
|
-
const priorDays = abs - toFixed(year, 1, 1);
|
|
149
|
-
const correction = abs < toFixed(year, 3, 1) ? 0 : (isLeapYear(year) ? 1 : 2);
|
|
150
|
-
const month = quotient((12 * (priorDays + correction) + 373), 367);
|
|
151
|
-
const day = abs - toFixed(year, month, 1) + 1;
|
|
152
|
-
const dt = new Date(year, month - 1, day);
|
|
153
|
-
if (year < 100 && year >= 0) {
|
|
154
|
-
dt.setFullYear(year);
|
|
155
|
-
}
|
|
156
|
-
return dt;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export { abs2greg, daysInMonth, greg2abs, isDate, isLeapYear, mod };
|