Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cellio/477/hebcal date #506

Merged
merged 4 commits into from
Jun 6, 2021
Merged

Cellio/477/hebcal date #506

merged 4 commits into from
Jun 6, 2021

Conversation

cellio
Copy link
Member

@cellio cellio commented Jun 2, 2021

I believe this fixes the date errors we've been seeing at certain times of day with the Hebrew calendar on Judaism. There were a couple issues:

  1. The reason it was off for a few hours a day (in my time zone) is that while most of the Date class uses local time, getISOString() does not -- it uses UTC. In my time zone, UTC midnight (day rollover) is after 8PM local (when we were adding a day because the Hebrew days starts at sundown the previous day), so we were adding 2 to the date until the local time rolled over and then it was right again. Weird! The solution there is not to use getISOString(), hence the local getIsoString() function to construct a local ISO-format date.

  2. At the end of May, the date went blank for a day because HebCal heavily caches API calls that use year=now and month=now, so even in June we were getting May's data, and then not finding June 1 in there and thus failing. I changed the API call to get the current year and month from the local date and use those in the API call.

I do not have a dev environment of my own, and we're still sorting through some things on the shared dev server so I couldn't use that. I tested this, at @luap42 's suggestion, using a userscript. This means in addition to reviewing the code, somebody other than me should test this. Thanks for the help and sorry for the inconvenience!

Addresses #477.

public/assets/community/judaism.js Outdated Show resolved Hide resolved
public/assets/community/judaism.js Outdated Show resolved Hide resolved
@cellio
Copy link
Member Author

cellio commented Jun 2, 2021

I do not understand how a JS-only change causes rubocop tests to fail. Can somebody clue me in?

@cellio
Copy link
Member Author

cellio commented Jun 2, 2021

tzo and dif lines should be removed (and pad becomes var pad)

Done.

@cellio
Copy link
Member Author

cellio commented Jun 4, 2021

@luap42 is this ok with you to merge?

@ArtOfCode- ArtOfCode- merged commit c117507 into develop Jun 6, 2021
@ArtOfCode- ArtOfCode- deleted the cellio/477/hebcal-date branch June 6, 2021 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants