Skip to content

Commit

Permalink
Accept dash as date delimiter, too
Browse files Browse the repository at this point in the history
To be compatible with packages like [morilog/jalali](https://github.com/morilog/jalali)
  • Loading branch information
taha-moghaddam authored May 19, 2022
1 parent 1595bc8 commit 666aa31
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 666aa31

Please sign in to comment.