Closed ogarcia closed 5 months ago
The value is expected to be a string, not an integer. Formatting and parsing is always done with strings.
The value is expected to be a string, not an integer. Formatting and parsing is always done with strings.
I understand then that it is impossible to deserialize a timestamp with milliseconds coming in an integer.
And you have not thought about including this possibility? It is not so rare nowadays to work with timestamps with milliseconds and the most normal thing is that they come as integers and not as strings.
In fact, I think it would be very interesting if it was even a module, something like time::serde::timestamp_millis
. What do you think?
I have previously rejected that (on multiple occasions) because I assumed it could be replicated using the time::serde::format_description!
macro. Given that it cannot and that time::serde::timestamp
is serialized/deserialized as an integer, I would be fine with a PR adding it for milliseconds, microseconds, and nanoseconds.
My code is simple:
When I go to use the structure to deserialize from a JSON I get the following error.
The truth is that I have run out of ideas, I understand that it should work as it is, but it does not. In the
cargo.toml
I have the following: