1
1
format
2
2
~~~~~~
3
3
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``)
5
5
6
6
Option passed to the ``IntlDateFormatter`` class , used to transform user input
7
7
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
10
10
that *the expected format will be different for different users*. You
11
11
can override it by passing the format as a string.
12
12
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`_::
16
14
17
15
$builder->add (' date_created' , ' date' , array(
18
16
' widget' => ' single_text' ,
17
+ // this is actually the default format for single_text
19
18
' format' => ' yyyy-MM-dd' ,
20
19
));
21
20
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
+
22
27
.. _`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