From 74abcdb3fc2356cd40aa94d002f2a19aac549b40 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 29 Jun 2020 20:35:31 +0200 Subject: 2020-06-29 19:45:00 --- tex/context/base/mkiv/l-os.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tex/context/base/mkiv/l-os.lua') diff --git a/tex/context/base/mkiv/l-os.lua b/tex/context/base/mkiv/l-os.lua index 9aa8b8aa7..1e0135094 100644 --- a/tex/context/base/mkiv/l-os.lua +++ b/tex/context/base/mkiv/l-os.lua @@ -604,11 +604,19 @@ os.isleapyear = isleapyear local days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -local function nofdays(year,month) +local function nofdays(year,month,day) if not month then return isleapyear(year) and 365 or 364 - else + elseif not day then return month == 2 and isleapyear(year) and 29 or days[month] + else + for i=1,month-1 do + day = day + days[i] + end + if month > 2 and isleapyear(year) then + day = day + 1 + end + return day end end -- cgit v1.2.3