11
11
use Magento \Framework \Registry ;
12
12
use Magento \Framework \Stdlib \DateTime \Filter \Date ;
13
13
use Magento \Framework \App \Request \DataPersistorInterface ;
14
+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
14
15
15
16
/**
16
17
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -22,19 +23,27 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog
22
23
*/
23
24
protected $ dataPersistor ;
24
25
26
+ /**
27
+ * @var TimezoneInterface
28
+ */
29
+ private $ localeDate ;
30
+
25
31
/**
26
32
* @param Context $context
27
33
* @param Registry $coreRegistry
28
34
* @param Date $dateFilter
29
35
* @param DataPersistorInterface $dataPersistor
36
+ * @param TimezoneInterface $localeDate
30
37
*/
31
38
public function __construct (
32
39
Context $ context ,
33
40
Registry $ coreRegistry ,
34
41
Date $ dateFilter ,
35
- DataPersistorInterface $ dataPersistor
42
+ DataPersistorInterface $ dataPersistor ,
43
+ TimezoneInterface $ localeDate
36
44
) {
37
45
$ this ->dataPersistor = $ dataPersistor ;
46
+ $ this ->localeDate = $ localeDate ;
38
47
parent ::__construct ($ context , $ coreRegistry , $ dateFilter );
39
48
}
40
49
@@ -61,6 +70,9 @@ public function execute()
61
70
);
62
71
$ data = $ this ->getRequest ()->getPostValue ();
63
72
73
+ if (!$ this ->getRequest ()->getParam ('from_date ' )) {
74
+ $ data ['from_date ' ] = $ this ->localeDate ->formatDate ();
75
+ }
64
76
$ filterValues = ['from_date ' => $ this ->_dateFilter ];
65
77
if ($ this ->getRequest ()->getParam ('to_date ' )) {
66
78
$ filterValues ['to_date ' ] = $ this ->_dateFilter ;
0 commit comments