Skip to content

Avoid using internal function Dates.default_format #313

@omus

Description

@omus

I noticed this deprecation warning from TimeZones.jl due to the use of Dates.default_format:

┌ Warning: `Dates.default_format(ZonedDateTime)` is deprecated and has no direct replacement. Consider using refactoring to use `parse(::Type{ZonedDateTime}, ::AbstractString)` as an alternative.
│   caller = write at write.jl:338 [inlined]
└ @ Core ~/.julia/packages/JSON3/rT1w2/src/write.jl:338

write(::StringType, buf, pos, len, x::T; dateformat::Dates.DateFormat=Dates.default_format(T), kw...) where {T <: Dates.TimeType} = write(StringType(), buf, pos, len, Dates.format(x, dateformat); kw...)

The deprecation notice is a bit off in that we're formatting a ZonedDateTime and not parsing one.

We could fix this by either adding a special write function for ZonedDateTime or should we document that Dates.default_format should be defined for all Dates.TimeType subtypes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions