Opened 38 hours ago

Last modified 11 hours ago

#36145 new Bug

FIRST_DAY_OF_WEEK setting not changing the Admin calendar widget

Reported by: Phil Gyford Owned by:
Component: contrib.admin Version: 5.1
Severity: Normal Keywords:
Cc: Claude Paroz, Carlton Gibson Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The docs for the FIRST_DAY_OF_WEEK setting (https://docs.djangoproject.com/en/5.1/ref/settings/#first-day-of-week ) say:

A number representing the first day of the week. This is especially useful when displaying a calendar. This value is only used when not using format internationalization, or when a format cannot be found for the current locale.

But if I set mine to FIRST_DAY_OF_WEEK = 1 (Monday) then the calendar widgets in Admin still start on the default, Sunday.

I've tried with USE_I18N set to both True and False, with no change.

I posted this query in the Django Forum but we were stumped as to whether the documentation or the code was wrong in some way https://forum.djangoproject.com/t/django-admin-date-pickers-ignoring-first-day-of-week/38170/2

Change History (2)

comment:1 by Sarah Boyce, 30 hours ago

Cc: Claude Paroz Carlton Gibson added
Triage Stage: UnreviewedAccepted

Thank you for the ticket!

It appears that it used to be possible to update FIRST_DAY_OF_WEEK to update the admin date picker (used in django/contrib/admin/static/admin/js/calendar.js), and now this is much harder.

I don't think this is by design, and I think it's fair to say this is an unintended consequence/bug from #32873 (note that we tried to improve the docs in #35306).

It's possible a wider discussion might be needed in general for these settings (see also #35990).

comment:2 by Carlton Gibson, 11 hours ago

It appears that it used to be possible to update FIRST_DAY_OF_WEEK to update the admin date picker (used in django/contrib/admin/static/admin/js/calendar.js), and now this is much harder.

I'd need to dig in to see exactly why this is failing but it looks like this should still work... calendar.js both fetches and uses FIRST_DAY_OF_WEEK, and there are some tests (at least) in test_i18n.py that suggest it's still getting to the page. (Current status: 🤔)

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