Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1181

Using only UnixNano to convert time.Time to MongoDB Datetimes misses large amounts of possible datetimes

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON

      https://github.com/mongodb/mongo-go-driver/search?q=UnixNano&unscoped_q=UnixNano

      Using UnixNano results in underflow for large and small dates (dates sufficiently far from January 1st, 1970). The following calculation should be used instead:

      return t.Unix()*1000 + int64(t.Nanosecond()/1e6)
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.meredith@mongodb.com Patrick Meredith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: