From ec8364baf3cf95fa2404c4e5e1e6b70bf3e7311c Mon Sep 17 00:00:00 2001 From: Ken D'Ambrosio Date: Mon, 25 May 2026 01:17:28 +0000 Subject: Replace with for browser compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit type="week" is unsupported in Firefox and Safari. Use type="date" instead — pick any day in the target week and JS rewinds to Monday. Co-Authored-By: Claude Sonnet 4.6 --- app/templates/index.html | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index c690525..1714ddb 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -9,8 +9,8 @@
- + {% if not is_current_week %} Today {% endif %} @@ -123,13 +123,11 @@ const todayStr = '{{ today_str }}'; document.getElementById('weekPicker').addEventListener('change', function() { if (!this.value) return; - // value is "YYYY-Www" — convert to Mon of that ISO week - const [year, week] = this.value.split('-W').map(Number); - const jan4 = new Date(year, 0, 4); // Jan 4 is always in week 1 - const dayOfWeek = jan4.getDay() || 7; // Mon=1..Sun=7 - const mon = new Date(jan4); - mon.setDate(jan4.getDate() - (dayOfWeek - 1) + (week - 1) * 7); - const iso = mon.toISOString().split('T')[0]; + // Rewind picked date to Monday of that week + const d = new Date(this.value + 'T00:00:00'); + const day = d.getDay() || 7; // Sun=0→7, Mon=1 + d.setDate(d.getDate() - (day - 1)); + const iso = d.toISOString().split('T')[0]; window.location.href = '/?week=' + iso; }); -- cgit v1.2.3