Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation about default DateTime format #838

Merged
merged 1 commit into from
Nov 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions doc/reference/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ Available Types:
| | Examples: array<string, string>, |
| | array<string, MyNamespace\MyObject>, etc. |
+----------------------------------------------------------+--------------------------------------------------+
| DateTime | PHP's DateTime object (default format/timezone) |
| DateTime | PHP's DateTime object (default format*/timezone) |
+----------------------------------------------------------+--------------------------------------------------+
| DateTime<'format'> | PHP's DateTime object (custom format/default |
| | timezone) |
Expand All @@ -363,7 +363,7 @@ Available Types:
| | specify a specific timezone, use an empty |
| | string (''). |
+----------------------------------------------------------+--------------------------------------------------+
| DateTimeImmutable | PHP's DateTimeImmutable object (default format/ |
| DateTimeImmutable | PHP's DateTimeImmutable object (default format*/ |
| | timezone) |
+----------------------------------------------------------+--------------------------------------------------+
| DateTimeImmutable<'format'> | PHP's DateTimeImmutable object (custom format/ |
Expand All @@ -388,6 +388,8 @@ Available Types:
| | into Doctrine's ArrayCollection class. |
+----------------------------------------------------------+--------------------------------------------------+

*) If the standalone jms/serializer is used then default format is `\DateTime::ISO8601` (which is not compatible with ISO-8601 despite the name). For jms/serializer-bundle the default format is `\DateTime::ATOM` (the real ISO-8601 format) but it can be changed in [configuration](https://jmsyst.com/bundles/JMSSerializerBundle/master/configuration#configuration-block-2-0).
Copy link
Contributor Author

@enumag enumag Nov 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to make the link correctly. This is probably not how it's supposed to be.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(which is not compatible with ISO-8601 despite the name).

can you elaborate? why is not compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See PHP documentation: http://php.net/manual/en/class.datetime.php#datetime.constants.atom

DateTime::ISO8601
DATE_ISO8601
    ISO-8601 (example: 2005-08-15T15:52:01+0000)

        Note: This format is not compatible with ISO-8601, but is left this way for backward compatibility reasons. Use DateTime::ATOM or DATE_ATOM for compatibility with ISO-8601 instead. 

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!


Examples:

.. code-block :: php
Expand Down