realm-studio icon indicating copy to clipboard operation
realm-studio copied to clipboard

Dates outside JS range breaks Studio

Open cmelchior opened this issue 6 years ago • 4 comments

If your data model has a value that is apparently outside the dates supported by RealmJS, Studio fails to show anything from the selected table, but instead just shows "Invalid Time Value".

IMO, this should be restricted to just the single field and maybe rephrase to something like "Cannot show this value"

image

cmelchior avatar Feb 14 '19 17:02 cmelchior

Or perhaps Studio/Realm js should represent dates as moment objects as those are likely capable of representing broader range.

nirinchev avatar Feb 14 '19 19:02 nirinchev

Can you upload a Realm containing an invalid date? Or perhaps provide an example on how to create such a value?

kraenhansen avatar Feb 15 '19 10:02 kraenhansen

It happened after creating some random date values using random.nextLong() in Java... I suspect that using e.g. Long.MAX_VALUE will trigger it, but I'll try to create an example Realm.

cmelchior avatar Feb 15 '19 10:02 cmelchior

datetest.realm.zip

This Realm contains a class DateTest with 4 objects with the values:

Date(Long.MAX_VALUE)
Date(Long.MIN_VALUE)
Date(0)
Date.now()

It exhibits the same behaviour as above.

cmelchior avatar Feb 15 '19 10:02 cmelchior