Skip to content

Commit

Permalink
Fix 13 Months Bug - Update TimeStateFunction.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
xinbenlv authored Jul 15, 2023
1 parent dcc8c9d commit 2e2a0fe
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ contract TimeStateFunction is MachineStateManager {

uint256[] memory _daysPerMonth = new uint256[](12);

_daysPerMonth[0] = 31;
_daysPerMonth[1] = _isLeapYear ? 29 : 28;
_daysPerMonth[2] = 31;
_daysPerMonth[3] = 30;
_daysPerMonth[4] = 31;
_daysPerMonth[5] = 30;
_daysPerMonth[6] = 31;
_daysPerMonth[7] = 31;
_daysPerMonth[8] = 31;
_daysPerMonth[9] = 30;
_daysPerMonth[10] = 31;
_daysPerMonth[11] = 30;
_daysPerMonth[12] = 31;
_daysPerMonth[0] = 31; // Jan
_daysPerMonth[1] = _isLeapYear ? 29 : 28; // Feb
_daysPerMonth[2] = 31; // Mar
_daysPerMonth[3] = 30; // Apr
_daysPerMonth[4] = 31; // May
_daysPerMonth[5] = 30; // Jun
_daysPerMonth[6] = 31; // Jul
_daysPerMonth[7] = 31; // Aug
_daysPerMonth[9] = 30; // Sep
_daysPerMonth[10] = 31; // Oct
_daysPerMonth[11] = 30; // Nov
_daysPerMonth[12] = 31; // Dec

uint256 _month;
for (_month = 0; _month < 12; _month++) {
Expand All @@ -53,4 +52,4 @@ contract TimeStateFunction is MachineStateManager {

return (_year, _month + 1, _day, _hour, _minute, _second);
}
}
}

0 comments on commit 2e2a0fe

Please sign in to comment.