﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35255	Inconsistent Behavior of SelectDateWidget._parse_date_fmt()	Peter-Gehlert	Sagar Sadhu	"When looking to change the format of the date in the SelectDateWidget from the default of Month, Day, Year to Day, Month, Year; all advice i found pointed to changing the DATE_FORMAT in settings.py however I discovered an error with the implementation in the widget that prevents this from changing the format as expected.

When generating the context[""widget""][""subwidgets""] in the SelectDateWidget.get_context() method, the implementation relies on the SelectDateWidget._parse_date_fmt() static method to determine the date format.

{{{
@staticmethod
def _parse_date_fmt():
    fmt = get_format(""DATE_FORMAT"")
}}}

The current implementation of _parse_date_fmt() disregards the lang and use_l10n parameters, leading to inconsistencies in date formatting. Specifically, the use_l10n parameter is always set to True by default within the get_format() function:

{{{
if use_l10n is None:
    use_l10n = True
if use_l10n and lang is None:
    lang = get_language()
}}}

This results in the function always returning the default date format as specified by the LANGUAGE_CODE setting or the language determined by USE_I18N regardless of any language or localization preferences specified elsewhere.

Expected Behavior:
The _parse_date_fmt() method should take into account the lang and use_l10n parameters to allow for language-specific and localization-aware date formatting. This would ensure that the generated date format respects the desired language and localization settings.

Recommendation:
Modify the _parse_date_fmt() method to properly handle the lang and use_l10n parameters when retrieving the date format. This can be achieved by passing these parameters to the get_format() function within the method.

{{{
@staticmethod
def _parse_date_fmt(lang=None, use_l10n=None):
    fmt = get_format(
        ""DATE_FORMAT"", 
        lang=translation.get_language(), 
        use_l10n=getattr(django.conf.settings, 'USE_L10N')
    )
}}}"	Bug	closed	Forms	5.0	Normal	invalid	SelectDateWidget Localization DATE_FORMAT	Peter-Gehlert	Unreviewed	1	0	0	0	1	0
