socket.io-client-swift
socket.io-client-swift copied to clipboard
Date format was changed to timestamp?
From java backend, certain field is Date but I got timestamp in iOS, which affects negatively my work of checking signature.
e.g.
server:
..."createdAt":"2021-04-26T18:43:30.901Z"...
socket.on("message") { data, ack in...
..."createdAt":1619433810901...
when I try to parse the string with JSONDecoder, as well as config it as such
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
jsonDecoder.dateDecodingStrategy = .formatted(dateFormatter)
I got error blabla like:
"expected String but found number"...
For now, I have to manually convert it back to date and do parse work, this looks like stupid step but inevitable. Is there any way to avoid this or just accept it. Thanks
I have exactly the same issue. Did you find a solution ?