diff --git a/src/TableShowUtils.jl b/src/TableShowUtils.jl index 3713b9d..50a7339 100644 --- a/src/TableShowUtils.jl +++ b/src/TableShowUtils.jl @@ -165,8 +165,10 @@ function printHTMLtable(io, source; force_unknown_rows=false) print(io, "") for c in values(r) print(io, "") - if c isa Dates.AbstractTime + if c isa Dates.AbstractTime Markdown.htmlesc(io, sprint(io->print(IOContext(io, :compact => true),c))) + elseif c isa DataValues.DataValue && DataValues.hasvalue(c) && c[] isa Dates.AbstractDateTime + Markdown.htmlesc(io, sprint(io->print(IOContext(io, :compact => true),c[]))) else Markdown.htmlesc(io, sprint(io->show(IOContext(io, :compact => true),c))) end diff --git a/test/test_tableshowutils.jl b/test/test_tableshowutils.jl index 91f2cfe..f9f7ed8 100644 --- a/test/test_tableshowutils.jl +++ b/test/test_tableshowutils.jl @@ -36,10 +36,15 @@ end @testitem "DateTime" begin - using Dates + using Dates, DataValues source = [(a=1,b=DateTime(2010, 5, 6)),(a=2,b=DateTime(2011, 5, 6))] @test sprint(TableShowUtils.printHTMLtable, source) == """
ab
12010-05-06T00:00:00
22011-05-06T00:00:00
""" + + source2 = [(a=1,b=DataValue(DateTime(2010, 5, 6))),(a=2,b=NA)] + + @test sprint(TableShowUtils.printHTMLtable, source2) == """ +
ab
12010-05-06T00:00:00
2#NA
""" end