-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
day of week cleanup #19212
day of week cleanup #19212
Conversation
@@ -220,7 +220,7 @@ dt = Dates.Date(2014,5,21) | |||
@test Dates.tonext(dt,Dates.Mon) == Dates.Date(2014,5,26) | |||
@test Dates.tonext(dt,Dates.Tue) == Dates.Date(2014,5,27) | |||
# No dayofweek function for out of range values | |||
@test_throws KeyError Dates.tonext(dt,8) | |||
#@test_throws KeyError Dates.tonext(dt,8) |
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.
Are you planning on adding this back in?
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.
No, it's going to be removed (tonext
no longer takes integer arguments).
Looking good. |
@@ -219,8 +219,6 @@ dt = Dates.Date(2014,5,21) | |||
@test Dates.tonext(dt,Dates.Sun) == Dates.Date(2014,5,25) | |||
@test Dates.tonext(dt,Dates.Mon) == Dates.Date(2014,5,26) | |||
@test Dates.tonext(dt,Dates.Tue) == Dates.Date(2014,5,27) | |||
# No dayofweek function for out of range values | |||
#@test_throws KeyError Dates.tonext(dt,8) | |||
|
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.
A test with
@test Dates.firstdayofweek(Dates.DateTime(2013,12,24), firstday=Monday) == Dates.DateTime(2013,12,23)
@test Dates.firstdayofweek(Dates.DateTime(2013,12,24), firstday=Sunday) == Dates.DateTime(2013,12,22)
could be a good idea
and a similar test with lastdayofweek
Something like
@test Dates.lastdayofweek(Dates.DateTime(2013,12,24), firstday=Monday) == Dates.DateTime(2013,12,29)
@test Dates.lastdayofweek(Dates.DateTime(2013,12,24), firstday=Sunday) == Dates.DateTime(2013,12,28)
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.
Good call, done.
2c3f69a
to
b2f3e8f
Compare
Okay, hopefully this should be ready. One question is whether the optional arguments to |
|
Also, should we deprecate |
I'd be fine with either positional or keyword + deprecating |
a3c599c
to
7de7c64
Compare
7de7c64
to
79a19f8
Compare
Okay, this is rebased and ready to go. Any objections? |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
That looks like an objection :p |
I'd assume the regressions are from the deprecation right? If that's true, then the slowdown is expected and the benchmark should just be rewritten. |
Well, the |
Do we still want to do this? |
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.
Yes, I'm still in favor of this. I don't think the previously noted performance regression should stop this; we're adding functionality that makes up for it.
""" | ||
dayabbr(dt::Integer;locale::AbstractString="english") = VALUETODAYOFWEEKABBR[locale][dt] | ||
DayOfWeek(dt::TimeType) |
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.
I think I'd like to still keep this lowercase dayofweek
, it follows the more general pattern in Dates with types being proper-cased and accessors being lowercased.
@@ -61,7 +61,7 @@ Dates Functions | |||
--------------- | |||
|
|||
All Dates functions are defined in the ``Dates`` module; note that only the ``Date``, ``DateTime``, and ``now`` functions are exported; | |||
to use all other ``Dates`` functions, you'll need to prefix each function call with an explicit ``Dates.``, e.g. ``Dates.dayofweek(dt)``. | |||
to use all other ``Dates`` functions, you'll need to prefix each function call with an explicit ``Dates.``, e.g. ``Dates.DayOfWeek(dt)``. |
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.
Looks like these docs need to be moved from dates.rst.
Seems dead? |
DayOfWeek
anEnum
, deprecatedayofweek
. (Day of week (Monday, Tuesday, ...) and Months might be Enum #19210)firsdayofweek
/lastdayofweek
(firstdayofweek/lastdayofweek should support Sunday beginning weeks #19208)