lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi, I'm a new Lua user, but I think I might have stumbled on something in os.date

function get_days_in_month(mnth, yr)
 return os.date('*t',os.time{year=yr,month=mnth+1,day=0})['day']
end

It returns 29 for February in 1900 and 2100, which are not leap years. It appears to fail the rule: that years divisible by 100 (except those divisible by 400) are not leap years.
All other dates seem fine.

Is this a bug or am I missing something?

Looking at loslib.c, the Lua time functions appear to use the time.h C library, so it could just be a bug in my machine's date libs. However, I don't know C...

Cheers.