DateConverter
public struct DateConverter : Sendable
Converts dates to and from API-friendly strings
-
Initializes the formatter with date format information from a budget
Declaration
Swift
public init(dateFormat: DateFormat)Parameters
dateFormatDate format information obtained from a budget
-
Converts a date sent by the API into a displayable date according to the budget format
Declaration
Swift
public func budgetFormatDateString(from apiDateString: String) -> String?Parameters
fromA date string in the style (iso8601) sent by API responses (e.g. 2015/12/25)
Return Value
A displayable date string if conversion is successful,
nilif conversion fails. -
Converts a date sent by the API into a
DateobjectDeclaration
Swift
public static func date(from apiDateString: String) -> Date?Parameters
fromA date string in the style (iso8601) sent by API responses (e.g. 2015/12/25)
Return Value
A
Dateobject, ornilif conversion fails. -
Converts a date into a API-friendly iso8601 date string
Declaration
Swift
public static func iso8601DateString(from date: Date) -> StringParameters
dateDate to be converted
Return Value
API-friendly iso8601 date string
View on GitHub