Date

public extension Date
  • Get yesterday’s day start date. Uses user’s time zone.

    Declaration

    Swift

    static var yesterday: Date { get }
  • Get today’s day start date. Uses user’s time zone.

    Declaration

    Swift

    static var today: Date { get }
  • Get tomorrow’s day start date. Uses user’s time zone.

    Declaration

    Swift

    static var tomorrow: Date { get }
  • Get day start. Uses user’s time zone.

    Declaration

    Swift

    var startOfDay: Date { get }
  • Get date’s components. Uses user’s time zone.

    • components: year, month, day, hour, minute, second, timeZone, calendar.

    Declaration

    Swift

    var components: DateComponents { get }
  • Returns beginning of the previous day.

    Declaration

    Swift

    var previousDay: Date { get }
  • Returns beginning of the next work day excluding today. It just exludes weekends. Does not exclude holidays.

    Declaration

    Swift

    var previousWorkDay: Date { get }
  • Returns beginning of the next day.

    Declaration

    Swift

    var nextDay: Date { get }
  • Returns beginning of the next work day excluding today. It just exludes weekends. Does not exclude holidays.

    Declaration

    Swift

    var nextWorkDay: Date { get }
  • Checks if date is in yesterday’s range. Uses user’s time zone.

    Declaration

    Swift

    var isYesterday: Bool { get }
  • Checks if date is in today’s range. Uses user’s time zone.

    Declaration

    Swift

    var isToday: Bool { get }
  • Checks if date is in tomorrow’s range. Uses user’s time zone.

    Declaration

    Swift

    var isTomorrow: Bool { get }
  • Checks if date is in weekend’s range. Uses user’s time zone.

    Declaration

    Swift

    var isWeekend: Bool { get }
  • Converts date to GMT time zone day start.

    Declaration

    Swift

    var gmtDayBeginningDate: Date { get }
  • Checks if dates are on same day. Uses user’s time zone.

    Declaration

    Swift

    func isSameDay(withDate date: Date) -> Bool
  • Undocumented

    Declaration

    Swift

    func adding(dateComponents: DateComponents) -> Date

String Representation

  • Return self as a time string with a HH:mm:ss.SSS format. E.g. 10:20:45.123. Useful for logs.

    Declaration

    Swift

    var asLogsTimeString: String { get }
  • Return self as a date and time string with a dd.MM.yyyy HH:mm:ss.SSS format. E.g. 08.10.2019 16:16:40.723. Useful for logs.

    Declaration

    Swift

    var asLogsDateAndTimeString: String { get }
  • Simplification of getting string from date

    Declaration

    Swift

    func getString(dateStyle: DateFormatter.Style = .short, timeStyle: DateFormatter.Style = .short, doesRelativeDateFormatting: Bool = true) -> String