Skip to content

Commit

Permalink
[3.0.x] Corrected notes about default date/datetime/time input formats.
Browse files Browse the repository at this point in the history
Backport of b23fb2c from master
  • Loading branch information
claudep authored and felixxm committed Jan 6, 2020
1 parent 4f81f6d commit 4853d0f
Showing 1 changed file with 15 additions and 36 deletions.
51 changes: 15 additions & 36 deletions docs/ref/forms/fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -467,25 +467,11 @@ For each field, we describe the default widget used if you don't specify
A list of formats used to attempt to convert a string to a valid
``datetime.date`` object.

If no ``input_formats`` argument is provided, the default input formats are::

['%Y-%m-%d', # '2006-10-25'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y'] # '10/25/06'

Additionally, if you specify :setting:`USE_L10N=False<USE_L10N>` in your settings, the
following will also be included in the default input formats::

['%b %d %Y', # 'Oct 25 2006'
'%b %d, %Y', # 'Oct 25, 2006'
'%d %b %Y', # '25 Oct 2006'
'%d %b, %Y', # '25 Oct, 2006'
'%B %d %Y', # 'October 25 2006'
'%B %d, %Y', # 'October 25, 2006'
'%d %B %Y', # '25 October 2006'
'%d %B, %Y'] # '25 October, 2006'

See also :doc:`format localization </topics/i18n/formatting>`.
If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`DATE_INPUT_FORMATS` if :setting:`USE_L10N` is
``False``, or from the active locale format ``DATE_INPUT_FORMATS`` key if
localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.

``DateTimeField``
-----------------
Expand All @@ -506,19 +492,11 @@ For each field, we describe the default widget used if you don't specify
A list of formats used to attempt to convert a string to a valid
``datetime.datetime`` object.

If no ``input_formats`` argument is provided, the default input formats are::

['%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25'
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
'%m/%d/%Y %H:%M', # '10/25/2006 14:30'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
'%m/%d/%y %H:%M', # '10/25/06 14:30'
'%m/%d/%y'] # '10/25/06'

See also :doc:`format localization </topics/i18n/formatting>`.
If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`DATETIME_INPUT_FORMATS` if :setting:`USE_L10N` is
``False``, or from the active locale format ``DATETIME_INPUT_FORMATS`` key
if localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.

``DecimalField``
----------------
Expand Down Expand Up @@ -928,10 +906,11 @@ For each field, we describe the default widget used if you don't specify
A list of formats used to attempt to convert a string to a valid
``datetime.time`` object.

If no ``input_formats`` argument is provided, the default input formats are::

'%H:%M:%S', # '14:30:59'
'%H:%M', # '14:30'
If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`TIME_INPUT_FORMATS` if :setting:`USE_L10N` is
``False``, or from the active locale format ``TIME_INPUT_FORMATS`` key if
localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.

``URLField``
------------
Expand Down

0 comments on commit 4853d0f

Please sign in to comment.