bson-rust icon indicating copy to clipboard operation
bson-rust copied to clipboard

Time's "large-dates" feature should be optional

Open dennisorlando opened this issue 1 year ago • 2 comments

Hi, when parsing a time::PrimitiveDateTime, the program's execution changes when the "large-dates" feature is enabled, due to some ambiguities when parsing a datetime. bson has such feature enabled by default, thus potentially modifying how a program works. In our case, we got some panics which we didn't know where they came from.

Would it be possible to remove the "large-dates" feature from time and perhaps make it optional?

dennisorlando avatar Jun 03 '24 09:06 dennisorlando

We enable the large-dates feature because part of the bson test corpus includes dates in the Y10k+ range; I do think you make a good case for making that optional when it's guaranteed that inputs won't have years that large.

Unfortunately, removing the feature at this point would be a breaking change, so I've filed https://jira.mongodb.org/browse/RUST-1960 for it to be included in version 3.0 of the bson crate.

abr-egn avatar Jun 04 '24 14:06 abr-egn

Updates: this is also getting addressed at https://github.com/time-rs/time/pull/709, which might provide you a solution which is not breaking

dennisorlando avatar Sep 27 '24 11:09 dennisorlando

A new feature flag was added in #546 and will be released in 3.0, going to close this.

isabelatkinson avatar Jun 03 '25 18:06 isabelatkinson