File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
app/code/Magento/SalesGraphQl/Model/Resolver Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \SalesGraphQl \Model \Resolver \CreditMemo ;
9
9
10
+ use Magento \Framework \App \ObjectManager ;
10
11
use Magento \Framework \Exception \LocalizedException ;
11
12
use Magento \Framework \GraphQl \Config \Element \Field ;
12
13
use Magento \Framework \GraphQl \Query \ResolverInterface ;
13
14
use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
15
+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
14
16
use Magento \Sales \Api \Data \CreditmemoInterface ;
15
17
16
18
/**
17
19
* Resolve credit memo comments
18
20
*/
19
21
class CreditMemoComments implements ResolverInterface
20
22
{
23
+ private TimezoneInterface $ timezone ;
24
+
25
+ public function __construct (
26
+ TimezoneInterface $ timezone = null
27
+ ) {
28
+ $ this ->timezone = $ timezone ?: ObjectManager::getInstance ()->get (TimezoneInterface::class);
29
+ }
30
+
21
31
/**
22
32
* @inheritDoc
23
33
*/
@@ -40,7 +50,7 @@ public function resolve(
40
50
if ($ comment ->getIsVisibleOnFront ()) {
41
51
$ comments [] = [
42
52
'message ' => $ comment ->getComment (),
43
- 'timestamp ' => $ comment ->getCreatedAt ()
53
+ 'timestamp ' => $ this -> timezone -> date ( $ comment ->getCreatedAt () )
44
54
];
45
55
}
46
56
}
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \SalesGraphQl \Model \Resolver ;
9
9
10
+ use Magento \Framework \App \ObjectManager ;
10
11
use Magento \Framework \Exception \LocalizedException ;
11
12
use Magento \Framework \GraphQl \Config \Element \Field ;
12
13
use Magento \Framework \GraphQl \Query \ResolverInterface ;
13
14
use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
15
+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
14
16
use Magento \Sales \Api \Data \OrderInterface ;
15
17
use Magento \Sales \Api \Data \InvoiceInterface ;
16
18
19
21
*/
20
22
class Invoices implements ResolverInterface
21
23
{
24
+ private TimezoneInterface $ timezone ;
25
+
26
+ public function __construct (
27
+ TimezoneInterface $ timezone = null
28
+ ) {
29
+ $ this ->timezone = $ timezone ?: ObjectManager::getInstance ()->get (TimezoneInterface::class);
30
+ }
31
+
22
32
/**
23
33
* @inheritDoc
24
34
*/
@@ -61,7 +71,7 @@ private function getInvoiceComments(InvoiceInterface $invoice): array
61
71
foreach ($ invoice ->getComments () as $ comment ) {
62
72
if ($ comment ->getIsVisibleOnFront ()) {
63
73
$ comments [] = [
64
- 'timestamp ' => $ comment ->getCreatedAt (),
74
+ 'timestamp ' => $ this -> timezone -> date ( $ comment ->getCreatedAt () ),
65
75
'message ' => $ comment ->getComment ()
66
76
];
67
77
}
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \SalesGraphQl \Model \Resolver ;
9
9
10
+ use Magento \Framework \App \ObjectManager ;
10
11
use Magento \Framework \Exception \LocalizedException ;
11
12
use Magento \Framework \GraphQl \Config \Element \Field ;
12
13
use Magento \Framework \GraphQl \Query \ResolverInterface ;
13
14
use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
15
+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
14
16
use Magento \Sales \Api \Data \ShipmentInterface ;
15
17
use Magento \Sales \Model \Order ;
16
18
19
21
*/
20
22
class Shipments implements ResolverInterface
21
23
{
24
+ private TimezoneInterface $ timezone ;
25
+
26
+ public function __construct (
27
+ TimezoneInterface $ timezone = null
28
+ ) {
29
+ $ this ->timezone = $ timezone ?: ObjectManager::getInstance ()->get (TimezoneInterface::class);
30
+ }
31
+
22
32
/**
23
33
* @inheritDoc
24
34
*/
@@ -62,7 +72,7 @@ private function getShipmentComments(ShipmentInterface $shipment): array
62
72
foreach ($ shipment ->getComments () as $ comment ) {
63
73
if ($ comment ->getIsVisibleOnFront ()) {
64
74
$ comments [] = [
65
- 'timestamp ' => $ comment ->getCreatedAt (),
75
+ 'timestamp ' => $ this -> timezone -> date ( $ comment ->getCreatedAt () ),
66
76
'message ' => $ comment ->getComment ()
67
77
];
68
78
}
You can’t perform that action at this time.
0 commit comments