Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#29109 closed Bug (fixed)

`undefined` show in auto-generated datetime/time input in admin form for Thai locale

Reported by: Napat Charoenlarpkul Owned by: Manatsawin Hanmongkolchai
Component: Internationalization Version: 1.11
Severity: Normal Keywords: form datetime thai locale
Cc: manatsawin@…, Manatsawin Hanmongkolchai Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found wrong datetime format order in django/conf/locale/th/formats.py

In TIME_INPUT_FORMATS and DATETIME_INPUT_FORMATS, the first order should be
'%H:%M:%S', # 14:30:59 and '%d/%m/%Y %H:%M:%S', # 25/10/2006 14:30:59

The final code should be like this

TIME_INPUT_FORMATS = [
    '%H:%M:%S',  # 14:30:59
    '%H:%M:%S.%f',  # 14:30:59.000200
    '%H:%M',  # 14:30
]
DATETIME_INPUT_FORMATS = [
    '%d/%m/%Y %H:%M:%S',  # 25/10/2006 14:30:59
    '%d/%m/%Y %H:%M:%S.%f',  # 25/10/2006 14:30:59.000200
    '%d/%m/%Y %H:%M',  # 25/10/2006 14:30
]

Change History (5)

comment:1 by Manatsawin Hanmongkolchai, 7 years ago

Has patch: set

The submitter discussed with me (last editor of the file) via email. Apparently, DateTimeShortcut.js does not support %f and so prioritizing those formats break admin functionalities.

https://github.com/django/django/pull/9656

comment:2 by Manatsawin Hanmongkolchai, 7 years ago

Cc: Manatsawin Hanmongkolchai added
Owner: changed from nobody to Manatsawin Hanmongkolchai
Status: newassigned

comment:3 by Tim Graham, 7 years ago

Needs tests: set
Summary: `undefined` show in auto generated datetime input or time input in form when using locale as `th``undefined` show in auto-generated datetime/time input in admin form for Thai locale
Triage Stage: UnreviewedAccepted

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 1a1264f1:

Fixed #29109 -- Fixed the admin time picker widget for the Thai locale.

comment:5 by Tim Graham <timograham@…>, 7 years ago

In a1286b5a:

[2.0.x] Fixed #29109 -- Fixed the admin time picker widget for the Thai locale.

Backport of 1a1264f1494976c562c7cb832fe47f3e1e765b8f from master

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