[SERVER-8164] ISODate doesn't handle years less than 100 properly Created: 14/Jan/13 Updated: 06/Dec/17 Resolved: 22/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.13 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Jeffrey Yemin | Assignee: | Derick Rethans |
| Resolution: | Done | Votes: | 4 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: |
expected:
|
||||||||
| Sprint: | Query 2017-08-21, Query 2017-09-11 | ||||||||
| Participants: | |||||||||
| Description |
|
ISODate is parsing dates where the year is less than 100 improperly. It's treating them as offsets from 1900. |
| Comments |
| Comment by Githook User [ 22/Aug/17 ] | |||||||||
|
Author: {'username': 'derickr', 'email': 'github@derickrethans.nl', 'name': 'Derick Rethans'}Message: | |||||||||
| Comment by Derick Rethans [ 20/Aug/17 ] | |||||||||
|
adrianhesketh@hushmail.com – thanks, but we have patch already in code review (note the status of this report), that solves this a little more elegantly. You can see the current draft patch at https://github.com/mongodb/mongo/compare/master...derickr:SERVER-8164-isodate-shell-parsing | |||||||||
| Comment by Adrian Hesketh [ 20/Aug/17 ] | |||||||||
|
I've submitted a pull request to fix this at https://github.com/mongodb/mongo/pull/1170 | |||||||||
| Comment by Stephane [ 19/Sep/13 ] | |||||||||
|
yes it's a important bug another exemple that show the misconception problem: > db.date.insert( { "_id" : new Date("0099-09-07T00:00:00Z") }) here ISODate("0099-09-07T00:00:00Z") mean 0099-09-07T00:00:00Z ) so ISODate is buggy and must be corrected and work same way as new Date | |||||||||
| Comment by Derick Rethans [ 24/Jul/13 ] | |||||||||
|
I've done some research for this, as it popped up in http://stackoverflow.com/questions/17833796/why-mongodb-shell-new-isodate0001-01-01-returns-date-1901-01-01. My answer there was:
|