Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
<?php
|
|
2 |
|
|
3 |
namespace Nuwave\Lighthouse\Schema\Types\Scalars; |
|
4 |
|
|
5 |
use Illuminate\Support\Carbon; |
|
6 |
|
|
7 |
class DateTimeTz extends DateScalar |
|
8 |
{
|
|
9 | 1 |
protected function format(Carbon $carbon): string |
10 |
{
|
|
11 | 1 |
return $carbon->toIso8601String(); |
12 |
}
|
|
13 |
|
|
14 | 1 |
protected function parse($value): Carbon |
15 |
{
|
|
16 |
// @phpstan-ignore-next-line We know the format to be good, so this can never return `false`
|
|
17 | 1 |
return Carbon::createFromFormat( |
18 |
// https://www.php.net/manual/en/class.datetimeinterface.php#datetime.constants.iso8601
|
|
19 |
Carbon::ATOM, |
|
20 | 1 |
$value
|
21 |
);
|
|
22 |
}
|
|
23 |
}
|
Read our documentation on viewing source code .