hacknight
hacknight copied to clipboard
189
Fixed #189 . This error was due double parsing of time field, one during form rendering and another in template filter.
Time should always be stored in UTC. From this patch it appears time is not being stored in UTC.
Somewhere we went wrong, I think we should create new column for datetime timezone field to store timezone and convert the datetime to UTC. While displaying convert UTC to respective timezone. Alembic migration need to address existing data. Does that sound right ?
Dates should always be stored in UTC. We used to do that earlier. Can you look at current data in db?
Kiran
Kiran Jonnalagadda +91-99452-35123 http://hasgeek.com/
(Sent from my phone) On May 8, 2013 10:01 AM, "kracekumar" [email protected] wrote:
Somewhere we went wrong, I think we should create new column for datetime timezone field to store timezone and convert the datetime to UTC. While displaying convert UTC to respective timezone. Alembic migration need to address existing data. Does that sound right ?
— Reply to this email directly or view it on GitHubhttps://github.com/hasgeek/hacknight/pull/191#issuecomment-17586101 .
I looked into DB.
jsFoo 2012 hacknight start time is 12.00PM (http://hacknight.in/jsfoo/2012#/participants).
DB Value 2012-10-13 06:30:00
, IST is + 5.30 UTC. While editing the form start datetime is 2012-10-13 6:30am
.
Same for other events.
What user enters is not what user sees. Looking into the commits of coaster
and Hacknight
So the form edit isn't setting timezone. You have to set form.start_datetime.timezone = app.config['TIMEZONE']
in the view (similarly for end_datetime
).
Yes, /edit
endpoint needs a fix. /new
also faces same issue. This is because https://github.com/hasgeek/baseframe/blob/master/baseframe/forms.py#L188 fails. Assigning timezone
value to form doesn't work. One way to solve the issue is to have validate_start_datetime
.
Now datetime
is displayed properly.