Graphiti
Graphiti copied to clipboard
Coders with Date as Double in schema
I use secondsSince1970 to decode and encode date in Coders. In Fluent the createdAt field is of type Date, so that the frontend doesn't have problems I convert it to Double in the schema, and it seems that the standard decoder/encoder deferredToDate starts to be used, because in the response to the request comes 721570737.092619 instead of 1699877937.092619. I also tried converting to String, same result.
Config coders.decoder.dateDecodingStrategy:
coders.decoder.dateDecodingStrategy = .secondsSince1970
coders.encoder.dateEncodingStrategy = .secondsSince1970
Field in schema:
Field("createdAt", at: \.createdAt, as: Double?.self)
Field("updatedAt", at: \.updatedAt, as: Double?.self)