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

Handle DATE() parameters the same as excel does. #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Handle DATE() parameters the same as excel does. #52

wants to merge 1 commit into from

Conversation

stevebroshar
Copy link

I'm interested in using formula.js, and it's important the functions act like excel does. This PR modifies DATE() to handle the parameters like excel does. It adds 1900 to year it it's 0..1899, errors if year is >9999, and allows negative month and day values -- which js handles correctly by selecting a date at a negative month/day offset.

I guess one might argue that adding 1900 to a year like 1899 (to get 3799!) is of questionable value, but it is what excel does.

I also added test cases. And I added more structure to the tests -- closer to the ideal of one assert per test.

This will probably be the first PR from me. I will submit more if this one seems good and when I find issues with other functions.

@stevebroshar
Copy link
Author

Since I didn't hear back on this change for a while, I forked the davidpolberger branch and implemented my changes on that code line. So, there's not much value in only merging in this one little change.

I am concerned that development of the project has become fractured into many different branches. But, I don't know how to improve that situation.

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.

1 participant