Skip to content

Commit

Permalink
Workaround SwiftFormat bug. (#1606)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott authored Aug 29, 2023
1 parent d693dc1 commit 467b59d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sdk/core/AzureCore/Source/DataStructures/AzureDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public struct Rfc1123Date: AzureDate {
}

public init?(string: String?) {
guard let date = Self.formatter.date(from: string ?? "") else { return nil }
guard let date = Rfc1123Date.formatter.date(from: string ?? "") else { return nil }
self.value = date
}

Expand All @@ -165,7 +165,7 @@ public struct Rfc1123Date: AzureDate {
(decoder as? JSONDecoder)?.dateDecodingStrategy = .formatted(Self.formatter)
let container = try decoder.singleValueContainer()
let dateString = try container.decode(String.self)
if let decoded = Self.formatter.date(from: dateString) {
if let decoded = Rfc1123Date.formatter.date(from: dateString) {
self.value = decoded
} else {
let context = DecodingError.Context(codingPath: [], debugDescription: "Invalid date string: \(dateString).")
Expand Down Expand Up @@ -229,7 +229,7 @@ public struct SimpleDate: AzureDate {
(decoder as? JSONDecoder)?.dateDecodingStrategy = .formatted(Self.formatter)
let container = try decoder.singleValueContainer()
let dateString = try container.decode(String.self)
if let decoded = Self.formatter.date(from: dateString) {
if let decoded = SimpleDate.formatter.date(from: dateString) {
self.value = decoded
} else {
let context = DecodingError.Context(codingPath: [], debugDescription: "Invalid date string: \(dateString).")
Expand Down Expand Up @@ -342,7 +342,7 @@ public struct SimpleTime: Codable, Comparable, RequestStringConvertible {
}

public init?(string: String?) {
guard let date = Self.formatter.date(from: string ?? "") else { return nil }
guard let date = SimpleTime.formatter.date(from: string ?? "") else { return nil }
self.value = date
}

Expand All @@ -357,7 +357,7 @@ public struct SimpleTime: Codable, Comparable, RequestStringConvertible {
(decoder as? JSONDecoder)?.dateDecodingStrategy = .formatted(Self.formatter)
let container = try decoder.singleValueContainer()
let timeString = try container.decode(String.self)
if let decoded = Self.formatter.date(from: timeString) {
if let decoded = SimpleTime.formatter.date(from: timeString) {
self.value = decoded
} else {
let context = DecodingError.Context(codingPath: [], debugDescription: "Invalid time string: \(timeString).")
Expand Down

0 comments on commit 467b59d

Please sign in to comment.