Adding test of timestamp's ms precision. (#1561)
* Adding test of timestamp's ms precision.
This commit is contained in:
parent
34ea280492
commit
839d8563a1
|
@ -453,5 +453,25 @@ module.exports = {
|
||||||
TestCase.assertEqual(realm.objects('Date')[2].currentDate.getTime(), 1000000000000);
|
TestCase.assertEqual(realm.objects('Date')[2].currentDate.getTime(), 1000000000000);
|
||||||
TestCase.assertEqual(realm.objects('Date')[3].currentDate.getTime(), -1000000000000);
|
TestCase.assertEqual(realm.objects('Date')[3].currentDate.getTime(), -1000000000000);
|
||||||
TestCase.assertEqual(realm.objects('Date')[4].currentDate.toString(), stringifiedDate.toString());
|
TestCase.assertEqual(realm.objects('Date')[4].currentDate.toString(), stringifiedDate.toString());
|
||||||
|
},
|
||||||
|
|
||||||
|
testDateResolution: function() {
|
||||||
|
const dateObjectSchema = {
|
||||||
|
name: 'DateObject',
|
||||||
|
properties: {
|
||||||
|
dateCol: 'date'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var realm = new Realm({schema: [dateObjectSchema]})
|
||||||
|
realm.write(function() {
|
||||||
|
realm.create('DateObject', { dateCol: new Date('2017-12-07T20:16:03.837Z') })
|
||||||
|
})
|
||||||
|
|
||||||
|
var objects = realm.objects('DateObject')
|
||||||
|
TestCase.assertEqual(new Date('2017-12-07T20:16:03.837Z').getTime(), objects[0].dateCol.getTime())
|
||||||
|
TestCase.assertTrue(new Date('2017-12-07T20:16:03.837Z').toISOString() === objects[0].dateCol.toISOString())
|
||||||
|
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue