Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.
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.