hebcal / hebcal-js

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

Fix year parsing from hebrew #35

Closed ilyagelman closed 7 years ago

ilyagelman commented 7 years ago

Five-letter years in Hebrew yielded a wrong date: hebcal.HDate('ל' אב התשע"ג') Fixed by passing limit of 5 to gematriya to prevent string clipping

Scimonster commented 7 years ago

Thanks for your pull request. Sorry i haven't gotten to it yet, i hope to be able to review over the next couple days. Thanks for understanding.

Scimonster commented 7 years ago

It works, but not for the reason you think it does. (I wrote the gematriya package, so i apologize if it's difficult to understand.) Passing a limit applies to limiting the string output from a number. When passing a string and getting back a number, the second param is treated as a Boolean, of whether to treat it as ordered or not. 5 is a truthy value, so gematriya parses it in an ordered fashion.
I'll merge the PR and then change the value.