From ce8decc2b0894837ecd2886af5d3af2248bde07c Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:40:46 -0500 Subject: [PATCH] fix(parse): cast os.date('*t') return to osdate (#3) Problem: LuaLS types os.date('*t') as string|osdate, causing type errors when accessing .year, .month, .day, .wday fields in is_valid_date and resolve_date. Solution: add --[[@as osdate]] casts on both os.date('*t') calls. --- lua/pending/parse.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/pending/parse.lua b/lua/pending/parse.lua index dfe9206..b72214f 100644 --- a/lua/pending/parse.lua +++ b/lua/pending/parse.lua @@ -21,7 +21,7 @@ local function is_valid_date(s) return false end local t = os.time({ year = y, month = m, day = d }) - local check = os.date('*t', t) + local check = os.date('*t', t) --[[@as osdate]] return check.year == y and check.month == m and check.day == d end @@ -44,7 +44,7 @@ local weekday_map = { ---@return string|nil function M.resolve_date(text) local lower = text:lower() - local today = os.date('*t') + local today = os.date('*t') --[[@as osdate]] if lower == 'today' then return os.date('%Y-%m-%d', os.time({ year = today.year, month = today.month, day = today.day })) --[[@as string]]