Hi Carlton, Here we go: https://github.com/django/django/pull/15806 Just a draft for now, tried on a local Django project with a test model using Date, Time and DateTime fields.
I'm thinking to backward compatibility for custom admin templates, any thoughts? Thanks Denny On Wednesday, June 29, 2022 at 10:20:43 AM UTC+2 carlton...@gmail.com wrote: > Hey Denny. > > Thanks for looking at this! > > > My idea was to change... > > Can I get you to put that into a (draft) PR on GitHub? It's much easier to > think about with code in hand. :) > > Kind Regards, > > Carlton > > On Tuesday, 28 June 2022 at 18:47:57 UTC+2 denny.b...@gmail.com wrote: > >> Hi everyone, >> >> I just arrived on this topic searching for ideas about improving the >> admin datetime format. >> I noticed that datetime values are passed between to/from the admin form >> using the format defined in settings, but as you mentioned, this could be a >> problem when users from different timezones are using the admin interface. >> >> I'd like to contribute to this, and I can suggest to use an iso format >> (used in input type "date", "datetime-local" and "time") to pass data, so >> all formatting problems can be avoided. >> >> My idea was to change the `localize_input` function to return >> `value.isoformat()` when `isinstance(value, (datetime.datetime, >> datetime.date, datetime.time))`. >> After this we can customize the attrs of `AdminDateWidget`, >> `AdminTimeWidget` (and eventually add a `AdminDateTimeWidget`) >> passing the correct input type (`date`, `time` or `datetime-local`). >> >> Any other idea? >> On Tuesday, October 12, 2021 at 3:22:41 PM UTC+2 carlton...@gmail.com >> wrote: >> >>> Thank you all, yes — there's some good points there. (Some others raised >>> on the PR and the ticket too.) >>> >>> It's looks like there are still some caveats, and describing those >>> succinctly remains to do. >>> 👍 >>> >>> Kind Regards, >>> >>> Carlton >>> >>> >>> On Wednesday, 29 September 2021 at 21:13:51 UTC+2 Tobias Bengfort wrote: >>> >>>> > Back then there were various issues with localisation when **not** >>>> using type=text. >>>> >>>> As https://code.djangoproject.com/ticket/16630#comment:11 states: the >>>> inputs only accept a special format. To make it work I had to >>>> explicitly >>>> set the format: `DateInput(format='%Y-%m-%d', attrs={'type': 'date'}`. >>>> >>>> Another thing to be aware of: The native date picker UI uses the >>>> system/browser locale, not the one that is used on the page. (See also >>>> https://bugs.chromium.org/p/chromium/issues/detail?id=263320) >>>> >>>> Hope that helps >>>> >>>> tobias >>>> >>> -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/59eeae49-9670-4276-8543-fa93e85a86b0n%40googlegroups.com.