You’re not receiving notifications from this thread.
Forum Series Part 7: Time Zones using the local_time Gem Discussion
strfti.me is the time zone website recommended in the video.
foragoodstrftime.com is another one to check out.
How to establish Russian?
How to use Russian lang? help
Is this the last one of the series?
Nice tutorial Chris! Could you tell me how you would use this gem in a rails form where the date is selected? So let's say I wanna see and choose the datetime in PST in the form (w/ datetime_select or bootstrap datetimepicker), but wanna have it saved to db in UTC.
ActiveRecord should always save UTC to the database unless you changed that. You can set the default time_zone in Rails to be PST and keep the activerecord timezone as UTC in order to have all form submitted times process in PST and then get saved as UTC. http://stackoverflow.com/qu...
The other thing is you could add some code either to your controller or model to set the timezone of the submitted attributes. Either approach should do the trick for you. Any form datetimes that you submit have to get cast to an actual Time object in Rails in anyways so you'd just be adjusting that process.
My use case is not to ask users about their location, but automatically set timezone based on their GeoLocation. Any suggestions wrto gem out there will be really helpful ?
Hey Chris! This is great. One question: How would you go about inputting time? Lets say the user is making an event or appointment. They are presented with date/time input fields. How would you handle that if different users are in different time zones? Would that require storing a time zone on the user/account?
Looks like this question was answered below. My use case is a multi-tenant app. All the users would be in the same place. So maybe I store the time zone on the account. Wonder if there is a way to specify a dynamic time zone like you would in application.rb based on what the account has selected.
How do I add the local-time.js to my app using the local_time gem, but not using the asset pipeline? I see an option to add it using the npm package (see below) but I am not sure how this works and where to put it.
import LocalTime from "local-time"
Do you know if there's a problem with this gem and Rails 5.2? I can see the Gem is installed and in the asset pipeline.