I got an issue with a calendar skin with some months of the year, it doesn't calculate well the previous month number of days.
On the pic April finishes on 31 instead of 30 and the rest of the current month is off by one day.
I searched the forum and found this post with the same issue and same code. The user @Alex2539 fixed the code but it's so old I can't download the file anymore, and even with his great explanations I can't fix it myself...
This is an extract of the code with all the calculation:
Code: Select all
;----Caculation Part----
[cShowOtherMonths]
Measure=Calc
Formula=(#ShowOtherMonths# = 1) ? 1 : 0
[cLeapYear]
Measure=Calc
Formula=((mYear%4 = 0) && (mYear%100 <> 0) || (mYear%400 = 0)) ? 1 : 0
[cPrevMonth]
Measure=calc
Formula=mMonth - 1
[cDayCount]
Measure=Calc
Formula=((mMonth = 4) || (mMonth = 6) || (mMonth = 9) || (mMonth = 11)) ? 30 : ((mMonth = 2) ? ((cLeapYear = 1) ? 29 : 28) : 31)
[cPrevDayCount]
Measure=Calc
Formula=((cPrevMonth = 4) || (cPrevMonth = 6) || (cPrevMonth = 9) || (cPrevMonth = 11)) ? 30 : ((cPrevMonth = 2) ? ((cLeapYear = 1) ? 29 : 28) : 31)
[StartDay]
Measure=Calc
Formula= ((mWeekCode + 1) - (mDay % 7)) < 0 ? (mWeekCode + 8 - (mDay % 7)) : (mWeekCode + 1) - (mDay % 7)
;----Day Part Draw----
;----1Line----
;------------------------------
1a
;------------------------------
[Val11]
Measure=Calc
Formula=(mDay = 1) && (mWeekCode = 0) ? 1 : (cPrevDayCount - StartDay + 1)
[Select11]
Measure=Calc
Formula=((Val11 = mDay) && (Val11 < 8)) ? 1 : ((Val11 > 8) ? -1 : 0)
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterShowMeter H1Line1][!RainmeterHideMeter 1Line1][!RainmeterHideMeter P1Line1]
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterShowMeter 1Line1][!RainmeterHideMeter H1Line1][!RainmeterHideMeter P1Line1]
IfBelowValue=0
IfBelowAction=!Execute [!RainmeterShowMeter P1Line1][!RainmeterHideMeter 1Line1][!RainmeterHideMeter H1Line1]
;--------------------------------
2a
;--------------------------------
[Val12]
Measure=Calc
Formula=(Val11 < cPrevDayCount) ? (Val11 + 1) : 1
[Select12]
Measure=Calc
Formula=((Val12 = mDay) && (Val12 < 8)) ? 1 : ((Val12 > 8) ? -1 : 0)
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterShowMeter H1Line2][!RainmeterHideMeter 1Line2][!RainmeterHideMeter P1Line2]
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterShowMeter 1Line2][!RainmeterHideMeter H1Line2][!RainmeterHideMeter P1Line2]
IfBelowValue=0
IfBelowAction=!Execute [!RainmeterShowMeter P1Line2][!RainmeterHideMeter 1Line2][!RainmeterHideMeter H1Line2]
...