Skip to content

Commit 6216dcd

Browse files
committed
Use date P with php7.4 support, instead p
1 parent c0e860e commit 6216dcd

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/FreeElephants/JsonApi/DTO/Field/DateTimeFieldValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class DateTimeFieldValue extends \DateTime implements \JsonSerializable
77
{
8-
public const DEFAULT_JSONAPI_DATE_FORMAT = 'Y-m-d\TH:i:s.vp';
8+
public const DEFAULT_JSONAPI_DATE_FORMAT = 'Y-m-d\TH:i:s.vP';
99
private static string $format = self::DEFAULT_JSONAPI_DATE_FORMAT;
1010

1111
public static function setFormat(string $format)

tests/FreeElephants/JsonApi/DTO/DocumentTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function testFromRequest()
1818
"type": "foo",
1919
"attributes": {
2020
"foo": "bar",
21-
"date": "2012-04-23T18:25:43.511Z",
21+
"date": "2012-04-23T18:25:43.511+03:00",
2222
"nested": {
2323
"someNestedStructure": {
2424
"someKey": "someValue"
@@ -39,16 +39,15 @@ public function testFromRequest()
3939
}
4040
}
4141
JSON;
42-
$request->getBody()->write($rawJson
43-
);
42+
$request->getBody()->write($rawJson);
4443

4544
$fooDTO = FooDocument::fromHttpMessage($request);
4645

4746
$this->assertInstanceOf(FooResource::class, $fooDTO->data);
4847
$this->assertInstanceOf(FooAttributes::class, $fooDTO->data->attributes);
4948
$this->assertSame('foo', $fooDTO->data->type);
5049
$this->assertSame('bar', $fooDTO->data->attributes->foo);
51-
$this->assertEquals(new \DateTime('2012-04-23T18:25:43.511Z'), $fooDTO->data->attributes->date);
50+
$this->assertEquals(new \DateTime('2012-04-23T18:25:43.511+03'), $fooDTO->data->attributes->date);
5251
$this->assertSame('someValue', $fooDTO->data->attributes->nested->someNestedStructure->someKey);
5352
$this->assertSame('baz-id', $fooDTO->data->relationships->baz->data->id);
5453
$this->assertNull($fooDTO->data->attributes->nullableObjectField);

0 commit comments

Comments
 (0)