From 48fa63ff5d0e12edf86db7f01def635aa0aaa9fb Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 15:29:35 +0200 Subject: fix(calendar): mark events past this week on the month grid The sampler asked khal for 8 days only, so the grid never coloured an event later in the month. Sample through the month's end instead, and cut the event table back to the coming week with calendar_upcoming(). Co-Authored-By: Claude Opus 5.5 --- test/test_data.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/test_data.lua') diff --git a/test/test_data.lua b/test/test_data.lua index 9066241..01a55cc 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -109,6 +109,14 @@ assert(days[18] == 'personal', 'first event of the day owns it, got ' assert(days[24] == 'work' and days[26] == 'birthdays', 'later days marked') assert(days[2] == nil, 'October event does not mark September') +-- upcoming: the table's week out of a month-long cache, across a month end. +local up = data.calendar_upcoming({ { y = 2026, m = 10, d = 18 }, + { y = 2026, m = 10, d = 25 }, { y = 2026, m = 10, d = 26 }, + { y = 2026, m = 10, d = 29 } }, { 2026, 10, 18 }, 8) +assert(#up == 2 and up[2].d == 25, 'eight days from the 18th end on the 25th') +assert(#data.calendar_upcoming({ { y = 2026, m = 11, d = 2 } }, + { 2026, 10, 28 }, 8) == 1, 'week crosses into next month') + -- month_shape: September 2026 has 30 days and starts on a Tuesday. -- Monday = 1, so Tuesday = 2. local ndays, first = data.month_shape(2026, 9) -- cgit v1.2.3