[Libreoffice-commits] online.git: loleaflet/src
Henry Castro
hcastro at collabora.com
Wed Mar 29 19:24:00 UTC 2017
loleaflet/src/layer/AnnotationManager.js | 3 ---
loleaflet/src/layer/marker/Annotation.js | 5 ++++-
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit ebf6bb389ec3cb0aedc93f3cf84ab0dd45cd3eee
Author: Henry Castro <hcastro at collabora.com>
Date: Wed Mar 29 15:26:05 2017 -0400
loleaflet: simplify date format of the annotation object
Change-Id: I4d7adfa93f03b8fd639fd701066ed83b41a1bd82
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 256dd070..8cf90e24 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -48,7 +48,6 @@ L.AnnotationManager = L.Class.extend({
comment = comments[index];
comment.anchorPos = L.LOUtil.stringToBounds(comment.anchorPos);
comment.anchorPix = this._map._docLayer._twipsToPixels(comment.anchorPos.min);
- comment.dateTime = new Date(comment.dateTime.replace(/,.*/, 'Z')).toDateString();
comment.trackchange = false;
this._items.push(L.annotation(this._map.options.maxBounds.getSouthEast(), comment).addTo(this._map));
}
@@ -272,7 +271,6 @@ L.AnnotationManager = L.Class.extend({
} else {
obj.comment.anchorPos = L.LOUtil.stringToBounds(obj.comment.anchorPos);
obj.comment.anchorPix = this._map._docLayer._twipsToPixels(obj.comment.anchorPos.min);
- obj.comment.dateTime = new Date(obj.comment.dateTime.replace(/,.*/, 'Z')).toDateString();
this.add(obj.comment);
this._map.focus();
}
@@ -298,7 +296,6 @@ L.AnnotationManager = L.Class.extend({
} else {
obj.comment.anchorPos = L.LOUtil.stringToBounds(obj.comment.anchorPos);
obj.comment.anchorPix = this._map._docLayer._twipsToPixels(obj.comment.anchorPos.min);
- obj.comment.dateTime = new Date(obj.comment.dateTime.replace(/,.*/, 'Z')).toDateString();
modifiedObj = obj.comment;
}
modified._data = modifiedObj;
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 28c099f0..72835031 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -231,9 +231,12 @@ L.Annotation = L.Layer.extend({
},
_updateContent: function () {
+ if (!(this._data.dateTime instanceof Date)) {
+ this._data.dateTime = new Date(this._data.dateTime.replace(/,.*/, 'Z'));
+ }
this._contentText.innerHTML = this._nodeModifyText.innerHTML = this._data.text;
this._contentAuthor.innerHTML = this._data.author;
- this._contentDate.innerHTML = this._data.dateTime;
+ this._contentDate.innerHTML = this._data.dateTime.toDateString();
if (this._data.trackchange) {
this._captionText.innerHTML = this._data.description;
}
More information about the Libreoffice-commits
mailing list