Changes between Initial Version and Version 1 of Ticket #35255
- Timestamp:
- Feb 26, 2024, 7:04:42 AM (9 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35255 – Description
initial v1 3 3 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. 4 4 5 {{{ 5 6 @staticmethod 6 7 def _parse_date_fmt(): 7 8 fmt = get_format("DATE_FORMAT") 9 }}} 8 10 9 11 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: 10 12 13 {{{ 11 14 if use_l10n is None: 12 15 use_l10n = True 13 16 if use_l10n and lang is None: 14 17 lang = get_language() 18 }}} 15 19 16 20 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. … … 22 26 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. 23 27 24 28 {{{ 25 29 @staticmethod 26 30 def _parse_date_fmt(lang=None, use_l10n=None): … … 30 34 use_l10n=getattr(django.conf.settings, 'USE_L10N') 31 35 ) 36 }}}