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

ISODate doesn't handle years less than 100 properly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5.13
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
      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

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

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

              Created:
              Updated:
              Resolved: