Skip to content

Make ISO8601DateFormatter.Options static properties immutable #4706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Sources/Foundation/ISO8601DateFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ extension ISO8601DateFormatter {

public init(rawValue: UInt) { self.rawValue = rawValue }

public static var withYear = ISO8601DateFormatter.Options(rawValue: 1 << 0)
public static let withYear = ISO8601DateFormatter.Options(rawValue: 1 << 0)

public static var withMonth = ISO8601DateFormatter.Options(rawValue: 1 << 1)
public static let withMonth = ISO8601DateFormatter.Options(rawValue: 1 << 1)

public static var withWeekOfYear = ISO8601DateFormatter.Options(rawValue: 1 << 2)
public static let withWeekOfYear = ISO8601DateFormatter.Options(rawValue: 1 << 2)

public static var withDay = ISO8601DateFormatter.Options(rawValue: 1 << 4)
public static let withDay = ISO8601DateFormatter.Options(rawValue: 1 << 4)

public static var withTime = ISO8601DateFormatter.Options(rawValue: 1 << 5)
public static let withTime = ISO8601DateFormatter.Options(rawValue: 1 << 5)

public static var withTimeZone = ISO8601DateFormatter.Options(rawValue: 1 << 6)
public static let withTimeZone = ISO8601DateFormatter.Options(rawValue: 1 << 6)

public static var withSpaceBetweenDateAndTime = ISO8601DateFormatter.Options(rawValue: 1 << 7)
public static let withSpaceBetweenDateAndTime = ISO8601DateFormatter.Options(rawValue: 1 << 7)

public static var withDashSeparatorInDate = ISO8601DateFormatter.Options(rawValue: 1 << 8)
public static let withDashSeparatorInDate = ISO8601DateFormatter.Options(rawValue: 1 << 8)

public static var withColonSeparatorInTime = ISO8601DateFormatter.Options(rawValue: 1 << 9)
public static let withColonSeparatorInTime = ISO8601DateFormatter.Options(rawValue: 1 << 9)

public static var withColonSeparatorInTimeZone = ISO8601DateFormatter.Options(rawValue: 1 << 10)
public static let withColonSeparatorInTimeZone = ISO8601DateFormatter.Options(rawValue: 1 << 10)

public static var withFractionalSeconds = ISO8601DateFormatter.Options(rawValue: 1 << 11)
public static let withFractionalSeconds = ISO8601DateFormatter.Options(rawValue: 1 << 11)

public static var withFullDate = ISO8601DateFormatter.Options(rawValue: withYear.rawValue + withMonth.rawValue + withDay.rawValue + withDashSeparatorInDate.rawValue)
public static let withFullDate = ISO8601DateFormatter.Options(rawValue: withYear.rawValue + withMonth.rawValue + withDay.rawValue + withDashSeparatorInDate.rawValue)

public static var withFullTime = ISO8601DateFormatter.Options(rawValue: withTime.rawValue + withTimeZone.rawValue + withColonSeparatorInTime.rawValue + withColonSeparatorInTimeZone.rawValue)
public static let withFullTime = ISO8601DateFormatter.Options(rawValue: withTime.rawValue + withTimeZone.rawValue + withColonSeparatorInTime.rawValue + withColonSeparatorInTimeZone.rawValue)

public static var withInternetDateTime = ISO8601DateFormatter.Options(rawValue: withFullDate.rawValue + withFullTime.rawValue)
public static let withInternetDateTime = ISO8601DateFormatter.Options(rawValue: withFullDate.rawValue + withFullTime.rawValue)
}

}
Expand Down