Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1446

Extended json package does not decode canonical dates when relaxed is true

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: EJSON

      I'd expect the following code:

      EJSON.parse('{"grant_date":{"$date":{"$numberLong":"1452124800000"}}}', {"relaxed": true}) 

      To give me:

      { grant_date: 2016-01-07T00:00:00.000Z }
      

      But I get the current time:

      { grant_date: 2018-04-30T17:10:14.832Z }
      

      The Stitch JS SDK like to give users types back in a relaxed format after parse which normally works with the above for most types but it's not working for $date since a $numberLong becomes a "number" and the $date decoder cannot parse that.

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            eric.daniels@mongodb.com Eric Daniels
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: