Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

document DateType limitations #2403

Merged
merged 3 commits into from

4 participants

@joelclermont
Q A
Doc fix? yes
New docs? yes (symfony/symfony#5227)
Applies to all
Fixed tickets #2266

Relates to Issue 2266. I wasn't sure if it made sense to consolidate this into one note, since the two options are so close, but I kept them separate for now. Feedback welcome.

@WouterJ
Collaborator

Could you please use the pull request format?

And could you also read the rest of that overview document? You're missing some formatting things (and the document doesn't follow the standards)

@joelclermont

Oops, sure thing. Thanks for the quick feedback.

@joelclermont

I added the pull request format to my original comment and broke the lines under 80 characters. I didn't see any other violations. If I missed something, please let me know.

reference/forms/types/options/date_input.rst.inc
((5 lines not shown))
+this format.
+
+Note: If ``timestamp`` is used, ``DateType`` is limited to dates between
@WouterJ Collaborator
WouterJ added a note

it should be:

.. note::

    If ``timestamp`` is used, ...

And maybe change the .. note:: block to a .. caution:: block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
reference/forms/types/options/date_widget.rst.inc
@@ -12,3 +12,7 @@ The basic way in which this field should be rendered. Can be one of the followin
* ``single_text``: renders a single input of type text. User's input is validated
based on the `format`_ option.
+
+Note: If ``single_text`` is used, ``DateType`` is limited to dates between Fri, 13 Dec 1901 20:45:54 GMT and Tue, 19 Jan 2038 03:14:07 GMT on 32bit systems. This is due to a `limitation in PHP itself <http://php.net/manual/en/function.date.php>`_:
+
+ The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1.0 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows).
@weaverryan Collaborator

I really like the link you've added to the php.net page. To make this shorter (because it's always a challenge to mention these edge-case details without cluttering things up), how about we:

a) link to http://php.net/manual/en/function.date.php#refsect1-function.date-changelog (so that it goes right down to that note)
b) Omit the note starting with "The valid range of a ....".

And with that, I think I love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@WouterJ
Collaborator

:+1:

@weaverryan weaverryan merged commit e0ebba8 into symfony:2.0
@weaverryan
Collaborator

Top notch Joel - merged!

@joelclermont joelclermont deleted the joelclermont:issue_2266 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
5 reference/forms/types/options/_date_limitation.rst.inc
@@ -0,0 +1,5 @@
+.. caution::
+
+ If ``timestamp`` is used, ``DateType`` is limited to dates between
+ Fri, 13 Dec 1901 20:45:54 GMT and Tue, 19 Jan 2038 03:14:07 GMT on 32bit
+ systems. This is due to a `limitation in PHP itself <http://php.net/manual/en/function.date.php#refsect1-function.date-changelog>`_.
View
4 reference/forms/types/options/date_input.rst.inc
@@ -12,4 +12,6 @@ your underlying object. Valid values are:
* ``timestamp`` (e.g. ``1307232000``)
The value that comes back from the form will also be normalized back into
-this format.
+this format.
+
+.. include:: /reference/forms/types/options/_date_limitation.rst.inc
View
2  reference/forms/types/options/date_widget.rst.inc
@@ -12,3 +12,5 @@ The basic way in which this field should be rendered. Can be one of the followin
* ``single_text``: renders a single input of type text. User's input is validated
based on the `format`_ option.
+
+.. include:: /reference/forms/types/options/_date_limitation.rst.inc
Something went wrong with that request. Please try again.