Julia: Dates.format regression on master: Width of milliseconds field cannot be fixed anymore

Created on 13 Mar 2017  ·  3Comments  ·  Source: JuliaLang/julia

On 0.5:

julia> dt = DateTime(2000,1,1)
2000-01-01T00:00:00

julia> Dates.format(dt, "s")
"0"

julia> Dates.format(dt, "sss")
"000"

On master:

julia> dt = DateTime(2000,1,1)
2000-01-01T00:00:00

julia> Dates.format(dt, "s")
"0"

julia> Dates.format(dt, "sss")
"0"

This happens for all trailing zeros, e.g.

julia> Dates.format(DateTime(2000,1,1,0,0,0,10), "sss")
"01"

julia> Dates.format(DateTime(2000,1,1,0,0,0,100), "sss")
"1"
bug dates regression

Most helpful comment

I can fix it

All 3 comments

Additional width examples:

for ms in (0, 100, 120)
    println(Dates.format(DateTime(2000,1,1,0,0,0,ms), "s"))
    println(Dates.format(DateTime(2000,1,1,0,0,0,ms), "ss"))
    println(Dates.format(DateTime(2000,1,1,0,0,0,ms), "sss"))
end

On 0.5

0
00
000
1
10
100
12
12
120

On master:

0
0
0
1
1
1
12
12
12

@quinnj, @omus: can we prevail on one of you to fix this?

I can fix it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m-j-w picture m-j-w  ·  3Comments

Keno picture Keno  ·  3Comments

omus picture omus  ·  3Comments

StefanKarpinski picture StefanKarpinski  ·  3Comments

sbromberger picture sbromberger  ·  3Comments