DateTimes between the year 10,000 and 99,999 cannot be deserialized

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • bson-2.0.0-beta.3
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Due to a typo in the datetime deserialization logic, datetimes between the year 10,000 and 99,999 cannot be deserialized from Document. This is because, internally, the relaxed extended JSON format of the date is used for those years when it's supposed to stop at 9,999 (with canonical being used for the rest of the range).

      repro:

          let d = bson::DateTime::from_millis(253402300800000);
          let doc = doc! { "d": d };
      
          #[derive(Deserialize, Debug)]
          struct D {
              d: DateTime
          }
      
          println!("{:?}", bson::from_document::<D>(doc));
      

            Assignee:
            Patrick Freed
            Reporter:
            Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: