Module:Date: Difference between revisions

13 bytes added ,  8 years ago
fix bug where Date('2016-06-01') - Date('2016-05-31 23:00') gave 1 day instead of 1 hour
(when parse a date, replace nbsp with space and record input format (dmy/mdy/ymd) in date.format)
(fix bug where Date('2016-06-01') - Date('2016-05-31 23:00') gave 1 day instead of 1 hour)
Line 1,179: Line 1,179:
local dpm = m1 > 1 and days_in_month(y1, m1 - 1, date1.calendar) or 31
local dpm = m1 > 1 and days_in_month(y1, m1 - 1, date1.calendar) or 31
if d2 >= dpm then
if d2 >= dpm then
days = d1
days = d1 - hms(date2)
else
else
days = dpm - d2 + d1
days = dpm - d2 + d1
Anonymous user