#3378 closed Uncategorized (wontfix)
new template filter to convert datetime from utc to other timezone
Reported by: | arvin | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | timezone, utc |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I prefer to keep all datetime as UTC in the database as convert them during display.
Attached is a filter to perform this conversion. It assumes that the input datetime
is in UTC. Unfortunately value.tzinfo is not set originally. But I'm not into DB
stuff so I don't know how to change that.
Attachments (2)
Change History (7)
by , 18 years ago
Attachment: | astimezone.py added |
---|
follow-up: 3 comment:1 by , 18 years ago
A better patch can convert from the TIME_ZONE setting to anther timezone (attached).
But as I've seen in the meantime at least Postgresql can do timezone conversions so
a much better solution would be to simply retrieve the datetime from the database in
the desired timezone. I suppose that would require a timezone setting per session/user
which I'm not up to.
comment:2 by , 18 years ago
Component: | Uncategorized → Template system |
---|---|
Needs documentation: | set |
Needs tests: | set |
Owner: | changed from | to
Summary: | new filter to convert datetime from utc to other timezone → new template filter to convert datetime from utc to other timezone |
Triage Stage: | Unreviewed → Design decision needed |
comment:3 by , 18 years ago
Replying to arvin:
But as I've seen in the meantime at least Postgresql can do timezone conversions so
a much better solution would be to simply retrieve the datetime from the database in
the desired timezone.
I'm not sure if letting the db do the timezone conversion is necessarily better, it'll be less flexible for sure. A filter seems to me like the best way to go about this.
comment:4 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This type of conversion ought to be done at the view level, not in a template tag.
comment:5 by , 13 years ago
Easy pickings: | unset |
---|---|
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
This should be resolved by #2626.
datetime convert filter