1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Fix format of note timestamps (#2672)

* Correct format of timestamps during unserialization.

* Add tests.
This commit is contained in:
mic704b
2020-03-15 23:07:01 +11:00
committed by GitHub
parent 7fb061ea76
commit a17e01793e
2 changed files with 16 additions and 4 deletions

View File

@ -254,13 +254,13 @@ class BaseItem extends BaseModel {
const ItemClass = this.itemClass(type);
if (['created_time', 'updated_time', 'user_created_time', 'user_updated_time'].indexOf(propName) >= 0) {
if (!propValue) return 0;
propValue = moment(propValue, 'YYYY-MM-DDTHH:mm:ss.SSSZ').format('x');
} else if (['title_diff', 'body_diff'].indexOf(propName) >= 0) {
if (['title_diff', 'body_diff'].indexOf(propName) >= 0) {
if (!propValue) return '';
propValue = JSON.parse(propValue);
} else {
if (['created_time', 'updated_time', 'user_created_time', 'user_updated_time'].indexOf(propName) >= 0) {
propValue = (!propValue) ? '0' : moment(propValue, 'YYYY-MM-DDTHH:mm:ss.SSSZ').format('x');
}
propValue = Database.formatValue(ItemClass.fieldType(propName), propValue);
}