add full IANA time zone support
This commit is contained in:
@ -315,7 +315,11 @@ class ApplicationController < ActionController::Base
|
||||
# set timezone correctly
|
||||
def set_time_zone
|
||||
if params[:timezone].present?
|
||||
Time.zone = ActiveSupport::TimeZone::MAPPING.key(params[:timezone])
|
||||
begin
|
||||
Time.zone = TZInfo::Timezone.get(params[:timezone])
|
||||
rescue
|
||||
Time.zone = 'UTC'
|
||||
end
|
||||
elsif params[:offset].present?
|
||||
Time.zone = set_timezone_from_offset(params[:offset])
|
||||
elsif current_user.present?
|
||||
|
@ -39,6 +39,9 @@
|
||||
<br><br>
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/9/fields/1/last.json?timezone=<span class="customcode">America%2FNew_York</span></span></pre>
|
||||
<br>
|
||||
The most common time zone identifiers are listed below. ThingSpeak supports all <a href="http://www.iana.org/time-zones" target="_blank">IANA Time Zone Database</a>
|
||||
identifers; a <a href="http://twiki.org/cgi-bin/xtra/tzdatepick.html" target="_blank">human-readable list</a> is also available.
|
||||
<br><br>
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>Identifier</th>
|
||||
|
Reference in New Issue
Block a user