19.04.2022, 07:30
(This post was last modified: 19.04.2022, 07:31 by Erwin van der Zwart.)
Hi, I the day difference is probably due to a leap year in your start or end date, you could try to add something like this in your code:
Code:
function isLeapYear(year)
if ((((year % 4 ==0) and (year % 100~=0)) or (year % 400==0)))then
return true
else
return false
end
end
if isLeapYear(startdate.year) then
-- add or remove a day
log('startdate is a leap year')
end
if isLeapYear(enddate.year) then
-- add or remove a day
log('enddate is a leap year')
end