[Libreoffice-commits] online.git: loleaflet/src

Jan Holesovsky kendy at collabora.com
Wed Apr 26 17:20:49 UTC 2017


 loleaflet/src/layer/marker/Annotation.js |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ad5a5e086d2979817a8558bc57e071b03a438aa1
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Apr 26 19:15:22 2017 +0200

    comments: If we fail to parse the date, show it verbatim.
    
    Change-Id: Iefee7057b3c192c33d49891dd7ef5835d39d1cb8

diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index b5d8fbae..34b00ea1 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -280,15 +280,15 @@ L.Annotation = L.Layer.extend({
 	},
 
 	_updateContent: function () {
-		if (!(this._data.dateTime instanceof Date)) {
-			this._data.dateTime = new Date(this._data.dateTime.replace(/,.*/, 'Z'));
-		}
 		var linkedText = Autolinker.link(this._data.text);
 		this._contentText.innerHTML = linkedText;
 		// Original unlinked text
 		this._contentText.origText = this._nodeModifyText.innerHTML = this._data.text;
 		this._contentAuthor.innerHTML = this._data.author;
-		this._contentDate.innerHTML = this._data.dateTime.toDateString();
+
+		var d = new Date(this._data.dateTime.replace(/,.*/, 'Z'));
+		this._contentDate.innerHTML = isNaN(d.getTime())? this._data.dateTime: d.toDateString();
+
 		if (this._data.trackchange) {
 			this._captionText.innerHTML = this._data.description;
 		}


More information about the Libreoffice-commits mailing list