Opened 15 years ago

Closed 15 years ago

#10318 closed (duplicate)

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

Reported by: Sean Brant 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: no UI/UX: no

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 Sean Brant 15 years ago.
Test case

Download all attachments as: .zip

Change History (2)

by Sean Brant, 15 years ago

Attachment: tests.py added

Test case

comment:1 by Karen Tracey, 15 years ago

Resolution: duplicate
Status: newclosed

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