Changes between Initial Version and Version 1 of Ticket #35255


Ignore:
Timestamp:
Feb 26, 2024, 7:04:42 AM (9 months ago)
Author:
David Sanders
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35255 – Description

    initial v1  
    33When 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.
    44
     5{{{
    56@staticmethod
    67def _parse_date_fmt():
    78    fmt = get_format("DATE_FORMAT")
     9}}}
    810
    911The 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:
    1012
     13{{{
    1114if use_l10n is None:
    1215    use_l10n = True
    1316if use_l10n and lang is None:
    1417    lang = get_language()
     18}}}
    1519
    1620This 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.
     
    2226Modify 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.
    2327
    24 
     28{{{
    2529@staticmethod
    2630def _parse_date_fmt(lang=None, use_l10n=None):
     
    3034        use_l10n=getattr(django.conf.settings, 'USE_L10N')
    3135    )
     36}}}
Back to Top