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

Proposal: Always convert DateTime to UTC during serialization

Open Rexios80 opened this issue 1 year ago • 0 comments

Since dates should pretty much always be stored in UTC would it be reasonable to automatically convert DateTime objects to UTC during serialization? Could this at least be an option in the generator? I know I could write my own DateTime converter but then I have to remember to use it every time I create a new DateTime field.

I see https://github.com/google/json_serializable.dart/pull/811, but that was abandoned. I think making this a generator setting, maybe off by default to prevent issues with existing codebases, would be ideal.

Rexios80 avatar Nov 14 '23 17:11 Rexios80