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
+10 -7
View File
@@ -6,13 +6,16 @@ import { geoArea as d3_geoArea } from 'd3-geo';
import { t } from '../util/locale';
import { geoExtent, geoPolygonIntersectsPolygon } from '../geo';
import { jsonpRequest } from '../util/jsonp_request';
import { utilDetect } from '../util/detect';
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);
}
function vintageRange(vintage) {
@@ -28,12 +31,12 @@ function vintageRange(vintage) {
export function rendererBackgroundSource(data) {
var source = _clone(data),
offset = [0, 0],
name = source.name,
description = source.description,
best = !!source.best,
template = source.template;
var source = _clone(data);
var offset = [0, 0];
var name = source.name;
var description = source.description;
var best = !!source.best;
var template = source.template;
source.scaleExtent = data.scaleExtent || [0, 22];
source.overzoom = data.overzoom !== false;