1
<?php
2

3
namespace Nuwave\Lighthouse\Schema\Types\Scalars;
4

5
use Illuminate\Support\Carbon;
6

7
class DateTime extends DateScalar
8
{
9 1
    protected function format(Carbon $carbon): string
10
    {
11 1
        return $carbon->toDateTimeString();
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(Carbon::DEFAULT_TO_STRING_FORMAT, $value);
18
    }
19
}

Read our documentation on viewing source code .

Loading