Skip to content

Commit

Permalink
Merge pull request #10 from taha-moghaddam/patch-1
Browse files Browse the repository at this point in the history
Accept dash as date delimiter, too
  • Loading branch information
sadegh19b authored Jun 21, 2022
2 parents 1595bc8 + 666aa31 commit a192271
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PersianValidators.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function validateShamsiDate($attribute, $value, $parameters)
$value = $this->faToEnNumbers($value);
}

$jdate = explode('/', $value);
$jdate = preg_split('/(\-|\/)/', $value);
return (count($jdate) === 3 && $this->isValidjDate($jdate[0], $jdate[1], $jdate[2]));
}

Expand All @@ -115,7 +115,7 @@ public function validateShamsiDateBetween($attribute, $value, $parameters)
$value = $this->faToEnNumbers($value);
}

$jdate = explode('/', $value);
$jdate = preg_split('/(\-|\/)/', $value);
return $this->validateShamsiDate($attribute, $value, $parameters) && ($parameters[0] <= $jdate[0] && $parameters[1] >= $jdate[0]);
}

Expand Down

0 comments on commit a192271

Please sign in to comment.