]> git.openstreetmap.org Git - rails.git/commitdiff
Use Date().toLocaleString() to construct month titles
authorAnton Khorev <tony29@yandex.ru>
Fri, 21 Mar 2025 12:59:02 +0000 (15:59 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 21 Mar 2025 13:15:47 +0000 (16:15 +0300)
Ensures that standalone month names are in the nominative case.

app/assets/javascripts/heatmap.js

index 572b621a4a52e14dc1f80ff1217f66bab517fda0..240707609217c6bb834ea62194b30982564a58aa 100644 (file)
@@ -16,7 +16,6 @@ document.addEventListener("DOMContentLoaded", () => {
   const colorScheme = document.documentElement.getAttribute("data-bs-theme") ?? "auto";
   const rangeColors = ["#14432a", "#166b34", "#37a446", "#4dd05a"];
   const startDate = new Date(Date.now() - (365 * 24 * 60 * 60 * 1000));
   const colorScheme = document.documentElement.getAttribute("data-bs-theme") ?? "auto";
   const rangeColors = ["#14432a", "#166b34", "#37a446", "#4dd05a"];
   const startDate = new Date(Date.now() - (365 * 24 * 60 * 60 * 1000));
-  const monthNames = OSM.i18n.t("date.abbr_month_names");
 
   const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
 
 
   const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
 
@@ -34,7 +33,7 @@ document.addEventListener("DOMContentLoaded", () => {
         type: "month",
         gutter: 4,
         label: {
         type: "month",
         gutter: 4,
         label: {
-          text: (timestamp) => monthNames[new Date(timestamp).getUTCMonth() + 1],
+          text: (timestamp) => new Date(timestamp).toLocaleString(OSM.i18n.locale, { timeZone: "UTC", month: "short" }),
           position: "top",
           textAlign: "middle"
         },
           position: "top",
           textAlign: "middle"
         },