google / google/json_serializable.dart

Add microseconds to datetime serialization as a project wide option

Open
#1,173 0 comments 0 reactions 0 assignees View on GitHub
Type: enhancement
Dominant language
Dart
Stars
1.6k
Forks
461
Avg merge
45m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.