Opened 15 years ago

Closed 9 years ago

#12139 closed New feature (duplicate)

forms.fields.DateTimeField and TimeField so not accept stringified datetimes

Reported by: mattbennett Owned by: nobody
Component: Forms Version: dev
Severity: Normal Keywords: datetime, forms, datetimefield, timefield
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

When you stringify a datetime.datetime or datetime.time object, it includes fractional seconds e.g. '2009-11-03 12:21:10.800641'. The default input formats for DateTimeField and TimeField do not expect the fractional seconds part.

This is irritating when using a ModelForm and populating directly without preprocessing the datetimes, for example in a REST API where the form data is generated automatically.

Attachments (1)

datetime_time_fractional_seconds.patch (1.9 KB ) - added by mattbennett 15 years ago.

Download all attachments as: .zip

Change History (7)

by mattbennett, 15 years ago

comment:1 by Russell Keith-Magee, 14 years ago

Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 by Matthias Kestenholz, 14 years ago

This patch not only needs tests, but also other improvements. It will fall on the face with dates f.e. in german format. The stupid check for '.' in the string representation will not do the right thing with "03.11.2009 12:21:10".

comment:3 by Matt McClanahan, 13 years ago

Severity: Normal
Type: New feature

comment:4 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 by Claude Paroz, 9 years ago

Resolution: duplicate
Status: newclosed

I don't think this is a problem any longer nowadays.
See #9459/[dce278673a409a10c1f74f597035b737bbf6a017]
and #19917 [384c180e414a982a6cc5ccabc675bcfb4fd80988]

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