Skip to content

DateTime values are printed with a potentially incorrect timezone indicator #54

Open

Description

When printing a DateTime value into a TOML file, TOML.jl appends a "Z" to the end of the DateTime. The "Z" indicates that the timestamp is in the zero offset zone for UTC. Since DateTime does not carry timezone information this Z can be erroneous. The TOML spec indicates that the bare timestamp with no timezone information is spec compliant. Given the lack of timezone information this is a better default for TOML.jl.

In my particular instance I was writing output that was in ESD (UTC -4). While the offset wasn't particularly important in my case, the Z caused confusion when a colleague saw it. I can of course manually adjust my timestamp to UTC zero before exporting but TOML.jl should not make this assumption.

Here is an example where the Z is appended without any knowledge about the timezone.

julia> TOML.print(Dict("Date" => DateTime(2024,10,22,12)))
Date = 2024-10-22T12:00:00.000Z

I believe instead the above should generate the output Date = 2024-10-22T12:00:00.000 which meets the TOML spec and does not make unfounded timezone assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions