hebcal / hebcal-js

⛔️ DEPRECATED - a perpetual Jewish Calendar (JavaScript)
GNU General Public License v3.0
123 stars 40 forks source link

.candleLighting() is returning 'thursday' for a 'erev shabbat' #13

Closed emor closed 10 years ago

emor commented 10 years ago

I am using New York as the city. Shabbat candelighting should be on a friday rather than thursday. Here is a sample shabbat, this may be affecting other holidays and calculations as well:

var hebcal = new Hebcal(); var holidays = hebcal.holidays; var holiday1 = holidays[19]; <--- returns erev shabbat var whencandle = holiday1.candleLighting(); <--- returns a thursday date

hope this makes sense, hope its a good find. Thanks!

Scimonster commented 10 years ago

Thanks for the report. What version of HebcalJS are you using, and what timezone are you in? It's quite likely that it's returning the correct Date object, it might just not display properly for your location.

~Sci

On Tue, Jun 17, 2014 at 6:50 AM, Edo Mor notifications@github.com wrote:

I am using New York as the city. Shabbat candelighting should be on a friday rather than thursday. Here is a sample shabbat, this may be affecting other holidays and calculations as well:

var hebcal = new Hebcal(); var holidays = hebcal.holidays; var holiday1 = holidays[19]; <--- returns erev shabbat var whencandle = holiday1.candleLighting(); <--- returns a thursday date

hope this makes sense, hope its a good find. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/hebcal/hebcal-js/issues/13.

emor commented 10 years ago

using version 2.1.1. I'm in New York which is eastern time zone. HebcalJS is detecting my location using geolocation in the browser and that seems to be working fine as it's showing New York for the nearest city.

Scimonster commented 10 years ago

Can you post the output of console.logging holiday1 and whencandle?

emor commented 10 years ago

var holiday1 = holidays[19]; ---> undefined

holiday1 ---> o {date: n, desc: Array[3], IGNORE_YEAR: false, USER_EVENT: false, LIGHT_CANDLES: true…}

  1. CHUL_ONLY: false
  2. IGNORE_YEAR: false
  3. IL_ONLY: false
  4. LIGHT_CANDLES: true
  5. LIGHT_CANDLES_TZEIS: false
  6. USER_EVENT: false
  7. YOM_TOV_ENDS: false
  8. date: n
    1. day: 11
    2. il: false
    3. lat: 40.901499199999996
    4. long: -74.0018067
    5. month: 1
    6. year: 5774
    7. proto: n
  9. desc: Array[3]
    1. 0: "Erev Shabbat"
    2. 1: "Erev Shabbos"
    3. 2: "ערב שבת"
    4. length: 3
    5. proto: Array[0]
  10. proto: o

var whencandle = holiday1.candleLighting(); ---> undefined

whencandle ---> Thu Apr 10 2014 19:12:51 GMT-0400 (EDT)

Scimonster commented 10 years ago

This seems to be a bug, as i am able to reproduce the issue. Thanks for the report. I'll try and fix it for the next version.

emor commented 10 years ago

Great. Thanks. I have a hunch that this bug may be much broader as it may be caused by mismatching gregorian dates to hebrew dates, where for every gregorian date, there are actually 2 hebrew dates and visa versa. Thanks again.

Scimonster commented 10 years ago

I'm thinking something along those lines too.

On 6/18/14, Edo Mor notifications@github.com wrote:

Great. Thanks. I have a hunch that this bug may be much broader as it may be caused by mismatching gregorian dates to hebrew dates, where for every gregorian date, there are actually 2 hebrew dates and visa versa. Thanks again.


Reply to this email directly or view it on GitHub: https://github.com/hebcal/hebcal-js/issues/13#issuecomment-46398759

~Sci

Scimonster commented 10 years ago

Nope, the bug was that HDate().sunset() returns the previous night. This is intentional; i was merely misusing it.

This is fixed in the latest development version, hebcal/hebcal-js@6565a20

Scimonster commented 10 years ago

Be aware that new Hebcal().holidays is not an array anymore. You should always use new Hebcal.HDate().holidays(). I also added the method new Hebcal.HDate().candleLighting().

Scimonster commented 10 years ago

The new release has now gone public. This fixes this bug.

emor commented 10 years ago

this same bug seems to now be affecting havdalah, which is showing the same day as candleLighting except one hour later. ex. candlelighting is 8:02pm on friday and havdalah is 9:02pm on friday, surely shabbat lasts more than an hour.

Thanks!!

Scimonster commented 10 years ago

Whoops. Will be fixed in 2.0.1, to be released soon.

~Sci

On Mon, Jul 21, 2014 at 10:05 PM, Edo Mor notifications@github.com wrote:

this same bug seems to now be affecting havdalah, which is showing the same day as candleLighting except one hour later. ex. candlelighting is 8:02pm on friday and havdalah is 9:02pm on friday, surely shabbat lasts more than an hour.

Thanks!!

— Reply to this email directly or view it on GitHub https://github.com/hebcal/hebcal-js/issues/13#issuecomment-49650361.