Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add 'date' as alias to 'day' for startOf() and endOf(). #2982
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
referenced this pull request
Feb 24, 2016
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.