Opened 14 years ago

Closed 5 years ago

#15982 closed Bug (fixed)

Lack DateTime formats in some languages

Reported by: Pablo Martín Owned by: Claude Paroz
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Lack DateTime formats in some languages.

For example in english:

DATETIME_INPUT_FORMATS = (
    '%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'
)

But in spanish, I think that it lacks this format '%d/%m/%y' :

DATETIME_INPUT_FORMATS = (
    '%d/%m/%Y %H:%M:%S',
    '%d/%m/%Y %H:%M',
    '%d/%m/%y %H:%M:%S',
    '%d/%m/%y %H:%M',
)

Attachments (1)

patchr16182_locale.diff (1.9 KB ) - added by Pablo Martín 14 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Pablo Martín, 14 years ago

Component: UncategorizedInternationalization
Type: UncategorizedBug

by Pablo Martín, 14 years ago

Attachment: patchr16182_locale.diff added

comment:2 by Aymeric Augustin, 14 years ago

Triage Stage: UnreviewedAccepted

Indeed, there is an inconsistency here.

pmartin, are ca and es_* the only languages where datetime input formats do not include the date input formats?

More generally, wouldn't it be a good idea to consider any valid date input format and a valid datetime_input_format, and remove a lot of copy-paste from the formats.py files?

comment:3 by Pablo Martín, 14 years ago

It is possible that the formats could be grouped. But this is not the scope of the ticket. It's a little change to fix a bug.

Also it would also be difficult to overwrite

comment:4 by Marc Garcia, 13 years ago

Needs tests: set
UI/UX: unset

I assume that the English locale approach of allowing date formats to datetime fields is the right one. Then, I think it makes more sense what aaugustin says, of getting rid of the date formats in the datetime settings, and change the code to allow this.

My only concern is that if there is a side case, where order can matter. Formats are checked in order, and testing first the datetime ones, and then the date ones, won't let a locale to specify the exact order.

comment:5 by Claude Paroz, 5 years ago

Needs tests: unset
Version: 1.3master

comment:6 by Mariusz Felisiak, 5 years ago

Owner: changed from nobody to Claude Paroz
Status: newassigned

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 188b0030:

Fixed #15982 -- Added DATE_INPUT_FORMATS to forms.DateTimeField default input formats.

Note: See TracTickets for help on using tickets.
Back to Top