small cleanup around "Last saved:" label

* remove old, unused code
* String.locale respects the language requested by the integration

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I799856bdd721427e7d58be0a8fcddba866b726ea
This commit is contained in:
Andras Timar 2021-11-14 18:15:19 +01:00
parent c70947d4d0
commit 953419bf01

View file

@ -414,12 +414,10 @@ L.Map = L.Evented.extend({
if (this.lastModIndicator !== null && this.lastModIndicator !== undefined) {
var dateTime = new Date(this._lastmodtime.replace(/,.*/, 'Z'));
var dateValue = dateTime.toLocaleDateString(String.locale,
{ year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
var dateValue;
var elapsed = Date.now() - dateTime;
var lang = window.navigator.userLanguage || window.navigator.language;
var rtf1 = new Intl.RelativeTimeFormat(lang, { style: 'narrow' });
var rtf1 = new Intl.RelativeTimeFormat(String.locale, { style: 'narrow' });
if (elapsed < 60000) {
dateValue = _('Last saved:') + ' ' + rtf1.format(-Math.round(elapsed / 1000), 'second');
timeout = 6000;