From 4e0aa65d16e86cb426c49e33511bf013a47c4fbb Mon Sep 17 00:00:00 2001
From: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed, 28 Apr 2010 11:27:38 +0000
Subject: [PATCH] Refs #13339 -- Disable %b/%B-based locale datetime input
 formats, and document that they are problematic.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13039 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 django/conf/locale/cs/formats.py      |  2 +-
 django/conf/locale/de/formats.py      |  2 +-
 django/conf/locale/en/formats.py      |  8 ++++----
 django/conf/locale/fr/formats.py      |  2 +-
 django/conf/locale/ka/formats.py      |  6 +++---
 django/conf/locale/ko/formats.py      | 10 +++++-----
 django/conf/locale/nl/formats.py      | 24 ++++++++++++------------
 django/conf/locale/no/formats.py      |  8 ++++----
 django/conf/locale/pt_BR/formats.py   |  4 ++--
 django/conf/locale/sr/formats.py      |  6 +++---
 django/conf/locale/sr_Latn/formats.py |  6 +++---
 docs/topics/i18n/localization.txt     | 10 ++++++++--
 12 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/django/conf/locale/cs/formats.py b/django/conf/locale/cs/formats.py
index 16ecb74697..bf90c1a641 100644
--- a/django/conf/locale/cs/formats.py
+++ b/django/conf/locale/cs/formats.py
@@ -13,7 +13,7 @@ FIRST_DAY_OF_WEEK = 1 # Monday
 DATE_INPUT_FORMATS = (
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
     '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
-    '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
+    # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S', # '14:30:59'
diff --git a/django/conf/locale/de/formats.py b/django/conf/locale/de/formats.py
index 89b57846b6..7ea1d63871 100644
--- a/django/conf/locale/de/formats.py
+++ b/django/conf/locale/de/formats.py
@@ -13,7 +13,7 @@ FIRST_DAY_OF_WEEK = 1 # Monday
 DATE_INPUT_FORMATS = (
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
     '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
-    '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
+    # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S', # '14:30:59'
diff --git a/django/conf/locale/en/formats.py b/django/conf/locale/en/formats.py
index 3a507cd27e..141f705fb9 100644
--- a/django/conf/locale/en/formats.py
+++ b/django/conf/locale/en/formats.py
@@ -12,10 +12,10 @@ SHORT_DATETIME_FORMAT = 'm/d/Y P'
 FIRST_DAY_OF_WEEK = 0 # Sunday
 DATE_INPUT_FORMATS = (
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
-    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
-    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
-    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
-    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
+    # '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
+    # '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
+    # '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
+    # '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',     # '14:30:59'
diff --git a/django/conf/locale/fr/formats.py b/django/conf/locale/fr/formats.py
index ebd76466a2..121bb9b956 100644
--- a/django/conf/locale/fr/formats.py
+++ b/django/conf/locale/fr/formats.py
@@ -14,7 +14,7 @@ DATE_INPUT_FORMATS = (
     '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
     '%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06'
     '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
-    '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006'
+    # '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S', # '14:30:59'
diff --git a/django/conf/locale/ka/formats.py b/django/conf/locale/ka/formats.py
index 665a73fcfc..01167a78d2 100644
--- a/django/conf/locale/ka/formats.py
+++ b/django/conf/locale/ka/formats.py
@@ -12,9 +12,9 @@ SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s'
 FIRST_DAY_OF_WEEK = 1 # (Monday)
 DATE_INPUT_FORMATS = (
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y',     # '2006-10-25', '10/25/2006', '10/25/06'
-    '%d %b %Y', '%d %b, %Y', '%d %b. %Y',   # '25 Oct 2006', '25 Oct, 2006', '25 Oct. 2006'
-    '%d %B %Y', '%d %B, %Y',                # '25 October 2006', '25 October, 2006'
-    '%d.%m.%Y', '%d.%m.%y',                 # '25.10.2006', '25.10.06'
+    # '%d %b %Y', '%d %b, %Y', '%d %b. %Y',   # '25 Oct 2006', '25 Oct, 2006', '25 Oct. 2006'
+    # '%d %B %Y', '%d %B, %Y',                # '25 October 2006', '25 October, 2006'
+    # '%d.%m.%Y', '%d.%m.%y',                 # '25.10.2006', '25.10.06'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',     # '14:30:59'
diff --git a/django/conf/locale/ko/formats.py b/django/conf/locale/ko/formats.py
index 619047dae0..7b0011c6e1 100644
--- a/django/conf/locale/ko/formats.py
+++ b/django/conf/locale/ko/formats.py
@@ -9,13 +9,13 @@ YEAR_MONTH_FORMAT = 'Y년 F월'
 MONTH_DAY_FORMAT = 'F월 j일'
 SHORT_DATE_FORMAT = 'Y-n-j.'
 SHORT_DATETIME_FORMAT = 'Y-n-j H:i'
-# FIRST_DAY_OF_WEEK = 
+# FIRST_DAY_OF_WEEK =
 DATE_INPUT_FORMATS = (
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
-    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
-    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
-    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
-    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
+    # '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
+    # '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
+    # '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
+    # '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
     '%Y년 %m월 %d일',                   # '2006년 10월 25일', with localized suffix.
 )
 TIME_INPUT_FORMATS = (
diff --git a/django/conf/locale/nl/formats.py b/django/conf/locale/nl/formats.py
index dcef8c1eb7..cdbedb02f9 100644
--- a/django/conf/locale/nl/formats.py
+++ b/django/conf/locale/nl/formats.py
@@ -12,8 +12,8 @@ SHORT_DATETIME_FORMAT = 'j-n-Y H:i'     # '20-1-2009 15:23'
 FIRST_DAY_OF_WEEK = 1                   # Monday (in Dutch 'maandag')
 DATE_INPUT_FORMATS = (
     '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d', # '20-01-2009', '20-01-09', '2009-01-20'
-    '%d %b %Y', '%d %b %y',             # '20 jan 2009', '20 jan 09'
-    '%d %B %Y', '%d %B %y',             # '20 januari 2009', '20 januari 09'
+    # '%d %b %Y', '%d %b %y',             # '20 jan 2009', '20 jan 09'
+    # '%d %B %Y', '%d %B %y',             # '20 januari 2009', '20 januari 09'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',                         # '15:23:35'
@@ -24,24 +24,24 @@ TIME_INPUT_FORMATS = (
 DATETIME_INPUT_FORMATS = (
     # With time in %H:%M:%S :
     '%d-%m-%Y %H:%M:%S', '%d-%m-%y %H:%M:%S', '%Y-%m-%d %H:%M:%S',  # '20-01-2009 15:23:35', '20-01-09 15:23:35', '2009-01-20 15:23:35'
-    '%d %b %Y %H:%M:%S', '%d %b %y %H:%M:%S',   # '20 jan 2009 15:23:35', '20 jan 09 15:23:35'
-    '%d %B %Y %H:%M:%S', '%d %B %y %H:%M:%S',   # '20 januari 2009 15:23:35', '20 januari 2009 15:23:35'
+    # '%d %b %Y %H:%M:%S', '%d %b %y %H:%M:%S',   # '20 jan 2009 15:23:35', '20 jan 09 15:23:35'
+    # '%d %B %Y %H:%M:%S', '%d %B %y %H:%M:%S',   # '20 januari 2009 15:23:35', '20 januari 2009 15:23:35'
     # With time in %H.%M:%S :
     '%d-%m-%Y %H.%M:%S', '%d-%m-%y %H.%M:%S',   # '20-01-2009 15.23:35', '20-01-09 15.23:35'
-    '%d %b %Y %H.%M:%S', '%d %b %y %H.%M:%S',   # '20 jan 2009 15.23:35', '20 jan 09 15.23:35'
-    '%d %B %Y %H.%M:%S', '%d %B %y %H.%M:%S',   # '20 januari 2009 15.23:35', '20 januari 2009 15.23:35'
+    # '%d %b %Y %H.%M:%S', '%d %b %y %H.%M:%S',   # '20 jan 2009 15.23:35', '20 jan 09 15.23:35'
+    # '%d %B %Y %H.%M:%S', '%d %B %y %H.%M:%S',   # '20 januari 2009 15.23:35', '20 januari 2009 15.23:35'
     # With time in %H:%M :
     '%d-%m-%Y %H:%M', '%d-%m-%y %H:%M', '%Y-%m-%d %H:%M',   # '20-01-2009 15:23', '20-01-09 15:23', '2009-01-20 15:23'
-    '%d %b %Y %H:%M', '%d %b %y %H:%M',         # '20 jan 2009 15:23', '20 jan 09 15:23'
-    '%d %B %Y %H:%M', '%d %B %y %H:%M',         # '20 januari 2009 15:23', '20 januari 2009 15:23'
+    # '%d %b %Y %H:%M', '%d %b %y %H:%M',         # '20 jan 2009 15:23', '20 jan 09 15:23'
+    # '%d %B %Y %H:%M', '%d %B %y %H:%M',         # '20 januari 2009 15:23', '20 januari 2009 15:23'
     # With time in %H.%M :
     '%d-%m-%Y %H.%M', '%d-%m-%y %H.%M',         # '20-01-2009 15.23', '20-01-09 15.23'
-    '%d %b %Y %H.%M', '%d %b %y %H.%M',         # '20 jan 2009 15.23', '20 jan 09 15.23'
-    '%d %B %Y %H.%M', '%d %B %y %H.%M',         # '20 januari 2009 15.23', '20 januari 2009 15.23'
+    # '%d %b %Y %H.%M', '%d %b %y %H.%M',         # '20 jan 2009 15.23', '20 jan 09 15.23'
+    # '%d %B %Y %H.%M', '%d %B %y %H.%M',         # '20 januari 2009 15.23', '20 januari 2009 15.23'
     # Without time :
     '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d',         # '20-01-2009', '20-01-09', '2009-01-20'
-    '%d %b %Y', '%d %b %y',                     # '20 jan 2009', '20 jan 09'
-    '%d %B %Y', '%d %B %y',                     # '20 januari 2009', '20 januari 2009'
+    # '%d %b %Y', '%d %b %y',                     # '20 jan 2009', '20 jan 09'
+    # '%d %B %Y', '%d %B %y',                     # '20 januari 2009', '20 januari 2009'
 )
 DECIMAL_SEPARATOR = ','
 THOUSAND_SEPARATOR = '.'
diff --git a/django/conf/locale/no/formats.py b/django/conf/locale/no/formats.py
index 0ebf629d9c..fbc6142e72 100644
--- a/django/conf/locale/no/formats.py
+++ b/django/conf/locale/no/formats.py
@@ -8,10 +8,10 @@ SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
 FIRST_DAY_OF_WEEK = 1 # Monday
 DATE_INPUT_FORMATS = (
     '%Y-%m-%d', '%j.%m.%Y', '%j.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
-    '%Y-%m-%j',                         # '2006-10-25', 
-    '%j. %b %Y', '%j %b %Y',            # '25. okt 2006', '25 okt 2006'
-    '%j. %b. %Y', '%j %b. %Y',          # '25. okt. 2006', '25 okt. 2006'
-    '%j. %B %Y', '%j %B %Y',            # '25. oktober 2006', '25 oktober 2006'
+    '%Y-%m-%j',                         # '2006-10-25',
+    # '%j. %b %Y', '%j %b %Y',            # '25. okt 2006', '25 okt 2006'
+    # '%j. %b. %Y', '%j %b. %Y',          # '25. okt. 2006', '25 okt. 2006'
+    # '%j. %B %Y', '%j %B %Y',            # '25. oktober 2006', '25 oktober 2006'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',     # '14:30:59'
diff --git a/django/conf/locale/pt_BR/formats.py b/django/conf/locale/pt_BR/formats.py
index f30d5c4dfc..545ef5b187 100644
--- a/django/conf/locale/pt_BR/formats.py
+++ b/django/conf/locale/pt_BR/formats.py
@@ -12,8 +12,8 @@ SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
 FIRST_DAY_OF_WEEK = 0  # Sunday
 DATE_INPUT_FORMATS = (
     '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
-    '%d de %b de %Y', '%d de %b, %Y',   # '25 de Out de 2006', '25 Out, 2006'
-    '%d de %B de %Y', '%d de %B, %Y',   # '25 de Outubro de 2006', '25 de Outubro, 2006'
+    # '%d de %b de %Y', '%d de %b, %Y',   # '25 de Out de 2006', '25 Out, 2006'
+    # '%d de %B de %Y', '%d de %B, %Y',   # '25 de Outubro de 2006', '25 de Outubro, 2006'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',     # '14:30:59'
diff --git a/django/conf/locale/sr/formats.py b/django/conf/locale/sr/formats.py
index 6dc19cf788..63a20f4574 100644
--- a/django/conf/locale/sr/formats.py
+++ b/django/conf/locale/sr/formats.py
@@ -14,9 +14,9 @@ DATE_INPUT_FORMATS = (
     '%Y-%m-%d',                     # '2006-10-25'
     '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
     '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
-    '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
-    '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
-    '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
+    # '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
+    # '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
+    # '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',     # '14:30:59'
diff --git a/django/conf/locale/sr_Latn/formats.py b/django/conf/locale/sr_Latn/formats.py
index 6dc19cf788..63a20f4574 100644
--- a/django/conf/locale/sr_Latn/formats.py
+++ b/django/conf/locale/sr_Latn/formats.py
@@ -14,9 +14,9 @@ DATE_INPUT_FORMATS = (
     '%Y-%m-%d',                     # '2006-10-25'
     '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
     '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
-    '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
-    '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
-    '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
+    # '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
+    # '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
+    # '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
 )
 TIME_INPUT_FORMATS = (
     '%H:%M:%S',     # '14:30:59'
diff --git a/docs/topics/i18n/localization.txt b/docs/topics/i18n/localization.txt
index 8e1beaef46..91c771f610 100644
--- a/docs/topics/i18n/localization.txt
+++ b/docs/topics/i18n/localization.txt
@@ -265,8 +265,14 @@ current locale.
 
 Django will also use localized formats when parsing data in forms. That means
 Django uses different formats for different locales when guessing the format
-used by the user when inputting data on forms. Note that Django uses different
-formats for displaying data, and for parsing it.
+used by the user when inputting data on forms.
+
+.. note::
+    Django uses different formats for displaying data to those it uses for
+    parsing data. Most notably, the formats for parsing dates can't use the
+    ``%a`` (abbreviated weekday name), ``%A`` (full weekday name),
+    ``%b`` (abbreviated month name), ``%B`` (full month name),
+    or ``%p`` (AM/PM).
 
 To enable a form field to localize input and output data simply use its
 ``localize`` argument::