-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Expected Behavior
Correct date value is parsed
Actual Behavior
The left most number is lost, causing incorrect Date value
Steps to Reproduce the Problem
async add(json: {}) {
const db = await Firestore.initialise({})
db.get().collection("path").add(json)
}
add({
date: new Date(0)
})
running the above code will generate an exception
Error processing collection add in thread
java.lang.NumberFormatException: For input string: ""
at java.lang.Long.parseLong(Long.java:606)
at java.lang.Long.parseLong(Long.java:636)
at uk.co.reallysmall.cordova.plugin.firestore.JSONDateWrapper.unwrapDate(JSONDateWrapper.java:34)
at uk.co.reallysmall.cordova.plugin.firestore.JSONHelper.fromJSON(JSONHelper.java:83)
at uk.co.reallysmall.cordova.plugin.firestore.JSONHelper.toSettableMapInternal(JSONHelper.java:119)
at uk.co.reallysmall.cordova.plugin.firestore.JSONHelper.toSettableJSONInternal(JSONHelper.java:113)
at uk.co.reallysmall.cordova.plugin.firestore.JSONHelper.fromJSON(JSONHelper.java:98)
at uk.co.reallysmall.cordova.plugin.firestore.CollectionAddHandler.handle(CollectionAddHandler.java:35)
at uk.co.reallysmall.cordova.plugin.firestore.FirestorePlugin.execute(FirestorePlugin.java:73)
...
...
The reason is because the value is encoded as __DATE:0
JSONDateWrapper.unwrapDate() will strip 8 characters (prefixLength + 1), which return empty string.
The correct behaviour should be to strip 7 chars.
Specifications
- Plugin version: master branch
- Framework:
- Framework version:
- Operating system: Android
Metadata
Metadata
Assignees
Labels
No labels