File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,20 @@ private let formatter: DateFormatter = {
34
34
return f
35
35
} ( )
36
36
37
+ fileprivate enum DateLocalePattern {
38
+ case current
39
+ case enUSPOSIX
40
+
41
+ var value : Locale {
42
+ switch self {
43
+ case . current:
44
+ return Locale . current
45
+ case . enUSPOSIX:
46
+ return Locale ( identifier: " en_US_POSIX " )
47
+ }
48
+ }
49
+ }
50
+
37
51
private extension Date {
38
52
39
53
init ? ( dateString: String , dateFormat: String = " yyyy-MM-dd'T'HH:mm:ssZ " ) {
@@ -42,8 +56,8 @@ private extension Date {
42
56
self = date
43
57
}
44
58
45
- func string( format: String = " yyyy-MM-dd'T'HH:mm:ssZ " ) -> String {
46
- formatter. locale = Locale . current
59
+ func string( format: String = " yyyy-MM-dd'T'HH:mm:ssZ " , locale : DateLocalePattern ) -> String {
60
+ formatter. locale = locale . value
47
61
formatter. dateFormat = format
48
62
return formatter. string ( from: self )
49
63
}
@@ -109,7 +123,7 @@ public struct StudyplusRecord {
109
123
var params : [ String : Any ] = [ : ]
110
124
111
125
params [ " duration " ] = NSNumber ( value: self . duration)
112
- params [ " recorded_at " ] = self . recordedAt. string ( format: " yyyy-MM-dd HH:mm:ss " )
126
+ params [ " recorded_at " ] = self . recordedAt. string ( format: " yyyy-MM-dd HH:mm:ss " , locale : . enUSPOSIX )
113
127
114
128
if let comment = self . comment {
115
129
params [ " comment " ] = comment
You can’t perform that action at this time.
0 commit comments