json_serializable.dart icon indicating copy to clipboard operation
json_serializable.dart copied to clipboard

Add microseconds to datetime serialization as a project wide option

Open cedvdb opened this issue 1 year ago • 0 comments

The current serialization uses toIso8601String, which results in different behavior from the web and other platforms since the web does not have micro seconds informations.

so on the web you might get this: 2022-07-09T07:45:59.759 while on other platforms you'll have: 2022-07-09T07:45:59.759316

Using microSecondsSinceEpoch does not change the fact that the web does not have microsecond information but at least the format is the same.

I'm not sure if that can ever be an issue but it's the best reason I could find to warrant a feature to not have not write JsonKey on a datetime. I think at least micro_timestamp, timestamp and iso8601 could be supported.

cedvdb avatar Jul 09 '22 05:07 cedvdb