Closed bmihelac closed 10 years ago
Hi Bojan,
I think that's a valid concern and since a decission was already made in #27 I'm all in on only outputting the iso format for DateInput
, DateTimeInput
, and TimeInput
. I would allow one exception, which is if the user passes in the format
argument into the widget's __init__
method.
Just to confirm this that I'm on the same page: floppyforms already used to output only the ISO formats, but Django changed the semantics (the position of the ISO format) of django.utils.formats.get_format
a bit so that we need to catch up with this development, right?
If that's the case we should go for a fix on this. However I'm quite short with time at the moment (in that regard, sorry for the delay till I responded on this issue), I would really appreciate if you could make the first step there and implement a draft as a pull request.
At best it would include some tests and even some documentation on this. But if that's too much to ask for it would even be already a big help if you could document down what changes you think are needed to resolve this ticket.
Gregor,
Just to confirm this that I'm on the same page: floppyforms already used to output only the ISO formats, but Django changed the semantics (the position of the ISO format) of django.utils.formats.get_format a bit so that we need to catch up with this development, right?
Yes, django has changed position of ISO format, but before that change, some locales did not include an ISO format at all (https://code.djangoproject.com/ticket/19015).
Also it is not guaranteed that ISO format would be on first (or last) position for given locale, so it should be better to hardcore iso format instead of relying on its position in DATE_INPUT_FORMATS
.
I would prepare pull request for this so we can discuss this further.
I agree, explicitly using the ISO format would be good here. Thanks so much for taking your effort on this and preparing a pull request!
Gregor, sorry for delay, here is pull request.
Fixed as with #124
FYI: I just released floppyforms 1.3 including your changes.
Implementation of
DateInput
widget should render hardcoded "%Y-%m-%d" format.DateInput
andDateTimeInput
both uses first available format which is often not required "%Y-%m-%d" format. (https://github.com/gregmuellegger/django-floppyforms/blob/master/floppyforms/widgets.py#L279)This renders date input as empty in browsers that support date html5 type, requiring user to enter date again:
That in chrome renders as "dd/mm/yyyy" instead of "10/07/2014", client validation will not allow form to submit if it is required field and would set field to None if it is not required field, thus loosing information.
I propose that
DateInput
widget always render value in rfc3339 format.Reference: https://github.com/gregmuellegger/django-floppyforms/issues/27