hacknight icon indicating copy to clipboard operation
hacknight copied to clipboard

189

Open kracekumar opened this issue 11 years ago • 7 comments

Fixed #189 . This error was due double parsing of time field, one during form rendering and another in template filter.

kracekumar avatar May 07 '13 20:05 kracekumar

Time should always be stored in UTC. From this patch it appears time is not being stored in UTC.

jace avatar May 08 '13 01:05 jace

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 ?

kracekumar avatar May 08 '13 04:05 kracekumar

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 .

jace avatar May 08 '13 06:05 jace

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

kracekumar avatar May 08 '13 07:05 kracekumar

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).

jace avatar May 08 '13 09:05 jace

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.

kracekumar avatar May 08 '13 12:05 kracekumar

Now datetime is displayed properly.

kracekumar avatar May 09 '13 10:05 kracekumar