Skip to content

Commit cd66a28

Browse files
authored
Merge pull request #275 from loopandlearn/date-parsing-issue
Fix date parsing issue for 12/24-hour formats
2 parents 02c0b16 + 52504ad commit cd66a28

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

LoopFollow/helpers/NightscoutUtils.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,12 @@ class NightscoutUtils {
192192
let dateFormatterWithMilliseconds = DateFormatter()
193193
dateFormatterWithMilliseconds.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
194194
dateFormatterWithMilliseconds.timeZone = TimeZone(abbreviation: "UTC")
195+
dateFormatterWithMilliseconds.locale = Locale(identifier: "en_US_POSIX")
195196

196197
let dateFormatterWithoutMilliseconds = DateFormatter()
197198
dateFormatterWithoutMilliseconds.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
198199
dateFormatterWithoutMilliseconds.timeZone = TimeZone(abbreviation: "UTC")
200+
dateFormatterWithoutMilliseconds.locale = Locale(identifier: "en_US_POSIX")
199201

200202
if let date = dateFormatterWithMilliseconds.date(from: dateString) {
201203
return date
@@ -205,4 +207,5 @@ class NightscoutUtils {
205207

206208
return nil
207209
}
210+
208211
}

0 commit comments

Comments
 (0)