Skip to content

Commit 1b874ce

Browse files
committed
[#2975] Taking the talk about the HTML date field further by updating default values and tweaking related details
1 parent fcd15aa commit 1b874ce

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format
22
~~~~~~
33

4-
**type**: ``integer`` or ``string`` **default**: ``IntlDateFormatter::MEDIUM``
4+
**type**: ``integer`` or ``string`` **default**: `IntlDateFormatter::MEDIUM`_ (or ``yyyy-MM-dd`` if `widget`_ is ``single_text``)
55

66
Option passed to the ``IntlDateFormatter`` class, used to transform user input
77
into the proper format. This is critical when the `widget`_ option is
@@ -10,13 +10,19 @@ By default, the format is determined based on the current user locale: meaning
1010
that *the expected format will be different for different users*. You
1111
can override it by passing the format as a string.
1212

13-
For more information on valid formats, see `Date/Time Format Syntax`_. For
14-
example, to render a single text box that expects the user to enter ``yyyy-MM-dd``,
15-
use the following options::
13+
For more information on valid formats, see `Date/Time Format Syntax`_::
1614

1715
$builder->add('date_created', 'date', array(
1816
'widget' => 'single_text',
17+
// this is actually the default format for single_text
1918
'format' => 'yyyy-MM-dd',
2019
));
2120

21+
.. note::
22+
23+
If you want your field to be rendered as an HTML5 "date" field, you have
24+
use a ``single_text`` widget with the ``yyyy-MM-dd`` format (the `RFC 3339`_
25+
format) which is the default value if you use the ``single_text`` widget.
26+
2227
.. _`Date/Time Format Syntax`: http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax
28+
.. _`IntlDateFormatter::MEDIUM`: http://www.php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants

0 commit comments

Comments
 (0)