How can I make my rails time input fields respect server timezone?
I have a date_select and time_select for a date/time field in my Rails
app, which I am running locally in development mode. My problem is that
the date/time I enter does not align with the timezone of the server
instance.
As an example, my computer's clock currently says it's 5:34pm on Sept. 19,
2013. (I am in Central time zone in case it has any bearing.) If I fill
out my form with values equating to "September 19, 2013 5:34 PM", I am
seeing this parsed as "2013-09-19 17:34:00 UTC". However, Time.now returns
"2013-09-19 17:38:00 -0600", and Time.current returns "2013-09-19 23:38:58
UTC". Basically, the form is assuming the time in UTC, but is not aligning
it with my server's UTC time (6 hour difference).
How can I ensure the form's inputs get converted to the proper zone offset?
No comments:
Post a Comment