summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/l-os.lua
diff options
context:
space:
mode:
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