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

All: Fix format of geolocation data (#2673)

* Maintain geolocation data format through serialization.

* Add test.
This commit is contained in:
mic704b
2020-05-01 01:56:47 +10:00
committed by GitHub
parent bf47237d8f
commit 125fa8647a
2 changed files with 38 additions and 0 deletions

View File

@ -257,6 +257,9 @@ class BaseItem extends BaseModel {
if (['title_diff', 'body_diff'].indexOf(propName) >= 0) {
if (!propValue) return '';
propValue = JSON.parse(propValue);
} else if (['longitude', 'latitude', 'altitude'].indexOf(propName) >= 0) {
const places = (propName === 'altitude') ? 4 : 8;
propValue = Number(propValue).toFixed(places);
} 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');