From 6d0b8e7bb1dee17ce7c6d618b96fbb0de53fedb1 Mon Sep 17 00:00:00 2001 From: codewithvk Date: Mon, 1 Jan 2024 19:28:14 +0530 Subject: [PATCH] Make 'File > Repair' date and time human-readable Signed-off-by: codewithvk Change-Id: Ib8b745fd10aca2eea2e829ad42cf1d91f7ff2129 --- browser/src/control/Control.DocumentRepair.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/browser/src/control/Control.DocumentRepair.js b/browser/src/control/Control.DocumentRepair.js index 957650afa..0e4e6769a 100644 --- a/browser/src/control/Control.DocumentRepair.js +++ b/browser/src/control/Control.DocumentRepair.js @@ -114,7 +114,7 @@ L.Control.DocumentRepair = L.Control.extend({ if (parseInt(actions[iterator].viewId) === this._map._docLayer._viewId) { userName = _('You'); } - this.createAction(type, actions[iterator].index, actions[iterator].comment, userName, actions[iterator].dateTime); + this.createAction(type, actions[iterator].index, actions[iterator].comment, userName, this.transformTimestamp(actions[iterator].dateTime)); } }, @@ -197,6 +197,14 @@ L.Control.DocumentRepair = L.Control.extend({ value: index + 1 }; this._map.sendUnoCommand('.uno:' + action, command, true); + }, + + // Transform timestamp from ISO8601 to human readable format with Local time + transformTimestamp: function (timestamp) { + var d = new Date(timestamp.split(',')[0] + 'Z'); + var dateOptions = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: true }; + var formattedDateTime = d.toLocaleString(String.locale, dateOptions); + return formattedDateTime; } });