fix leap year

This commit is contained in:
Nasser committed 2020-08-21 15:45:37 +04:30
1 parent a59efb6676
commit 66443d52b6
1 file changed
+2 -6
+2 -6
View File
@@ -1466,11 +1466,7 @@ class Verta extends DateTime {
* @return bool
*/
public static function isLeapYear($year) {
$mod = ($year % 33);
if (($mod == 1) or ( $mod == 5) or ( $mod == 9) or ( $mod == 13) or ( $mod == 17) or ( $mod == 22) or ( $mod == 26) or ( $mod == 30)) {
return true;
}
return false;
return in_array(($year % 33) , [1 , 5 , 9 , 13 ,17 , 22 , 26 , 30]);
}
/**
@@ -1504,7 +1500,7 @@ class Verta extends DateTime {
* @return bool
*/
public static function isValidTime($hour, $minute, $second) {
return $hour >= 0 && $hour <= 24
return $hour >= 0 && $hour <= 23
&& $minute >= 0 && $minute <= 59
&& $second >= 0 && $second <= 59;
}