Skip to content

Commit

Permalink
handling timezone with offset
Browse files Browse the repository at this point in the history
  • Loading branch information
merencia committed Sep 6, 2018
0 parents commit a67968a
Show file tree
Hide file tree
Showing 9 changed files with 2,762 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

# Created by https://www.gitignore.io/api/node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless


# End of https://www.gitignore.io/api/node
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "tzinfo"
gem "tzinfo-data"
gem "activesupport"
28 changes: 28 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
concurrent-ruby (1.0.5)
i18n (1.1.0)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2018.5)
tzinfo (>= 1.0.0)

PLATFORMS
ruby

DEPENDENCIES
activesupport
tzinfo
tzinfo-data

BUNDLED WITH
1.16.2
8 changes: 8 additions & 0 deletions generate.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'active_support/all'

zones = Hash.new
timezones = ActiveSupport::TimeZone.all.each { |tz|
zones[tz.tzinfo.name] = tz.utc_offset / 60 * -1
}

File.open("offsets.json", 'w') { |file| file.write(zones.to_json) }
1 change: 1 addition & 0 deletions generated/offsets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Etc/GMT+12":720,"Pacific/Pago_Pago":660,"Pacific/Midway":660,"Pacific/Honolulu":600,"America/Juneau":540,"America/Los_Angeles":480,"America/Tijuana":480,"America/Phoenix":420,"America/Chihuahua":420,"America/Mazatlan":420,"America/Denver":420,"America/Guatemala":360,"America/Chicago":360,"America/Mexico_City":360,"America/Monterrey":360,"America/Regina":360,"America/Bogota":300,"America/New_York":300,"America/Indiana/Indianapolis":300,"America/Lima":300,"America/Halifax":240,"America/Caracas":240,"America/Guyana":240,"America/La_Paz":240,"America/Puerto_Rico":240,"America/Santiago":240,"America/St_Johns":210,"America/Sao_Paulo":180,"America/Argentina/Buenos_Aires":180,"America/Godthab":180,"America/Montevideo":180,"Atlantic/South_Georgia":120,"Atlantic/Azores":60,"Atlantic/Cape_Verde":60,"Africa/Casablanca":0,"Europe/London":0,"Europe/Lisbon":0,"Africa/Monrovia":0,"Etc/UTC":0,"Europe/Amsterdam":-60,"Europe/Belgrade":-60,"Europe/Berlin":-60,"Europe/Zurich":-60,"Europe/Bratislava":-60,"Europe/Brussels":-60,"Europe/Budapest":-60,"Europe/Copenhagen":-60,"Europe/Dublin":-60,"Europe/Ljubljana":-60,"Europe/Madrid":-60,"Europe/Paris":-60,"Europe/Prague":-60,"Europe/Rome":-60,"Europe/Sarajevo":-60,"Europe/Skopje":-60,"Europe/Stockholm":-60,"Europe/Vienna":-60,"Europe/Warsaw":-60,"Africa/Algiers":-60,"Europe/Zagreb":-60,"Europe/Athens":-120,"Europe/Bucharest":-120,"Africa/Cairo":-120,"Africa/Harare":-120,"Europe/Helsinki":-120,"Asia/Jerusalem":-120,"Europe/Kaliningrad":-120,"Europe/Kiev":-120,"Africa/Johannesburg":-120,"Europe/Riga":-120,"Europe/Sofia":-120,"Europe/Tallinn":-120,"Europe/Vilnius":-120,"Asia/Baghdad":-180,"Europe/Istanbul":-180,"Asia/Kuwait":-180,"Europe/Minsk":-180,"Europe/Moscow":-180,"Africa/Nairobi":-180,"Asia/Riyadh":-180,"Europe/Volgograd":-180,"Asia/Tehran":-210,"Asia/Muscat":-240,"Asia/Baku":-240,"Europe/Samara":-240,"Asia/Tbilisi":-240,"Asia/Yerevan":-240,"Asia/Kabul":-270,"Asia/Yekaterinburg":-300,"Asia/Karachi":-300,"Asia/Tashkent":-300,"Asia/Kolkata":-330,"Asia/Colombo":-330,"Asia/Kathmandu":-345,"Asia/Almaty":-360,"Asia/Dhaka":-360,"Asia/Urumqi":-360,"Asia/Rangoon":-390,"Asia/Bangkok":-420,"Asia/Jakarta":-420,"Asia/Krasnoyarsk":-420,"Asia/Novosibirsk":-420,"Asia/Shanghai":-480,"Asia/Chongqing":-480,"Asia/Hong_Kong":-480,"Asia/Irkutsk":-480,"Asia/Kuala_Lumpur":-480,"Australia/Perth":-480,"Asia/Singapore":-480,"Asia/Taipei":-480,"Asia/Ulaanbaatar":-480,"Asia/Tokyo":-540,"Asia/Seoul":-540,"Asia/Yakutsk":-540,"Australia/Adelaide":-570,"Australia/Darwin":-570,"Australia/Brisbane":-600,"Australia/Melbourne":-600,"Pacific/Guam":-600,"Australia/Hobart":-600,"Pacific/Port_Moresby":-600,"Australia/Sydney":-600,"Asia/Vladivostok":-600,"Asia/Magadan":-660,"Pacific/Noumea":-660,"Pacific/Guadalcanal":-660,"Asia/Srednekolymsk":-660,"Pacific/Auckland":-720,"Pacific/Fiji":-720,"Asia/Kamchatka":-720,"Pacific/Majuro":-720,"Pacific/Chatham":-765,"Pacific/Tongatapu":-780,"Pacific/Apia":-780,"Pacific/Fakaofo":-780}
Loading

0 comments on commit a67968a

Please sign in to comment.