DateDecodingStrategy

public enum DateDecodingStrategy

Enum representing the various strategies for decoding Dates from BSON.

As per the BSON specification, the default strategy is to decode Dates from BSON datetime objects.

See also

bsonspec.org
  • Decode Dates stored as BSON datetimes (default).

    Declaration

    Swift

    case bsonDateTime
  • Decode Dates stored as numbers of seconds since January 1, 1970.

    Declaration

    Swift

    case millisecondsSince1970
  • Decode Dates stored as numbers of milliseconds since January 1, 1970.

    Declaration

    Swift

    case secondsSince1970
  • Decode Dates by deferring to their default decoding implementation.

    Declaration

    Swift

    case deferredToDate
  • Decode Dates stored as ISO8601 formatted strings.

    Declaration

    Swift

    case iso8601
  • Decode Dates stored as strings parsable by the given formatter.

    Declaration

    Swift

    case formatted(DateFormatter)
  • Decode Dates using the provided closure.

    Declaration

    Swift

    case custom((_ decoder: Decoder) throws -> Date)