Improve int'l date/time strings on imagery and history tools

(closes #4594)
This commit is contained in:
Bryan Housel
2017-12-06 15:27:54 -05:00
parent 3440b5523c
commit 18ab596f58
7 changed files with 75 additions and 33 deletions
+7 -1
View File
@@ -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);
}
+5 -1
View File
@@ -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) {