mongodb / bson-rust

Encoding and decoding support for BSON in Rust
MIT License
389 stars 130 forks source link

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

Open dennisorlando opened 1 month ago

dennisorlando commented 1 month ago

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?

abr-egn commented 1 month ago

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.