Skip to content

Commit bd31e4b

Browse files
author
Ruslan Plotnikov
committed
YP-1933 Change period validation
1 parent c3412a7 commit bd31e4b

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

src/Receiver.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,7 @@ public function __construct(
4141
$this->purpose = $purpose;
4242
$this->personalAccount = $personalAccount;
4343

44-
$formattedDate = \DateTime::createFromFormat(
45-
'm/Y',
46-
$period,
47-
new DateTimeZone(date_default_timezone_get())
48-
);
49-
50-
if ($formattedDate === false || $period !== $formattedDate->format('m/Y')) {
44+
if (preg_match('~^(0[1-9]|1[0-2])\/\d{4}$~', $period)) {
5145
throw new PaymentException('Аргумент period имеет неверный формат');
5246
}
5347

0 commit comments

Comments
 (0)