Date

public extension Date
extension Date: QueryableRange
  • A small error type thrown when the date found in JSON cannot be deserialized.

    See more

    Declaration

    Swift

    enum Error : String, Swift.Error
  • A formatter ready to handle iso8601 dates: normalized string output to an offset of 0 from UTC.

    Declaration

    Swift

    static func iso8601Formatter(timeZone: TimeZone? = nil) -> DateFormatter
  • A custom for deserializing dates that come from Contentful This method first attempts to deserialize ISO8601 internetDateTime with fractional seconds then falls back to attempt the three other ISO8601 variants that the Contentful web app enables for editing date fields.

    Throws

    Error.unsupportedDateFormat if the date isn’t one of the three formats the web app supports or the format used by Contentful sys properties.

    Declaration

    Swift

    static func variableISO8601Strategy(_ decoder: Decoder) throws -> Date

    Parameters

    decoder

    The Decoder used to deserialize JSON from Contentful.

  • Returns a String in the ISO8601 format.

    Declaration

    Swift

    var iso8601String: String { get }
  • The ISO8601 string representation of the receiving Date object.

    Declaration

    Swift

    public var stringValue: String { get }