Opened 7 years ago

Closed 7 years ago

#10318 closed (duplicate)

Template filter date format "U" produces a timestamp that is off by 10-14 days

Reported by: seanbrant Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When trying to format a date in a template with {{ mydate|date:"U" }} the timestamp is off. Attached is a test case that first created a datetime object based on now then renders that in a template with the format "U" and compares that to outputting the date in python with strftime('%s'), this test fails. The next test outputs the date with the format "Y-m-d H:i:s" and compares that to outputting the date in python with strftime(%F %T), this test passes. So it seems that only "U" is broken.

Attachments (1)

tests.py (614 bytes) - added by seanbrant 7 years ago.
Test case

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by seanbrant

Test case

comment:1 Changed 7 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

We've already got #9850 reporting the docs/code mismatch here. We can use the one ticket for fixing the code, if the decision is to document this formatter and make it work properly.

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