Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-250

Date millisecond thousandths are not always persisted correctly

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      Persist the date '2017-12-12 15:00:37.447 UTC'

      Actual Results

      When reading the date out of Realm, I find the value '2017-12-12T15:00:37.446Z'
      The storage is off by one in the thousandths field. This does not happen for all values, only select ones like this example.

      I believe this is due to the floating point imprecision of storing milliseconds since epoch in a double type. Natively, Realm can store nanosecond precision so it must be happening in the binding conversion layer. Looks like here.

      Version of Realm and Tooling

      • Realm JS SDK Version: 2.13.0
      • Node or React Native: node

            Assignee:
            Unassigned Unassigned
            Reporter:
            james.stone@mongodb.com James Stone
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: