TimeZoneChangeSet

struct TimeZoneChangeSet : Codable
  • Declaration

    Swift

    var changePoints: [TimeZoneChange]
  • Required by Settings, but not useful with this initializer. Hopefully this becomes more fixable when Settings becomes an Actor.

    Declaration

    Swift

    init()
  • init(_:) Asynchronous

    Loads all the TimeZoneChange entries in the db into an array and stores them in this object.

    Declaration

    Swift

    init(_ db: Database) async throws
  • Returns the TimeZone the ship will be in at the given Date, or the current time if no Date specified. If you’re using this with a ‘floating’ date (e.g. “2:00 PM in whatever timezone the boat is in that day”) be sure to call portTimeToDisplayTime() first, and call this fn with the returned Date.

    Declaration

    Swift

    func tzAtTime(_ time: Date? = nil) -> TimeZone
  • Returns the 3 letter abbreviation for the time zone the ship will be in at the given Date, or the current time if no Date specified. If you’re using this with a ‘floating’ date (e.g. “2:00 PM in whatever timezone the boat is in that day”) be sure to call portTimeToDisplayTime() first, and call this fn with the returned Date. Also, do not use these abbreviations to later make TimeZone objects (with TimeZone(abbreviation:)). Use tzAtTime() instead.

    Declaration

    Swift

    func abbrevAtTime(_ time: Date? = nil) -> String
  • Declaration

    Swift

    func portTimeToDisplayTime(_ time: Date? = nil) -> Date
  • Declaration

    Swift

    func displayTimeToPortTime(_ time: Date? = nil) -> Date