[GODRIVER-983] extjson date parser doesn't work for dates after the year 2262 Created: 19/Apr/19  Updated: 28/Oct/23  Resolved: 29/Apr/19

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0.2

Type: Bug Priority: Major - P3
Reporter: Divjot Arora (Inactive) Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backported by GODRIVER-1008 Backport "extjson date parser doesn't... Closed
Related
related to GODRIVER-1688 primitive.NewDateTimeFromTime only al... Closed
is related to GODRIVER-1181 Using only UnixNano to convert time.T... Closed
Backwards Compatibility: Fully Compatible

 Description   

When parsing relaxed extended JSON with a date string, the code in https://github.com/mongodb/mongo-go-driver/blob/master/bson/bsonrw/extjson_wrappers.go#L206 uses the UnixNano function (https://golang.org/pkg/time/#Time.UnixNano) which can't represent dates after the year 2262. 

This can be changed to

t.Unix()*1e3 + t.Nanosecond()/1e6

instead.



 Comments   
Comment by Githook User [ 29/Apr/19 ]

Author:

{'name': 'Divjot Arora', 'username': 'divjotarora', 'email': 'divjot.arora@10gen.com'}

Message: Fix extended JSON parser for large dates.

GODRIVER-983

Change-Id: I4aa8435fcb39ec866d97a3dc7790a6307c3b92c2
Branch: release/1.0
https://github.com/mongodb/mongo-go-driver/commit/d16c4cb1141982effa064e2b020c2948ed9bd199

Comment by Githook User [ 29/Apr/19 ]

Author:

{'name': 'Divjot Arora', 'username': 'divjotarora', 'email': 'divjot.arora@10gen.com'}

Message: Fix extended JSON parser for large dates.

GODRIVER-983

Change-Id: I4aa8435fcb39ec866d97a3dc7790a6307c3b92c2
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/f1cbd2837fa56424cdcc463fc768356bcf481c29

Comment by Divjot Arora (Inactive) [ 25/Apr/19 ]

CR: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/451985

Generated at Thu Feb 08 08:35:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.