Skip to content

Commit 55dfab3

Browse files
author
Mccc
committed
优化代码
1 parent 828b4e6 commit 55dfab3

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

SmartCodable/Classes/PropertyWrapper/SmartDate.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,16 @@ struct DateParser {
9090
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
9191
]
9292

93+
// https://developer.apple.com/library/archive/qa/qa1480/_index.html
9394
private static let locale = Locale(identifier: "en_US_POSIX")
9495

9596
static func parse(_ raw: Any) -> (Date, SmartDate.DateStrategy)? {
96-
// 优先尝试时间戳解析
9797
if let result = parseTimestamp(from: raw) {
9898
return result
9999
}
100100

101-
// 其次处理 String
102101
if let string = raw as? String {
103-
// 尝试匹配 knownFormats
102+
// try knownFormats
104103
let formatter = DateFormatter()
105104
formatter.locale = locale
106105
for format in knownFormats {

0 commit comments

Comments
 (0)