Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8164

ISODate doesn't handle years less than 100 properly

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 3.5.13
    • None
    • Shell
    • None
    • Fully Compatible
    • ALL
    • Hide

      > db.date.insert({ "_id" : ISODate("0099-09-07T00:00:00Z") })
      > db.date.findOne()
      { "_id" : ISODate("1999-09-07T00:00:00Z") }

      expected:

      > db.date.insert({ "_id" : ISODate("0099-09-07T00:00:00Z") })
      > db.date.findOne()
      { "_id" : ISODate("0099-09-07T00:00:00Z") }

      Show
      > db.date.insert({ "_id" : ISODate("0099-09-07T00:00:00Z") }) > db.date.findOne() { "_id" : ISODate("1999-09-07T00:00:00Z") } expected: > db.date.insert({ "_id" : ISODate("0099-09-07T00:00:00Z") }) > db.date.findOne() { "_id" : ISODate("0099-09-07T00:00:00Z") }
    • Query 2017-08-21, Query 2017-09-11

    Description

      ISODate is parsing dates where the year is less than 100 improperly. It's treating them as offsets from 1900.

      Attachments

        Activity

          People

            derick Derick Rethans
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: