-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix repr
on DateTime
#30200
Fix repr
on DateTime
#30200
Conversation
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 good to me. Could probably use another pair of eyes that's more familiar with the dates code.
@@ -400,29 +400,29 @@ As a bonus, all period arithmetic objects work directly with ranges: | |||
|
|||
```jldoctest | |||
julia> dr = Date(2014,1,29):Day(1):Date(2014,2,3) | |||
2014-01-29:1 day:2014-02-03 | |||
Date(2014, 1, 29):1 day:Date(2014, 2, 3) |
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.
These changes seems like an unintended consequence? At least to me it is a step back in readability.
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, the idea is to show dates and times in a format that is valid input syntax. The fact that the step doesn't quite use valid input syntax is the remaining issue here—if that was shown as Day(1)
instead then this whole output would be valid input syntax. Printing date ranges could use a more human-readable format instead of a valid input syntax.
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.
Ok, placed the comment on the wrong line; do we want the new printing from the collect
on the next lines?
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.
Not sure, I guess we can use either format there. This seems fine to me though.
I noticed with this PR julia> DataFrame(:date => today(), :value => rand())
1×2 DataFrame
│ Row │ date │ value │
│ │ Date │ Float64 │
├─────┼───────────────────┼──────────┤
│ 1 │ Date(2018, 12, 4) │ 0.615755 │ If we make the |
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.
Changes look good to me. I'd like someone to chime in on if the :compact
behavioural differences make sense (I think they do). The current behaviour of this PR:
julia> using Dates, DataFrames
julia> d = today()
2018-12-07
julia> print(d)
2018-12-07
julia> show(d)
Date(2018, 12, 7)
julia> fill(d, 2)
2-element Array{Date,1}:
Date(2018, 12, 7)
Date(2018, 12, 7)
julia> fill(d, 2, 2)
2×2 Array{Date,2}:
2018-12-07 2018-12-07
2018-12-07 2018-12-07
julia> DataFrame(:date => today(), :value => rand())
1×2 DataFrame
│ Row │ date │ value │
│ │ Date │ Float64 │
├─────┼────────────┼──────────┤
│ 1 │ 2018-12-07 │ 0.657502 │
Thanks @omus |
Hi everyone, Is this ready for merge now? |
The changes look okay to me, but this will need an entry in NEWS.md. |
Thanks for your review @ararslan. I added the news entry. |
@sam0410 thanks for the contribution! 👍 |
Related to these Dates stdlib changes: - JuliaLang/julia#30200 - JuliaLang/julia#30817
* Overhaul printing of types Related to these Dates stdlib changes: - JuliaLang/julia#30200 - JuliaLang/julia#30817 * Review comments
* Overhaul printing of types Related to these Dates stdlib changes: - JuliaLang/julia#30200 - JuliaLang/julia#30817 * Review comments
An Attempt to fix #29909
Thanks.