-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting the Time Zone Dynamically #230
Comments
Good morning,
|
Thanks for the quick reply! It looks like |
What kind of zone string does your If it's something like "CST" it is very ambiguous and leads to problems like #228 Beware of not shooting yourself in the foot. |
Good point. Mine returns
|
Could you please try something in your system for me? Please set your system zone to Shangai then tell me what Thanks in advance. |
It doesn't look like it uses your local time; mine returns
I set the time zone to "Beijing," and it returned the Shanghai identifier, which makes sense since it says "Beijing Time" next to it on Wikipedia.
|
OK, how about changing the operating system zone? |
The same as above. I changed the time zone of my OS, and it still returned "UTC" because Rails defaults to UTC if you don't explicitly specify a time zone in your Rails app. |
OK. Thank you very much! |
(removed the |
I ran into the "Cannot determine timezone from nil" error and wanted to post my solution. It involves setting the
ENV['TZ']
variable, as you suggested, but I don't like to hardcode values like this, especially if your time zone changes from development to production environments. You can let Ruby get the time zone more explicitly.The text was updated successfully, but these errors were encountered: