summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/l-os.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-06-29 20:35:31 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-06-29 20:35:31 +0200
commit74abcdb3fc2356cd40aa94d002f2a19aac549b40 (patch)
tree8ffec59cacaab13c48b01c2dead7e97a5d39e7c3 /tex/context/base/mkiv/l-os.lua
parent3bc02e08823ca9d94cd3da01161ec511c9fdec3f (diff)
downloadcontext-74abcdb3fc2356cd40aa94d002f2a19aac549b40.tar.gz
2020-06-29 19:45:00
Diffstat (limited to 'tex/context/base/mkiv/l-os.lua')
-rw-r--r--tex/context/base/mkiv/l-os.lua12
1 files changed, 10 insertions, 2 deletions
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