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

Allow for arguments in HDate.prev() #78

Open
mennyg opened this issue Jan 15, 2020 · 2 comments
Open

Allow for arguments in HDate.prev() #78

mennyg opened this issue Jan 15, 2020 · 2 comments

Comments

@mennyg
Copy link

mennyg commented Jan 15, 2020

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
Copy link
Contributor

Good idea! Would you be interesting in making a pull request with this?

@mennyg
Copy link
Author

mennyg commented Jan 15, 2020

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);
};

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

No branches or pull requests

2 participants