<span style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">
  <p dir="auto">Got this working using the <code class="notranslate">CalendarLabel</code> plugin, though I'm seeing some CSP warnings in the console. I'm pretty sure the CSP warnings here are related to <a href="https://cal-heatmap.com/docs/plugins/calendarLabel" rel="nofollow">CalendarLabel</a> plugin.</p>
<ul dir="auto">
<li>The first week is fully rendered.</li>
<li>The heatmap always ends on today's date.</li>
<li>Starting day of the week is localized.</li>
<li>Refactored so the code stays inside <code class="notranslate">DOMContentLoaded</code> event listener.</li>
</ul>
<h4 dir="auto">Screenshots</h4>
<p dir="auto">Sunday as first day locale:<br>
<a href="https://github.com/user-attachments/assets/74f3b83d-7ba2-4ea3-83fc-1a39af9b0809">Screenshot.2025-04-13.at.18.13.20.png (view on web)</a></p>
<p dir="auto">Monday as first day locale:<br>
<a href="https://github.com/user-attachments/assets/c2f848fc-fdb4-4265-9256-ef984c2f36df">Screenshot.2025-04-13.at.18.13.39.png (view on web)</a></p>
<p dir="auto">CSP warnings:<br>
<a href="https://github.com/user-attachments/assets/2e0b50fb-4a22-4faf-9e01-67be89b8ebd6">Screenshot.2025-04-13.at.18.14.03.png (view on web)</a></p>
<h3 dir="auto">Notes</h3>
<ul dir="auto">
<li>One challenge I ran into was rendering day labels in the view. I couldn’t find a way to determine whether the week starts on Sunday or Monday from within the view itself, so I opted to use <code class="notranslate">CalendarLabel</code> here as well.</li>
<li>For rendering the month labels, I opted for the <code class="notranslate">CalendarLabel</code> API—it’s much cleaner this way, as computing and positioning the labels manually would be unnecessarily complex.</li>
</ul>
<p dir="auto">I'm unsure whether we should adjust the config to resolve the CSP warnings, or consider refactoring to manually render the labels instead. Would appreciate any thoughts or suggestions here..</p><p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5906#issuecomment-2800018290">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLND65HBMVZNPCD2NC32ZKFZFAVCNFSM6AAAAAB2VRVDVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBQGAYTQMRZGA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLK2VU6OAXQ245N7P7T2ZKFZFA5CNFSM6AAAAAB2VRVDVGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTVG4TRXE.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5906/c2800018290</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
</span>


<div style="display: flex; flex-wrap: wrap; white-space: pre-wrap; align-items: center; "><img height="20" width="20" style="border-radius:50%; margin-right: 4px;" decoding="async" src="https://avatars.githubusercontent.com/u/76796906?s=20&v=4" /><strong>kcne</strong> left a comment <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5906#issuecomment-2800018290">(openstreetmap/openstreetmap-website#5906)</a></div>
<p dir="auto">Got this working using the <code class="notranslate">CalendarLabel</code> plugin, though I'm seeing some CSP warnings in the console. I'm pretty sure the CSP warnings here are related to <a href="https://cal-heatmap.com/docs/plugins/calendarLabel" rel="nofollow">CalendarLabel</a> plugin.</p>
<ul dir="auto">
<li>The first week is fully rendered.</li>
<li>The heatmap always ends on today's date.</li>
<li>Starting day of the week is localized.</li>
<li>Refactored so the code stays inside <code class="notranslate">DOMContentLoaded</code> event listener.</li>
</ul>
<h4 dir="auto">Screenshots</h4>
<p dir="auto">Sunday as first day locale:<br>
<a href="https://github.com/user-attachments/assets/74f3b83d-7ba2-4ea3-83fc-1a39af9b0809">Screenshot.2025-04-13.at.18.13.20.png (view on web)</a></p>
<p dir="auto">Monday as first day locale:<br>
<a href="https://github.com/user-attachments/assets/c2f848fc-fdb4-4265-9256-ef984c2f36df">Screenshot.2025-04-13.at.18.13.39.png (view on web)</a></p>
<p dir="auto">CSP warnings:<br>
<a href="https://github.com/user-attachments/assets/2e0b50fb-4a22-4faf-9e01-67be89b8ebd6">Screenshot.2025-04-13.at.18.14.03.png (view on web)</a></p>
<h3 dir="auto">Notes</h3>
<ul dir="auto">
<li>One challenge I ran into was rendering day labels in the view. I couldn’t find a way to determine whether the week starts on Sunday or Monday from within the view itself, so I opted to use <code class="notranslate">CalendarLabel</code> here as well.</li>
<li>For rendering the month labels, I opted for the <code class="notranslate">CalendarLabel</code> API—it’s much cleaner this way, as computing and positioning the labels manually would be unnecessarily complex.</li>
</ul>
<p dir="auto">I'm unsure whether we should adjust the config to resolve the CSP warnings, or consider refactoring to manually render the labels instead. Would appreciate any thoughts or suggestions here..</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5906#issuecomment-2800018290">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLND65HBMVZNPCD2NC32ZKFZFAVCNFSM6AAAAAB2VRVDVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBQGAYTQMRZGA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLK2VU6OAXQ245N7P7T2ZKFZFA5CNFSM6AAAAAB2VRVDVGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTVG4TRXE.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5906/c2800018290</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>

<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5906#issuecomment-2800018290",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5906#issuecomment-2800018290",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>