** Description changed:
When putting and getting a QML date in the u1db database, the resulting
strings are stored differently, even if you don't do any type
conversion.
The result is that the resulting date is shifted by the current
timezone, rendering an incorrect date.
Small example:
- date is "Sun Jul 5 17:20:46 2015 GMT+0200"
+ qml: date object to save: "Sat Jan 3 08:26:03 2015 GMT+0100"
- This value is jsonified in var current = {"title":"First
- element","date":"2015-07-05T15:20:46.000Z"}
+ This value is jsonified in var current = {"title":"First
element","date":"2015-01-03T07:26:03.000Z"}
+ (so, it offsetted in UTC)
console.log("Before save: " + JSON.stringify(tosave));
db.putDoc(tosave, current.billId);
var after = db.getDoc(current.billId.toString())
console.log("After save: " + JSON.stringify(afterSave));
log is:
- qml: Before save: {"title":"First element","date":"2015-07-05T15:20:46.000Z"}
- qml: After save: {"date":"2015-07-05T17:20:46","title":"First element"}
+ qml: Before save: {"title":"First element","date":"2015-01-03T07:26:03.000Z"}
+ qml: After save: {"date":"2015-01-03T08:26:03","title":"First element"}
+ -> getDoc() reapplied the timezone offset (and then, assigning that to a Date
variable will reapply again the timezone offest, thinking the string is in UTC).
-> Note that the date element has been altered and isn't returned in the
- same format The date should be returned unalterned.
+ same format The date should be returned unalterned.h
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1482504
Title:
Putting and then getting dates in a document are altered by u1db
To manage notifications about this bug go to:
https://bugs.launchpad.net/u1db-qt/+bug/1482504/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs