mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 16:19:48 +02:00
Improve int'l date/time strings on imagery and history tools
(closes #4594)
This commit is contained in:
@@ -73,9 +73,15 @@ function maxPageAtZoom(z) {
|
||||
|
||||
function localeTimestamp(s) {
|
||||
if (!s) return null;
|
||||
var detected = utilDetect();
|
||||
var options = {
|
||||
day: 'numeric', month: 'short', year: 'numeric',
|
||||
hour: 'numeric', minute: 'numeric', second: 'numeric',
|
||||
timeZone: 'UTC'
|
||||
};
|
||||
var d = new Date(s);
|
||||
if (isNaN(d.getTime())) return null;
|
||||
return d.toLocaleString(undefined, { timeZone: 'UTC' });
|
||||
return d.toLocaleString(detected.locale, options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import rbush from 'rbush';
|
||||
import { d3geoTile as d3_geoTile } from '../lib/d3.geo.tile';
|
||||
import { geoExtent } from '../geo';
|
||||
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
import {
|
||||
utilQsString,
|
||||
utilRebind,
|
||||
@@ -150,9 +152,11 @@ function loadNextTilePage(which, currZoom, url, tile) {
|
||||
|
||||
function localeDateString(s) {
|
||||
if (!s) return null;
|
||||
var detected = utilDetect();
|
||||
var options = { day: 'numeric', month: 'short', year: 'numeric' };
|
||||
var d = new Date(s);
|
||||
if (isNaN(d.getTime())) return null;
|
||||
return d.toLocaleDateString();
|
||||
return d.toLocaleDateString(detected.locale, options);
|
||||
}
|
||||
|
||||
var features = data.currentPageItems.map(function(item) {
|
||||
|
||||
Reference in New Issue
Block a user