-
Notifications
You must be signed in to change notification settings - Fork 565
Add dateutil.utils.today #474
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| package_data={"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]}, | ||
| zip_safe=True, | ||
| requires=["six"], | ||
| tests_require=["freezegun"], | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should note that I'm not sure that this is the most foolproof way of installing test-specific dependencies, as the only thing that cares about this particular line is, AFAIK, |
||
| install_requires=["six >=1.5"], # XXX fix when packaging is sane again | ||
| classifiers=[ | ||
| 'Development Status :: 5 - Production/Stable', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Responding to this comment by @jbrockmendel:
My reason for calling it
todaywas because, frankly, I think that this is close todatetime.datetime.today()should do, and I think it violates principle of least surprise to find thatdatetime.today()is basically just an alias fordatetime.now(). That said, the name overloading is my main concern about this function.I think there are a few reasonable ways forward:
datetime.today()should have been and people are more likely to be shocked thatdatetime.datetime.today()does something else than thatdateutil.utils.today()does what it does.utils.today()takes an optionaltimeargument in addition to an optionaltzinfoargument. This makes it more clear that what it does is give you "today at this time, defaulting to midnight". The reason I don't like this is that there could be a conflict betweentime(which may have atzinfoof its own) andtzinfo, and also the interface isn't nearly as clean.today_midnight()ortoday_datetime()or something.I think I'm inclined to leave it as is, considering
pendulumhas a similar real distinction between itsnowandtodaybehavior: