Allow for arguments in HDate.prev()
Opened this issue · 2 comments
mennyg commented
HDate.prev() currently only allows to go back one day. It would be great if we can be allowed to add arguments. Fro example, Hebcal.HDate.prev(7) would give me last week, and .prev(30) would give me a month ago.
Scimonster commented
Good idea! Would you be interesting in making a pull request with this?
mennyg commented
Would love to, but I'm quite new to extended functions and prototypes. Here is what I'm thinking, but it's not working on my side (hdate.js):
prototype.next = function (days) {
return abs2hebrew(this.abs() + days).setLocation(this.lat, this.long);
};
prototype.prev = function (days) {
return abs2hebrew(this.abs() - days).setLocation(this.lat, this.long);
};