@@ -768,22 +768,22 @@ function CronTime(luxon) {
768
768
if ( allRanges [ i ] . match ( RE_RANGE ) ) {
769
769
allRanges [ i ] . replace ( RE_RANGE , ( $0 , lower , upper , step ) => {
770
770
lower = parseInt ( lower , 10 ) ;
771
- upper = parseInt ( upper , 10 ) || undefined ;
771
+ upper = upper !== undefined ? parseInt ( upper , 10 ) : undefined ;
772
772
773
773
const wasStepDefined = ! isNaN ( parseInt ( step , 10 ) ) ;
774
774
if ( step === '0' ) {
775
775
throw new Error ( `Field (${ type } ) has a step of zero` ) ;
776
776
}
777
777
step = parseInt ( step , 10 ) || 1 ;
778
778
779
- if ( upper && lower > upper ) {
779
+ if ( upper !== undefined && lower > upper ) {
780
780
throw new Error ( `Field (${ type } ) has an invalid range` ) ;
781
781
}
782
782
783
783
const outOfRangeError =
784
784
lower < low ||
785
- ( upper && upper > high ) ||
786
- ( ! upper && lower > high ) ;
785
+ ( upper !== undefined && upper > high ) ||
786
+ ( upper === undefined && lower > high ) ;
787
787
788
788
if ( outOfRangeError ) {
789
789
throw new Error ( `Field value (${ value } ) is out of range` ) ;
@@ -793,7 +793,7 @@ function CronTime(luxon) {
793
793
lower = Math . min ( Math . max ( low , ~ ~ Math . abs ( lower ) ) , high ) ;
794
794
795
795
// Positive integer lower than constraints[1]
796
- if ( upper ) {
796
+ if ( upper !== undefined ) {
797
797
upper = Math . min ( high , ~ ~ Math . abs ( upper ) ) ;
798
798
} else {
799
799
// If step is provided, the default upper range is the highest value
0 commit comments