Skip to content

Commit 5a7cffd

Browse files
committed
Enhance intro, string input description and fix option sorting
1 parent f679456 commit 5a7cffd

File tree

1 file changed

+113
-113
lines changed

1 file changed

+113
-113
lines changed

reference/forms/types/dateinterval.rst

Lines changed: 113 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ dateinterval Field Type
55
=======================
66

77
This field type allows the user to modify data that represents a specific
8-
interval (e.g. ``P7Y6M5DT12H15M30S``).
8+
date interval. It can be rendered as a integer or text input or select tags.
99

10-
Can be rendered as a integer or text input or select tags. The underlying format of the
11-
data can be a ``DateInterval`` object, a `RFC 3339`_ duration string or an array.
10+
The underlying format of the data can be a ``DateInterval`` object,
11+
a `RFC 3339`_ duration string (e.g. ``P1DT12H``) or an array.
1212

1313
+----------------------+-----------------------------------------------------------------------------------+
1414
| Underlying Data Type | can be ``DateInterval``, string or array (see the ``input`` option) |
1515
+----------------------+-----------------------------------------------------------------------------------+
1616
| Rendered as | single text box or up to six select, text or integer boxes plus optional checkbox |
1717
+----------------------+-----------------------------------------------------------------------------------+
18-
| Options | - `with_years`_ |
19-
| | - `with_months`_ |
20-
| | - `with_weeks`_ |
18+
| Options | - `days`_ |
19+
| | - `placeholder`_ |
20+
| | - `hours`_ |
21+
| | - `input`_ |
22+
| | - `minutes`_ |
23+
| | - `months`_ |
24+
| | - `seconds`_ |
25+
| | - `weeks`_ |
26+
| | - `widget`_ |
2127
| | - `with_days`_ |
2228
| | - `with_hours`_ |
29+
| | - `with_invert`_ |
2330
| | - `with_minutes`_ |
31+
| | - `with_months`_ |
2432
| | - `with_seconds`_ |
25-
| | - `with_invert`_ |
33+
| | - `with_weeks`_ |
34+
| | - `with_years`_ |
2635
| | - `years`_ |
27-
| | - `months`_ |
28-
| | - `weeks`_ |
29-
| | - `days`_ |
30-
| | - `hours`_ |
31-
| | - `minutes`_ |
32-
| | - `seconds`_ |
33-
| | - `placeholder`_ |
34-
| | - `input`_ |
35-
| | - `widget`_ |
3636
+----------------------+-----------------------------------------------------------------------------------+
3737
| Inherited | - `data`_ |
3838
| options | - `disabled`_ |
@@ -80,27 +80,15 @@ The field also supports an ``array`` as valid ``input`` option values.
8080
Field Options
8181
-------------
8282

83-
input
84-
~~~~~
85-
86-
**type**: ``string`` **default**: ``dateinterval``
87-
88-
The format of the *input* data - i.e. the format that the interval is stored on
89-
your underlying object. Valid values are:
90-
91-
* ``string`` (e.g. ``P1DT12H``)
92-
* ``dateinterval`` (a ``DateInterval`` object)
93-
* ``array`` (e.g. ``array('days' => '1', 'hours' => '12',)``)
94-
95-
The value that comes back from the form will also be normalized back into
96-
this format.
83+
days
84+
~~~~
9785

98-
widget
99-
~~~~~~
86+
**type**: ``array`` **default**: 0 to 31
10087

101-
**type**: ``string`` **default**: ``choice``
88+
List of days available to the days field type. This option is only relevant
89+
when the ``widget`` option is set to ``choice``::
10290

103-
Defines the ``widget`` option for the single interval component inputs.
91+
'days' => range(1, 31)
10492

10593
placeholder
10694
~~~~~~~~~~~
@@ -121,29 +109,77 @@ Alternatively, you can specify a string to be displayed for the "blank" value::
121109
'placeholder' => array('years' => 'Years', 'months' => 'Months', 'days' => 'Days')
122110
));
123111

124-
with_years
125-
~~~~~~~~~~
112+
hours
113+
~~~~~
126114

127-
**type**: ``Boolean`` **default**: ``true``
115+
**type**: ``array`` **default**: 0 to 24
128116

129-
Whether or not to include years in the input. This will result in an additional
130-
input to capture years.
117+
List of hours available to the hours field type. This option is only relevant
118+
when the ``widget`` option is set to ``choice``::
131119

132-
with_months
133-
~~~~~~~~~~~
120+
'hours' => range(1, 24)
134121

135-
**type**: ``Boolean`` **default**: ``true``
122+
input
123+
~~~~~
136124

137-
Whether or not to include months in the input. This will result in an additional
138-
input to capture months.
125+
**type**: ``string`` **default**: ``dateinterval``
139126

140-
with_weeks
141-
~~~~~~~~~~
127+
The format of the *input* data - i.e. the format that the interval is stored on
128+
your underlying object. Valid values are:
142129

143-
**type**: ``Boolean`` **default**: ``false``
130+
* ``string`` (a string formatted with `RFC 3339`_ standard, e.g. ``P7Y6M5DT12H15M30S``)
131+
* ``dateinterval`` (a ``DateInterval`` object)
132+
* ``array`` (e.g. ``array('days' => '1', 'hours' => '12',)``)
144133

145-
Whether or not to include weeks in the input. This will result in an additional
146-
input to capture weeks.
134+
The value that comes back from the form will also be normalized back into
135+
this format.
136+
137+
minutes
138+
~~~~~~~
139+
140+
**type**: ``array`` **default**: 0 to 60
141+
142+
List of minutes available to the minutes field type. This option is only relevant
143+
when the ``widget`` option is set to ``choice``::
144+
145+
'minutes' => range(1, 60)
146+
147+
months
148+
~~~~~~
149+
150+
**type**: ``array`` **default**: 0 to 12
151+
152+
List of months available to the months field type. This option is only relevant
153+
when the ``widget`` option is set to ``choice``::
154+
155+
'months' => range(1, 12)
156+
157+
seconds
158+
~~~~~~~
159+
160+
**type**: ``array`` **default**: 0 to 60
161+
162+
List of seconds available to the seconds field type. This option is only relevant
163+
when the ``widget`` option is set to ``choice``::
164+
165+
'seconds' => range(1, 60)
166+
167+
weeks
168+
~~~~~
169+
170+
**type**: ``array`` **default**: 0 to 52
171+
172+
List of weeks available to the weeks field type. This option is only relevant
173+
when the ``widget`` option is set to ``choice``::
174+
175+
'weeks' => range(1, 52)
176+
177+
widget
178+
~~~~~~
179+
180+
**type**: ``string`` **default**: ``choice``
181+
182+
Defines the ``widget`` option for the single interval component inputs.
147183

148184
with_days
149185
~~~~~~~~~
@@ -161,6 +197,14 @@ with_hours
161197
Whether or not to include hours in the input. This will result in an additional
162198
input to capture hours.
163199

200+
with_invert
201+
~~~~~~~~~~~
202+
203+
**type**: ``Boolean`` **default**: ``false``
204+
205+
Whether or not to include invert in the input. This will result in an additional
206+
input to capture seconds.
207+
164208
with_minutes
165209
~~~~~~~~~~~~
166210

@@ -169,6 +213,14 @@ with_minutes
169213
Whether or not to include minutes in the input. This will result in an additional
170214
input to capture minutes.
171215

216+
with_months
217+
~~~~~~~~~~~
218+
219+
**type**: ``Boolean`` **default**: ``true``
220+
221+
Whether or not to include months in the input. This will result in an additional
222+
input to capture months.
223+
172224
with_seconds
173225
~~~~~~~~~~~~
174226

@@ -177,13 +229,21 @@ with_seconds
177229
Whether or not to include seconds in the input. This will result in an additional
178230
input to capture seconds.
179231

180-
with_invert
181-
~~~~~~~~~~~
232+
with_weeks
233+
~~~~~~~~~~
182234

183235
**type**: ``Boolean`` **default**: ``false``
184236

185-
Whether or not to include invert in the input. This will result in an additional
186-
input to capture seconds.
237+
Whether or not to include weeks in the input. This will result in an additional
238+
input to capture weeks.
239+
240+
with_years
241+
~~~~~~~~~~
242+
243+
**type**: ``Boolean`` **default**: ``true``
244+
245+
Whether or not to include years in the input. This will result in an additional
246+
input to capture years.
187247

188248
years
189249
~~~~~
@@ -195,66 +255,6 @@ when the ``widget`` option is set to ``choice``::
195255

196256
'years' => range(1, 100)
197257

198-
months
199-
~~~~~~
200-
201-
**type**: ``array`` **default**: 0 to 12
202-
203-
List of months available to the months field type. This option is only relevant
204-
when the ``widget`` option is set to ``choice``::
205-
206-
'months' => range(1, 12)
207-
208-
weeks
209-
~~~~~
210-
211-
**type**: ``array`` **default**: 0 to 52
212-
213-
List of weeks available to the weeks field type. This option is only relevant
214-
when the ``widget`` option is set to ``choice``::
215-
216-
'weeks' => range(1, 52)
217-
218-
days
219-
~~~~
220-
221-
**type**: ``array`` **default**: 0 to 31
222-
223-
List of days available to the days field type. This option is only relevant
224-
when the ``widget`` option is set to ``choice``::
225-
226-
'days' => range(1, 31)
227-
228-
hours
229-
~~~~~
230-
231-
**type**: ``array`` **default**: 0 to 24
232-
233-
List of hours available to the hours field type. This option is only relevant
234-
when the ``widget`` option is set to ``choice``::
235-
236-
'hours' => range(1, 24)
237-
238-
minutes
239-
~~~~~~~
240-
241-
**type**: ``array`` **default**: 0 to 60
242-
243-
List of minutes available to the minutes field type. This option is only relevant
244-
when the ``widget`` option is set to ``choice``::
245-
246-
'minutes' => range(1, 60)
247-
248-
seconds
249-
~~~~~~~
250-
251-
**type**: ``array`` **default**: 0 to 60
252-
253-
List of seconds available to the seconds field type. This option is only relevant
254-
when the ``widget`` option is set to ``choice``::
255-
256-
'seconds' => range(1, 60)
257-
258258
Inherited Options
259259
-----------------
260260

0 commit comments

Comments
 (0)