Sorry not to have responded before now. I'm nowadays only an occasional reader of this forum ( but am still a user of Sailforms).
Here's another solution for you. It avoids any use of additional forms holding monthly data and does not require any processing loops.
It takes advantage of the toDate function to do most of the logic and needs just two hidden calculation fields. All leap year processing gets handled automatically by Sailforms in toDate
Note:
toDate is very useful for date processing:
- it allows you add or subtract months or days from a given date, automatically allowing for changes of year and for leap years, that is to add m months and d davs to date D:
toDate(year(D),month(D)+d,days(D)+d)
- it allows you to find the number of days in a month by looking at the date of the last day in the day before the 1st of the next month, that is for month M in year Y:
day(toDate(Y,M+1,1)-1)
- it allows you to check for a leap year, that is year Y is a leap year if:
day(toDate(Y,3,1)-1)=29