12
12
use Magento \Framework \Registry ;
13
13
use Magento \Framework \Stdlib \DateTime \Filter \Date ;
14
14
use Magento \Framework \App \Request \DataPersistorInterface ;
15
+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
15
16
16
17
/**
17
18
* Save action for catalog rule
@@ -25,19 +26,27 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog imple
25
26
*/
26
27
protected $ dataPersistor ;
27
28
29
+ /**
30
+ * @var TimezoneInterface
31
+ */
32
+ private $ localeDate ;
33
+
28
34
/**
29
35
* @param Context $context
30
36
* @param Registry $coreRegistry
31
37
* @param Date $dateFilter
32
38
* @param DataPersistorInterface $dataPersistor
39
+ * @param TimezoneInterface $localeDate
33
40
*/
34
41
public function __construct (
35
42
Context $ context ,
36
43
Registry $ coreRegistry ,
37
44
Date $ dateFilter ,
38
- DataPersistorInterface $ dataPersistor
45
+ DataPersistorInterface $ dataPersistor ,
46
+ TimezoneInterface $ localeDate
39
47
) {
40
48
$ this ->dataPersistor = $ dataPersistor ;
49
+ $ this ->localeDate = $ localeDate ;
41
50
parent ::__construct ($ context , $ coreRegistry , $ dateFilter );
42
51
}
43
52
@@ -66,6 +75,9 @@ public function execute()
66
75
);
67
76
$ data = $ this ->getRequest ()->getPostValue ();
68
77
78
+ if (!$ this ->getRequest ()->getParam ('from_date ' )) {
79
+ $ data ['from_date ' ] = $ this ->localeDate ->formatDate ();
80
+ }
69
81
$ filterValues = ['from_date ' => $ this ->_dateFilter ];
70
82
if ($ this ->getRequest ()->getParam ('to_date ' )) {
71
83
$ filterValues ['to_date ' ] = $ this ->_dateFilter ;
0 commit comments