Skip to content

Commit

Permalink
Switch solar-calc to improve accuracy of candle-lighting times
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Aug 16, 2020
1 parent 61e471b commit aed5ff9
Show file tree
Hide file tree
Showing 9 changed files with 420 additions and 270 deletions.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ Event names can be rendered in several languges using the <code>locale</code> op
</dd>
</dl>

## Typedefs

<dl>
<dt><a href="#ZmanimTimesResult">ZmanimTimesResult</a> : <code>Object</code></dt>
<dd></dd>
</dl>

<a name="Event"></a>

## Event
Expand Down Expand Up @@ -752,7 +759,7 @@ Class representing halachic times

* [Zmanim](#Zmanim)
* [new Zmanim(date, latitude, longitude)](#new_Zmanim_new)
* [.suntime()](#Zmanim+suntime) ⇒ <code>suncalc.GetTimesResult</code>
* [.suntime()](#Zmanim+suntime)[<code>ZmanimTimesResult</code>](#ZmanimTimesResult)
* [.sunrise()](#Zmanim+sunrise) ⇒ <code>Date</code>
* [.sunset()](#Zmanim+sunset) ⇒ <code>Date</code>
* [.hour()](#Zmanim+hour) ⇒ <code>number</code>
Expand Down Expand Up @@ -789,7 +796,7 @@ Initialize a Zmanim instance.

<a name="Zmanim+suntime"></a>

### zmanim.suntime() ⇒ <code>suncalc.GetTimesResult</code>
### zmanim.suntime() ⇒ [<code>ZmanimTimesResult</code>](#ZmanimTimesResult)
**Kind**: instance method of [<code>Zmanim</code>](#Zmanim)
<a name="Zmanim+sunrise"></a>

Expand Down Expand Up @@ -2113,3 +2120,29 @@ Options to configure which events are returned
| locale | <code>string</code> | translate event titles according to a locale (one of `fi`, `fr`, `he`, `hu`, `pl`, `ru`, `ashkenazi`, `ashkenazi_litvish`, `ashkenazi_poylish`, `ashkenazi_standard`) |
| addHebrewDates | <code>boolean</code> | print the Hebrew date for the entire date range |
| addHebrewDatesForEvents | <code>boolean</code> | print the Hebrew date for dates with some events |

<a name="ZmanimTimesResult"></a>

## ZmanimTimesResult : <code>Object</code>
**Kind**: global typedef
**Properties**

| Name | Type |
| --- | --- |
| dawn | <code>Date</code> |
| dusk | <code>Date</code> |
| goldenHour | <code>Date</code> |
| goldenHourEnd | <code>Date</code> |
| nauticalDawn | <code>Date</code> |
| nauticalDusk | <code>Date</code> |
| night | <code>Date</code> |
| nightEnd | <code>Date</code> |
| solarNoon | <code>Date</code> |
| sunrise | <code>Date</code> |
| sunriseEnd | <code>Date</code> |
| sunset | <code>Date</code> |
| sunsetStart | <code>Date</code> |
| alotHaShachar | <code>Date</code> |
| misheyakir | <code>Date</code> |
| misheyakirMachmir | <code>Date</code> |
| tzeit | <code>Date</code> |
24 changes: 21 additions & 3 deletions hebcal.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/// <reference types="node"/>

import suncalc from 'suncalc';

declare module '@hebcal/core' {
/**
* Represents an Event with a title, date, and flags
Expand Down Expand Up @@ -268,6 +266,26 @@ declare module '@hebcal/core' {
static addLocation(cityName: string, location: Location): boolean;
}

export interface ZmanimTimesResult {
dawn: Date;
dusk: Date;
goldenHour: Date;
goldenHourEnd: Date;
nauticalDawn: Date;
nauticalDusk: Date;
night: Date;
nightEnd: Date;
solarNoon: Date;
sunrise: Date;
sunriseEnd: Date;
sunset: Date;
sunsetStart: Date;
alotHaShachar: Date;
misheyakir: Date;
misheyakirMachmir: Date;
tzeit: Date;
}

/**
* Class representing halachic times
*/
Expand All @@ -279,7 +297,7 @@ declare module '@hebcal/core' {
* @param longitude
*/
constructor(date: Date | HDate, latitude: number, longitude: number);
suntime(): suncalc.GetTimesResult;
suntime(): ZmanimTimesResult;
sunrise(): Date;
sunset(): Date;
hour(): number;
Expand Down
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": "2.2.4",
"version": "2.3.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"contributors": [
"Eyal Schachter (https://github.com/Scimonster)",
Expand Down Expand Up @@ -68,21 +68,21 @@
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.10.3",
"@babel/register": "^7.10.5",
"@hebcal/solar-calc": "^1.0.4",
"@rollup/plugin-babel": "^5.2.0",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"ava": "^3.11.1",
"core-js": "^3.6.5",
"eslint": "^7.6.0",
"eslint": "^7.7.0",
"eslint-config-google": "^0.14.0",
"gematriya": "^2.0.0",
"jsdoc": "^3.6.5",
"jsdoc-to-markdown": "^6.0.1",
"nyc": "^15.1.0",
"rollup": "^2.25.0",
"rollup": "^2.26.0",
"rollup-plugin-terser": "^7.0.0",
"suncalc": "^1.8.0",
"tsd-jsdoc": "^2.5.0",
"ttag-cli": "^1.8.4"
}
Expand Down
Loading

0 comments on commit aed5ff9

Please sign in to comment.