]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Выделение даты
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 18 Apr 2025 11:41:56 +0000 (14:41 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 18 Apr 2025 11:41:56 +0000 (14:41 +0300)
erp24/services/MarketplaceService.php

index fea70698e503a5f19a05feeced9e4d1e2a11ae9f..0081fee326e540b6bc1d2629d96d42ec26d119d1 100644 (file)
@@ -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);
             }