From 666aa31a5a3aa19fd91d0c1701e8bd65ee2a09c5 Mon Sep 17 00:00:00 2001 From: Taha Moghaddam Date: Thu, 19 May 2022 12:03:45 +0430 Subject: [PATCH] Accept dash as date delimiter, too To be compatible with packages like [morilog/jalali](https://github.com/morilog/jalali) --- src/PersianValidators.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PersianValidators.php b/src/PersianValidators.php index 1b3e3d7..19bcc42 100644 --- a/src/PersianValidators.php +++ b/src/PersianValidators.php @@ -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])); } @@ -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]); }