From 730e16c1cf41d374a57a8ab30e0153e2f4c41dca Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Thu, 15 Oct 2020 16:52:03 -0400 Subject: [PATCH] Use localized placeholder for expected date filter format --- data/core.yaml | 2 ++ dist/locales/en.json | 3 ++- modules/ui/sections/photo_overlays.js | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index d0313ecc9..c97715be5 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -2312,6 +2312,8 @@ en: west: "W" coordinate: "{coordinate}{direction}" coordinate_pair: "{latitude}, {longitude}" + # translate the letters but leave the format the same + year_month_day: "YYYY-MM-DD" wikidata: identifier: "Identifier" label: "Label" diff --git a/dist/locales/en.json b/dist/locales/en.json index 2cadfbedb..5d839f3a9 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -2858,7 +2858,8 @@ "east": "E", "west": "W", "coordinate": "{coordinate}{direction}", - "coordinate_pair": "{latitude}, {longitude}" + "coordinate_pair": "{latitude}, {longitude}", + "year_month_day": "YYYY-MM-DD" }, "wikidata": { "identifier": "Identifier", diff --git a/modules/ui/sections/photo_overlays.js b/modules/ui/sections/photo_overlays.js index a0f6dda12..cd68bff1e 100644 --- a/modules/ui/sections/photo_overlays.js +++ b/modules/ui/sections/photo_overlays.js @@ -5,6 +5,7 @@ import { import { t } from '../../core/localizer'; import { uiTooltip } from '../tooltip'; import { uiSection } from '../section'; +import { utilGetSetValue } from '../../util'; export function uiSectionPhotoOverlays(context) { @@ -214,9 +215,9 @@ export function uiSectionPhotoOverlays(context) { .append('input') .attr('type', 'date') .attr('class', 'list-item-input') - .attr('placeholder', 'dd/mm/yyyy') - .property('value', function(d) { - return context.photos().dateFilterValue(d); + .attr('placeholder', t('units.year_month_day')) + .each(function(d) { + utilGetSetValue(d3_select(this), context.photos().dateFilterValue(d) || ''); }) .on('change', function(d3_event, d) { var value = d3_select(this).property('value');