-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Added Compat.AbstractDateTime #443
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 |
---|---|---|
|
@@ -769,6 +769,12 @@ else | |
import Dates | ||
end | ||
|
||
if VERSION < v"0.7.0-DEV.3216" | ||
const AbstractDateTime = Compat.Dates.TimeType | ||
else | ||
const AbstractDateTime = Compat.Dates.AbstractDateTime | ||
end | ||
|
||
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. Probably should export this 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. That seems like an odd choice given that it isn't exported in base. 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. You are right here. Don't export this since it isn't exported in Base |
||
if VERSION < v"0.7.0-DEV.3052" | ||
const Printf = Base.Printf | ||
else | ||
|
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.
Seems slightly dangerous to use with dispatch. You could accidentally be given a
Date
orTime
. I'm not sure what a better solution would be ATMThere 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.
Possibly just having a
const AbstractDateTime = Union{DateTime, ZonedDateTime}
in TimeZones.jl would be a better solution. Doing this in Compat would make TimeZones a requirement in Compat which is probably worse.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.
That could also work for our use cases, but I figured it's better to write code that is a bit too general than too restrictive. IFAICT, the worst case scenario is that someone passes in a
Date
orTime
and the code errors at a later point... making the traceback more complicated.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 possible alternative solution is to implement
@compat AbstractDateTime
which would re-write this as aUnion{DateTime,ZonedDateTime}
. That would probably be a bit too annoying though.