Ask A Question


You’re not receiving notifications from this thread.

Getting Simple Calendar to show local date and time

Jeff Wolfram asked in Rails
I have been using your Simple Calendar gem and it is all working great. The only problem is I can not figure out how to fix the date and time so it will show everything in local date and time. Right now, I am in California and it switched the date at 4pm on the month calendar. I know that is because the server is a time that is 8 hours ahead. Where should I make the changes in the calendar to display the time and date correctly? Any help would be much appreciated. 
Hey Jeff,

You want to either use the local_time gem to handle this client side or simply set the to the user's timezone for every request. 

For the second option, you have to save the timezone on their database record so you can retrieve it and set it every time. 

local_time's a lot simpler as it just checks the browser's timezone and converts all the times using JS.
Thanks for the super speedy response Chris. Before I wrote you, I changed the time zone in my app and also on the heroku server. The weird thing is it took all my existing date entries and moved them one day forward but when you pull the data entry up and check the date, it is still set for the next day. When you look to see what date the calendar says, that is correct. It was just all the data that moved. 
I want to try this gem but I am just confused on how to configure it with the simple_calendar month view. 

Hey Jeff,

I'm having the same issues with the calendar moving the current date a day forward.
Did you figure this out?



I just wrote a migration that went though the dates and changed them to the day before.


Sounds good, thanks for the response.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,038+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.