Skip to content

Commit

Permalink
Breaking change: core date routines now in @hebcal/hdate
Browse files Browse the repository at this point in the history
Replaced solar calculation engine @hebcal/solar-calc with @hebcal/noaa
Removed all deprecated APIs
  • Loading branch information
mjradwin committed Nov 22, 2023
1 parent b62ceff commit f66d388
Show file tree
Hide file tree
Showing 24 changed files with 277 additions and 1,575 deletions.
316 changes: 158 additions & 158 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/core",
"version": "4.6.0",
"version": "5.0.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"contributors": [
"Eyal Schachter (https://github.com/Scimonster)",
Expand Down Expand Up @@ -63,8 +63,8 @@
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@babel/register": "^7.22.15",
"@hebcal/hdate": "^0.8.0",
"@hebcal/noaa": "^0.8.2",
"@hebcal/solar-calc": "^1.1.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
Expand All @@ -77,8 +77,8 @@
"jsdoc": "^4.0.2",
"jsdoc-to-markdown": "^8.0.0",
"nyc": "^15.1.0",
"rollup": "^4.5.0",
"rollup": "^4.5.1",
"temporal-polyfill": "^0.1.1",
"ttag-cli": "^1.10.8"
"ttag-cli": "^1.10.9"
}
}
96 changes: 0 additions & 96 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,100 +98,4 @@ module.exports = [
}),
],
},
{
input: 'src/hdate-index.js',
output: [
{file: 'dist/hdate.js', format: 'cjs', banner},
],
plugins: [
json({compact: true, preferConst: true}),
babel({
babelHelpers: 'bundled',
presets: [
['@babel/preset-env', {
modules: false,
targets: {
node: TARGET_NODE_VER,
},
}],
],
exclude: ['node_modules/**'],
}),
nodeResolve(),
commonjs(),
],
},
{
input: 'src/hdate-index.js',
output: [
{
file: 'dist/hdate-bundle.js',
format: 'iife',
name: 'hebcal',
indent: false,
banner,
},
{
file: 'dist/hdate-bundle.min.js',
format: 'iife',
name: 'hebcal',
plugins: [terser()],
banner,
},
],
plugins: [
json({compact: true, preferConst: true}),
babel({
babelHelpers: 'bundled',
presets: [
['@babel/preset-env', {
modules: false,
targets: TARGETS_BROWSER,
useBuiltIns: false,
}],
],
exclude: ['node_modules/**'],
}),
commonjs(),
],
},
{
input: 'src/hdate0-index.js',
output: [
{
file: 'dist/hdate0-bundle.js',
format: 'iife',
name: 'hebcal',
indent: false,
banner,
},
{
file: 'dist/hdate0-bundle.min.js',
format: 'iife',
name: 'hebcal',
plugins: [terser()],
banner,
},
],
plugins: [
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env'],
exclude: ['node_modules/**'],
}),
],
},
{
input: 'src/hdate-index.js',
output: {file: 'dist/hdate.mjs', format: 'es', banner},
plugins: [json({compact: true, preferConst: true})],
},
{
input: 'src/hdate0-index.js',
output: {file: 'dist/hdate0.mjs', format: 'es', banner},
},
{
input: 'src/greg0.js',
output: {file: 'dist/greg0.mjs', format: 'es', banner},
},
];
11 changes: 0 additions & 11 deletions src/HebrewDateEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,4 @@ export class HebrewDateEvent extends Event {
return hd.render(locale0, false);
}
}
/**
* Helper function to render a Hebrew date
* @deprecated
* @param {number} day
* @param {string} monthName
* @param {number} fullYear
* @return {string}
*/
static renderHebrew(day, monthName, fullYear) {
return gematriya(day) + ' ' + monthName + ' ' + gematriya(fullYear);
}
}
2 changes: 1 addition & 1 deletion src/anniversary.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {hebrew2abs, abs2hebrew, isLeapYear, months, monthsInYear,
shortKislev, longCheshvan} from './hdate0';
shortKislev, longCheshvan} from '@hebcal/hdate';
import {HDate} from './hdate';

const NISAN = months.NISAN;
Expand Down
2 changes: 1 addition & 1 deletion src/candles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {Locale} from './locale';
import {flags, Event} from './event';
import {Zmanim} from './zmanim';
import {months} from './hdate0';
import {months} from '@hebcal/hdate';

const days = {
FRI: 5,
Expand Down
19 changes: 18 additions & 1 deletion src/candles.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import test from 'ava';
import {Location} from './location';
import {makeCandleEvent, CandleLightingEvent, HavdalahEvent, TimedEvent} from './candles';
import {makeCandleEvent, CandleLightingEvent, HavdalahEvent, TimedEvent,
makeFastStartEnd} from './candles';
import {HolidayEvent} from './holidays';
import {HDate} from './hdate';
import {flags} from './event';
import {HebrewCalendar} from './hebcal';
Expand Down Expand Up @@ -614,3 +616,18 @@ test('fastEndDeg', (t) => {
desc: 'Fast ends',
});
});

test('makeFastStartEnd', (t) => {
const location = Location.lookup('Providence');
const hd = new HDate(8, 'Av', 5783);
const ev = new HolidayEvent(hd, 'Erev Tish\'a B\'Av', flags.EREV | flags.MAJOR_FAST);
const options = {
location,
candlelighting: true,
fastEndDeg: 7.0833,
};
const ev2 = makeFastStartEnd(ev, options);
const startEvent = ev2.startEvent;
t.is(startEvent.eventTime.toISOString(), '2023-07-27T00:10:00.000Z');
t.is(startEvent.eventTimeStr, '20:10');
});
8 changes: 0 additions & 8 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ export class Event {
observedIn(il) {
return il ? this.observedInIsrael() : this.observedInDiaspora();
}
/**
* @deprecated
* Optional additional event attributes (e.g. `eventTimeStr`, `cholHaMoedDay`)
* @return {Object}
*/
getAttrs() {
return this;
}
/**
* Makes a clone of this Event object
* @return {Event}
Expand Down
115 changes: 0 additions & 115 deletions src/greg.js

This file was deleted.

Loading

0 comments on commit f66d388

Please sign in to comment.