JuliaTime / NanoDates.jl

Dates with nanosecond resolved days
MIT License
31 stars 3 forks source link

Missing date output with `format` if time comes first #56

Closed anowacki closed 4 weeks ago

anowacki commented 4 weeks ago

The following does not produe the correct output:

julia> using NanoDates, Dates

julia> dt = DateTime(2000, 1, 1, 1, 2, 3, 456)
2000-01-01T01:02:03.456

julia> ndt = NanoDate(dt)
2000-01-01T01:02:03.456

julia> format(dt, dateformat"HH:MM:SS.sssssssss yyyy/mm/dd")
"01:02:03.456000000 2000/01/01"

julia> format(ndt, dateformat"HH:MM:SS.sssssssss yyyy/mm/dd")
"01:02:03.456000000"

Note output stops after the time.

JeffreySarnoff commented 4 weeks ago

I do not do much processing based on dateformat strings. The package is oriented to the more common of ISO standardized formats.

JeffreySarnoff commented 4 weeks ago

I do not intend to handle general dateformats.

anowacki commented 3 weeks ago

Okay, fair enough. I note, however, that the format(::NanoDate, ::DateFormat; sep) method when sep != "" does work!

julia> format(ndt, DateFormat("HH:MM:SS.sssssssss yyyy/mm/dd"), sep='_')
"01:02:03.456000000 2000/01/01"

julia> format(ndt, DateFormat("HH:MM:SS.sssssssss yyyy/mm/dd"))
"01:02:03.456000000"