Opened 5 years ago

Last modified 5 years ago

#15982 new Bug

Lack DateTime formats in some languages

Reported by: Pablo Martín Owned by: nobody
Component: Internationalization Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes 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 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by Pablo Martín

Component: UncategorizedInternationalization
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Type: UncategorizedBug

Changed 5 years ago by Pablo Martín

Attachment: patchr16182_locale.diff added

comment:2 Changed 5 years ago by Aymeric Augustin

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 Changed 5 years ago by Pablo Martín

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 Changed 5 years ago by Marc Garcia

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.

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