-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Add 'date' as alias to 'day' for startOf() and endOf(). #2982
Conversation
@icambron Sure, makes sense. Updated. |
LGTM, @ichernev |
I don't understand why the if statement is needed at all in the For that matter, looking closer here, I don't understand why in the existing code there's an inline if for treating an IMHO, all of the logic should be in the |
Sorry for the delay, I've been busy lately. The if statement sets the As for the |
I want to keep this pull request moving along, so: I agree that undefined shortcutting is correct because of the return of the whole method chain. Yes, date needs to be changed to day in endOf to make the add call valid. This actually opens up a bit of a rabbit hole. Ideally, by this logic, date would be an alias for day in the add/subtract functions. And that code path will lead you down to making date and alias for day in durations. I am not sure if this spirals out further, and it's late enough at night that I don't want to find out right now. If we don't want to go make the day/date aliasing thing work everywhere, I think this PR is generally fine. I'm open to the opinions of others on whether we should carry the aliasing through. Programatically it makes sense to carry it all the way through, but from an API design standpoint it's a little wonky. Why would one add a date? One adds a day. |
We'll merge this, the code is not perfect, but it works :) |
Merged in 5393485 |
Add 'date' as alias to 'day' for startOf() and endOf().
Patch for #2974.