diff --git a/stdlib/Dates/src/io.jl b/stdlib/Dates/src/io.jl index e1cf80394dd7f..30fc8001b5c18 100644 --- a/stdlib/Dates/src/io.jl +++ b/stdlib/Dates/src/io.jl @@ -530,11 +530,7 @@ end # show function Base.show(io::IO, p::P) where P <: Period - if get(io, :compact, false) - print(io, p) - else - print(io, P, '(', p.value, ')') - end + print(io, P, '(', p.value, ')') end function Base.show(io::IO, dt::DateTime) diff --git a/stdlib/Dates/test/io.jl b/stdlib/Dates/test/io.jl index 5a630693bff77..b767a229ecdc0 100644 --- a/stdlib/Dates/test/io.jl +++ b/stdlib/Dates/test/io.jl @@ -25,6 +25,7 @@ using Dates @test sprint(show, Dates.Day(12)) == "Dates.Day(12)" @test sprint(print,Dates.Day(12)) == "12 days" @test repr(Dates.Day(12)) == "Dates.Day(12)" + @test occursin("Day(1)", repr(MIME("text/plain"), [Day(1) Day(2)])) @test string(Dates.Hour(12)) == "12 hours" @test sprint(show, Dates.Hour(12)) == "Dates.Hour(12)"