An RFC3339DateTimeSerializer serializer class for built_value, created to address the issue about Dart's DateTime.parse not working with RFC 3339.

Why is this package needed?

ISO 8601 has a character limit for time-secfrac part equal to 6. RFC 3339 does not have that limit. Thanks to this, datetimes introducing more than 6 characters in time-secfrac are invalid for DateTime.parse, because it works only with ISO 8601.

For example, Go's encoding/json serializes dates with 7 time-secfrac characters.


In your serializers.dart:

import 'rfc_3339_date_time_serializer/rfc_3339_date_time_serializer.dart';

@SerializersFor(const [/* (...) */])
final Serializers modelsSerializers = (_$modelsSerializers.toBuilder()
      ..add(RFC3339DateTimeSerializer())) // this is the line you need to add