Skip to content

Give to_rfc3339 a param: number of fractional second digits #171

@sanmai-NL

Description

@sanmai-NL

https://docs.rs/chrono/0.4.0/chrono/struct.DateTime.html#method.to_rfc3339 has no parameters, but with some applications too long a string of digits isn't expected (e.g., on the web), however, to_rfc3339 currently emits such long strings (e.g. 959686092).

https://www.ietf.org/rfc/rfc3339.txt seems to prescribe one digit only for the fractional seconds, so perhaps the current implementation is in error? If for practical reasons the number of fractional second digits should be tunable irrespective of the official grammar, then I propose that the range be between 0 (in which case the decimal separator isn't emitted) and, say, 16 (to be determined).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions