Skip to content

Commit 439bc5e

Browse files
authored
Fix DateTime parsing (#1062)
1 parent f658f94 commit 439bc5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/amplify_storage_s3/ios/Classes/AmplifyStorageOperations.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class AmplifyStorageOperations {
9898
switch event{
9999
case .success(let result):
100100
var listResultDictionary = [String:Any]();
101-
var storageItemList = [[String:Any]]();
101+
var storageItemList = [[String:Any?]]();
102102
for item in result.items {
103103
let storageItemDictionary = getStorageItemDictionary(item: item)
104104
storageItemList.append(storageItemDictionary)
@@ -140,11 +140,15 @@ public class AmplifyStorageOperations {
140140
}
141141
}
142142

143-
private static func getStorageItemDictionary(item: StorageListResult.Item) -> Dictionary<String ,Any>{
144-
let itemAsDictionary: [String : Any] = [
143+
private static func getStorageItemDictionary(item: StorageListResult.Item) -> Dictionary<String ,Any?>{
144+
var lastModifiedStr: String? = nil
145+
if let lastModified = item.lastModified {
146+
lastModifiedStr = Temporal.DateTime(lastModified).iso8601String
147+
}
148+
let itemAsDictionary: [String : Any?] = [
145149
"key": item.key,
146150
"eTag": item.eTag as Any,
147-
"lastModified": item.lastModified?.description as Any,
151+
"lastModified": lastModifiedStr,
148152
"size": item.size as Any
149153
]
150154
return itemAsDictionary

0 commit comments

Comments
 (0)