EnumerationFoundation5.9.0
DateEncodingStrategy
The strategy to use for encoding Date
values.
enum DateEncodingStrategy
Citizens in Foundation
Members
case custom((Date, Encoder) throws -> Void)
Encode the
Date
as a custom value encoded by the given closure.case deferredToDate
Defer to
Date
for choosing an encoding. This is the default strategy.case formatted(DateFormatter)
Encode the
Date
as a string formatted by the given formatter.case iso8601
Encode the
Date
as an ISO-8601-formatted string (in RFC 3339 format).case millisecondsSince1970
Encode the
Date
as UNIX millisecond timestamp (as a JSON number).case secondsSince1970
Encode the
Date
as a UNIX timestamp (as a JSON number).