I'm wondering if just the comment or the default value is wrong. XMLEncoder's default is .deferredToDate, which matches the behavior of JSONEncoder and JSONDecoder:
Perhaps there is a reason the default date decoding and encoding strategies are different? If not, is the desired behavior that they both be .deferredToDate like JSONEncoder and JSONDecoder? Would it be considered a breaking change to make that fix?
(I should add this has not affected me in production, I have only recently begun exploring this library.)
A couple of the
XMLDecoder.DateDecodingStrategy
cases describe themselves as the default:https://github.com/CoreOffice/XMLCoder/blob/394ddf67af04d2221735fa67ea0a374f3473ddf6/Sources/XMLCoder/Decoder/XMLDecoder.swift#L17-L23
The actual default is
.secondsSince1970
: https://github.com/CoreOffice/XMLCoder/blob/394ddf67af04d2221735fa67ea0a374f3473ddf6/Sources/XMLCoder/Decoder/XMLDecoder.swift#L241-L242I'm wondering if just the comment or the default value is wrong.
XMLEncoder
's default is.deferredToDate
, which matches the behavior ofJSONEncoder
andJSONDecoder
:https://github.com/CoreOffice/XMLCoder/blob/394ddf67af04d2221735fa67ea0a374f3473ddf6/Sources/XMLCoder/Encoder/XMLEncoder.swift#L290-L291
Perhaps there is a reason the default date decoding and encoding strategies are different? If not, is the desired behavior that they both be
.deferredToDate
likeJSONEncoder
andJSONDecoder
? Would it be considered a breaking change to make that fix?(I should add this has not affected me in production, I have only recently begun exploring this library.)