File tree 1 file changed +10
-12
lines changed
1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ class DatetimeType extends ScalarType {
25
25
* @return array
26
26
*/
27
27
public function serialize ($ value ) {
28
- return $ this ->toTimestamp ($ value );
28
+ $ carbon = new Carbon ($ value );
29
+ $ carbon ->timezone ('UTC ' );
30
+ $ str = $ carbon ->toIso8601String ();
31
+ return $ str ;
29
32
}
30
33
31
34
/**
@@ -35,26 +38,21 @@ public function serialize($value) {
35
38
* @return array|null
36
39
*/
37
40
public function parseValue ($ value ) {
38
- return new Carbon ($ value );
41
+ $ carbon = new Carbon ($ value );
42
+ $ carbon ->timezone (config ('app.timezone ' ));
43
+ return $ carbon ;
39
44
}
40
45
41
46
/**
42
47
* {@inheritDoc}
43
48
*/
44
49
public function parseLiteral ($ valueNode , ?array $ variables = null ) {
45
50
if ($ valueNode instanceof StringValueNode) {
46
- return new Carbon ($ valueNode ->value );
51
+ $ carbon = new Carbon ($ valueNode ->value );
52
+ $ carbon ->timezone (config ('app.timezone ' ));
53
+ return $ carbon ;
47
54
}
48
55
return null ;
49
56
}
50
57
51
- /**
52
- * Turn value into timestamp
53
- *
54
- * @param string|int $value
55
- * @return int
56
- */
57
- private function toTimestamp ($ value ) {
58
- return (new Carbon ($ value ))->toRfc3339String ();
59
- }
60
58
}
You can’t perform that action at this time.
0 commit comments