From b2c86c9a9493fbb3f1a8df1f297977053a89c040 Mon Sep 17 00:00:00 2001 From: Midgard Date: Thu, 21 May 2020 02:02:30 +0200 Subject: [PATCH] Change date format to something sensible --- src/index.html | 2 +- src/js/map.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index 1c5a290..1e9ae35 100644 --- a/src/index.html +++ b/src/index.html @@ -37,7 +37,7 @@
Locatie: {{address}}
{{#if period.start}} - Van {{period.start}} tot {{period.end}} + {{date period.start}} tot {{date period.end}} {{else}} Open gedurende het hele jaar. {{/if}} diff --git a/src/js/map.js b/src/js/map.js index 973ce30..2b3f762 100644 --- a/src/js/map.js +++ b/src/js/map.js @@ -156,4 +156,16 @@ $(document).ready(function() { var legend = new SimpleControl("#legend-template", christmasSeason ? "holiday-legend" : "legend", { position: "bottomright" }).addTo(map); + + + var monthNames = ["jan.", "feb.", "mrt.", "apr.", "mei", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."]; + Handlebars.registerHelper("date", function (ddmyyyy) { + var parts = ddmyyyy.split("-"); + + var date = parts[0]; + var month = monthNames[parts[1] - 1]; + var year = parts[2]; + + return date + " " + month + " " + year; + }) });