소스 검색

Fix date parsing issue for 12/24-hour formats

Jonas Björkert 2 년 전
부모
커밋
52504ad055
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      LoopFollow/helpers/NightscoutUtils.swift

+ 3 - 0
LoopFollow/helpers/NightscoutUtils.swift

@@ -192,10 +192,12 @@ class NightscoutUtils {
         let dateFormatterWithMilliseconds = DateFormatter()
         dateFormatterWithMilliseconds.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
         dateFormatterWithMilliseconds.timeZone = TimeZone(abbreviation: "UTC")
+        dateFormatterWithMilliseconds.locale = Locale(identifier: "en_US_POSIX")
         
         let dateFormatterWithoutMilliseconds = DateFormatter()
         dateFormatterWithoutMilliseconds.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
         dateFormatterWithoutMilliseconds.timeZone = TimeZone(abbreviation: "UTC")
+        dateFormatterWithoutMilliseconds.locale = Locale(identifier: "en_US_POSIX")
         
         if let date = dateFormatterWithMilliseconds.date(from: dateString) {
             return date
@@ -205,4 +207,5 @@ class NightscoutUtils {
         
         return nil
     }
+
 }