Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#25758 closed Bug (fixed)

Date filter doesn't use internationalization when USE_L10N is True

Reported by: Ali Lozano Owned by: nobody
Component: Template system Version: 1.8
Severity: Normal Keywords: date, format, internationalization
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Date filter uses settings.DATE_FORMAT by default to format dates, and ignore if django is using internationalization and USE_L10N is True

{{ user.date_joined|date }}

Always format with N j, Y

Maybe this is no a problem because date filter uses to use with a arg, but naturalday filter(of humanize) uses date filter to format dates.

Change History (10)

comment:2 by Tim Graham, 9 years ago

Could you please add a test to demonstrate what this fixes?

comment:3 by Tim Graham, 9 years ago

Has patch: set
Needs tests: set
Triage Stage: UnreviewedAccepted

I'll accept the ticket since no tests fail if that line from the pull request is removed (same with if arg is None: arg = settings.TIME_FORMAT in the time filter, but we still need a test to show what this fixes.

comment:4 by Claude Paroz, 9 years ago

Needs tests: unset

New PR with tests (and including the time filter).

comment:5 by Tim Graham, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Claude Paroz <claude@…>, 9 years ago

Resolution: fixed
Status: newclosed

In be9bd334:

Fixed #25758 -- Defaulted to current language FORMATs in date/time filters

Thanks Ali Lozano for the report and the initial patch, and Tim Graham for
the review.

comment:7 by Tim Graham, 8 years ago

It looks like this changed a documented behavior, see #27981.

comment:8 by Tim Graham <timograham@…>, 8 years ago

In 6585ebe:

Fixed #27981 -- Doc'd date/time filter l10n changes in refs #25758.

comment:9 by Tim Graham <timograham@…>, 8 years ago

In 28cf32b:

[1.11.x] Fixed #27981 -- Doc'd date/time filter l10n changes in refs #25758.

Backport of 6585ebebaaa58aeef45210a3119dbaa322f8baca from master

comment:10 by Tim Graham <timograham@…>, 8 years ago

In 16b97a2:

[1.10.x] Fixed #27981 -- Doc'd date/time filter l10n changes in refs #25758.

Backport of 6585ebebaaa58aeef45210a3119dbaa322f8baca from master

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