From 51ce579e02d20dd06a3461914ceddcc441a158c9 Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 18 Apr 2025 14:41:56 +0300 Subject: [PATCH] =?utf8?q?=D0=92=D1=8B=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8?= =?utf8?q?=D0=B5=20=D0=B4=D0=B0=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MarketplaceService.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/erp24/services/MarketplaceService.php b/erp24/services/MarketplaceService.php index fea70698..0081fee3 100644 --- a/erp24/services/MarketplaceService.php +++ b/erp24/services/MarketplaceService.php @@ -2177,20 +2177,19 @@ class MarketplaceService } $date = null; - if (preg_match('/(сегодня|завтра|послезавтра),?\s*(\d{1,2})\s+([а-яА-Я]+)\s+(\d{4})/u', $deliveryText, $match)) { - [$_, $label, $day, $monthName, $year] = $match; - } elseif (preg_match('/(\d{1,2})\s+([а-яА-Я]+)\s+(\d{4})/u', $deliveryText, $match)) { - [$_, $day, $monthName, $year] = $match; - } - if (isset($monthName)) { + if (preg_match('/(?:сегодня|завтра|послезавтра)?[,]?\s*(\d{1,2})\s+([а-яА-Я]+)\s+(\d{4})/u', $deliveryText, $match)) { + [$__, $day, $monthName, $year] = $match; + $months = [ 'января' => '01', 'февраля' => '02', 'марта' => '03', 'апреля' => '04', 'мая' => '05', 'июня' => '06', 'июля' => '07', 'августа' => '08', 'сентября' => '09', 'октября' => '10', 'ноября' => '11', 'декабря' => '12', ]; + $month = $months[mb_strtolower($monthName)] ?? null; + if ($month) { $date = sprintf('%04d-%02d-%02d', $year, $month, $day); } -- 2.39.5