whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: replace broken timezone workaround with tzinfo
Date Wed, 16 Oct 2019 22:42:40 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new a66231e  replace broken timezone workaround with tzinfo
a66231e is described below

commit a66231e5ca4abfeb35af46a67bdf934379535bb3
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Wed Oct 16 18:41:38 2019 -0400

    replace broken timezone workaround with tzinfo
---
 www/board/agenda/main.rb                      | 1 +
 www/board/agenda/views/actions/minute.json.rb | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/www/board/agenda/main.rb b/www/board/agenda/main.rb
index 5e4244d..1cb10c6 100755
--- a/www/board/agenda/main.rb
+++ b/www/board/agenda/main.rb
@@ -23,6 +23,7 @@ require 'shellwords'
 require 'mail'
 require 'open-uri'
 require 'erubis'
+require 'tzinfo'
 
 unless ENV['RACK_ENV'] == 'development'
   disable :logging # suppress log of requests to stderr/error.log
diff --git a/www/board/agenda/views/actions/minute.json.rb b/www/board/agenda/views/actions/minute.json.rb
index 8d84494..98c6f7f 100644
--- a/www/board/agenda/views/actions/minute.json.rb
+++ b/www/board/agenda/views/actions/minute.json.rb
@@ -16,12 +16,8 @@ if @action == 'timestamp'
 
   timestamp = Time.now
 
-  # date = @agenda[/\d+_\d+_\d+/].gsub('_', '-')
-  # zone = Time.parse("#{date} PST").dst? ? '-07:00' : '-08:00'
-  # workaround for broken tzinfo on whimsy
-  month = @agenda[/\d+_(\d+)_\d+/, 1].to_i
-  zone = ((2..9).include? month) ? '-07:00' : '-08:00'
-  @text = timestamp.getlocal(zone).strftime('%-l:%M')
+  tz = TZInfo::Timezone.get('America/Los_Angeles')
+  @text = tz.to_local(timestamp).strftime('%-l:%M')
 
   if @title == 'Call to order'
     minutes['started']  = timestamp.gmtime.to_f * 1000


Mime
View raw message