neeto_time_zones 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/data/pacific.json ADDED
@@ -0,0 +1,134 @@
1
+ [
2
+ {
3
+ "utc": [
4
+ "Etc/GMT+11",
5
+ "Pacific/Midway",
6
+ "Pacific/Niue",
7
+ "Pacific/Pago_Pago",
8
+ "US/Samoa"
9
+ ],
10
+ "label": "Coordinated Universal Time (UTC -11)",
11
+ "keywords": "UTC-11 GMT+11 Midway Niue Pago Pago CUT Samoa",
12
+ "isDst": false,
13
+ "cities": "Midway, Pago Pago"
14
+ },
15
+ {
16
+ "utc": [
17
+ "Pacific/Apia"
18
+ ],
19
+ "label": "Samoa Standard Time",
20
+ "keywords": "Samoa Standard Time Apia SST",
21
+ "isDst": false,
22
+ "cities": "Apia"
23
+ },
24
+ {
25
+ "utc": [
26
+ "Antarctica/McMurdo",
27
+ "Pacific/Auckland",
28
+ "Antarctica/South_Pole",
29
+ "NZ"
30
+ ],
31
+ "label": "New Zealand Standard Time",
32
+ "keywords": "New Zealand Standard Time Wellington McMurdo Auckland NST South_Pole NZ",
33
+ "isDst": false,
34
+ "cities": "Auckland, Wellington, McMurdo"
35
+ },
36
+ {
37
+ "utc": [
38
+ "Pacific/Fiji"
39
+ ],
40
+ "label": "Fiji Standard Time",
41
+ "keywords": "Fiji Standard Time Fiji FST",
42
+ "isDst": false,
43
+ "cities": "Fiji"
44
+ },
45
+ {
46
+ "utc": [
47
+ "Etc/GMT-12",
48
+ "Pacific/Funafuti",
49
+ "Pacific/Kwajalein",
50
+ "Pacific/Majuro",
51
+ "Pacific/Nauru",
52
+ "Pacific/Tarawa",
53
+ "Pacific/Wake",
54
+ "Pacific/Wallis",
55
+ "Kwajalein"
56
+ ],
57
+ "label": "Coordinated Universal Time (UTC +12)",
58
+ "keywords": "UTC+12 GMT-12 Funafuti Kwajalein Majuro Nauru Tarawa Wake Wallis CUT",
59
+ "isDst": false,
60
+ "cities": "Funafuti, Kwajalein, Majuro, Nauru, Tarawa, Wake, Wallis"
61
+ },
62
+ {
63
+ "utc": [
64
+ "Antarctica/DumontDUrville",
65
+ "Etc/GMT-10",
66
+ "Pacific/Guam",
67
+ "Pacific/Port_Moresby",
68
+ "Pacific/Saipan",
69
+ "Pacific/Chuuk",
70
+ "Pacific/Truk"
71
+ ],
72
+ "label": "West Pacific Standard Time",
73
+ "keywords": "West Pacific Standard Time DumontDUrville GMT-10 Guam Port Moresby Saipan Truk WPST Chuuk",
74
+ "isDst": false,
75
+ "cities": "DumontDUrville, Guam, Port Moresby, Saipan, Truk"
76
+ },
77
+ {
78
+ "utc": [
79
+ "Antarctica/Macquarie",
80
+ "Etc/GMT-11",
81
+ "Pacific/Efate",
82
+ "Pacific/Guadalcanal",
83
+ "Pacific/Kosrae",
84
+ "Pacific/Noumea",
85
+ "Pacific/Ponape",
86
+ "Pacific/Pohnpei"
87
+ ],
88
+ "label": "Central Pacific Standard Time",
89
+ "keywords": "Central Pacific Standard Time Macquarie GMT-11 Efate Guadalcanal Kosrae Noumea Ponape CPST Pohnpei",
90
+ "isDst": false,
91
+ "cities": "Macquarie, Efate, Guadalcanal, Kosrae, Noumea, Ponape"
92
+ },
93
+ {
94
+ "utc": [
95
+ "Etc/GMT-13",
96
+ "Pacific/Kanton",
97
+ "Pacific/Enderbury",
98
+ "Pacific/Fakaofo",
99
+ "Pacific/Tongatapu"
100
+ ],
101
+ "label": "Tonga Standard Time",
102
+ "keywords": "Tonga Standard Time GMT-13 Enderbury Fakaofo Tongatapu TST Kanton",
103
+ "isDst": false,
104
+ "cities": "Enderbury, Fakaofo, Tongatapu"
105
+ },
106
+ {
107
+ "utc": [
108
+ "Etc/GMT+12"
109
+ ],
110
+ "label": "International Date Line West",
111
+ "keywords": "Dateline Standard Time GMT+12 IDLW",
112
+ "isDst": false,
113
+ "cities": ""
114
+ },
115
+ {
116
+ "utc": [
117
+ "Pacific/Easter",
118
+ "Chile/EasterIsland"
119
+ ],
120
+ "label": "Easter Island Standard Time",
121
+ "keywords": "Easter Island Standard Time Pacific Easter Chile EasterIsland EIST",
122
+ "isDst": false,
123
+ "cities": ""
124
+ },
125
+ {
126
+ "utc": [
127
+ "Pacific/Chatham"
128
+ ],
129
+ "label": "Chatham Standard Time",
130
+ "keywords": "Chatham Standard Time Pacific Chatham CST NZ-CHAT",
131
+ "isDst": false,
132
+ "cities": ""
133
+ }
134
+ ]
@@ -0,0 +1,144 @@
1
+ [
2
+ {
3
+ "utc": [
4
+ "America/Los_Angeles",
5
+ "America/Tijuana",
6
+ "Mexico/BajaNorte",
7
+ "America/Vancouver",
8
+ "Canada/Pacific",
9
+ "US/Pacific",
10
+ "PST8PDT"
11
+ ],
12
+ "label": "Pacific Standard Time",
13
+ "keywords": "Pacific Standard Time PST8PDT PST California Las Vegas Los Angeles Nevada Palm Springs San Diego San Francisco Tijuana Vancouver Washington BajaNorte",
14
+ "isDst": true,
15
+ "cities": "California, Las Vegas, Los Angeles, Nevada, Palm Springs, San Diego, San Francisco, Tijuana, BajaNorte, Vancouver, Washington"
16
+ },
17
+ {
18
+ "utc": [
19
+ "America/Creston",
20
+ "America/Dawson",
21
+ "America/Dawson_Creek",
22
+ "America/Hermosillo",
23
+ "America/Phoenix",
24
+ "US/Arizona",
25
+ "America/Whitehorse",
26
+ "Canada/Yukon",
27
+ "Etc/GMT+7"
28
+ ],
29
+ "label": "Mountain Time",
30
+ "keywords": "US Mountain Standard Time GMT+7 MT MST Creston Dawson Creek Hermosillo Phoenix Whitehorse Yukon Arizona",
31
+ "isDst": false,
32
+ "cities": "Creston, Dawson, Dawson Creek, Hermosillo, Phoenix, Whitehorse"
33
+ },
34
+ {
35
+ "utc": [
36
+ "America/Boise",
37
+ "America/Cambridge_Bay",
38
+ "America/Denver",
39
+ "America/Edmonton",
40
+ "America/Inuvik",
41
+ "America/Ojinaga",
42
+ "America/Yellowknife",
43
+ "MST7MDT",
44
+ "Canada/Mountain",
45
+ "Navajo",
46
+ "US/Mountain"
47
+ ],
48
+ "label": "Mountain Time",
49
+ "keywords": "Mountain Time MST7MDT MT MST MDT Boise Cambridge_Bay Denver Edmonton Inuvik Ojinaga Yellowknife Navajo",
50
+ "isDst": true,
51
+ "cities": "Boise, Cambridge Bay, Denver, Edmonton, Inuvik, Ojinaga, Yellowknife"
52
+ },
53
+ {
54
+ "utc": [
55
+ "America/Chicago",
56
+ "America/Knox_IN",
57
+ "America/Indiana/Knox",
58
+ "America/Indiana/Tell_City",
59
+ "America/Matamoros",
60
+ "America/Menominee",
61
+ "America/North_Dakota/Beulah",
62
+ "America/North_Dakota/Center",
63
+ "America/North_Dakota/New_Salem",
64
+ "America/Rainy_River",
65
+ "America/Rankin_Inlet",
66
+ "America/Resolute",
67
+ "America/Winnipeg",
68
+ "Canada/Central",
69
+ "US/Central",
70
+ "US/Indiana-Starke",
71
+ "CST6CDT"
72
+ ],
73
+ "label": "Central Time",
74
+ "keywords": "Central Standard Time CST6CDT CT CDT Austin Beulah Center Chicago Illinois Knox Matamoros Menominee Nashville New Salem Rainy River Rankin Inlet Resolute San Antonio Tell City Tennessee Texas Winnipeg Indiana-Starke",
75
+ "isDst": true,
76
+ "cities": "Austin, Beulah, Center, Chicago, Knox, Matamoros, Menominee, Nashville, New Salem, Rainy River, Rankin Inlet, Resolute, San Antonio, Tell City, Tennessee, Texas, Winnipeg"
77
+ },
78
+ {
79
+ "utc": [
80
+ "America/New_York",
81
+ "America/Detroit",
82
+ "America/Havana",
83
+ "America/Indiana/Petersburg",
84
+ "America/Indiana/Vincennes",
85
+ "America/Indiana/Winamac",
86
+ "America/Iqaluit",
87
+ "America/Kentucky/Monticello",
88
+ "America/Louisville",
89
+ "America/Montreal",
90
+ "America/Nassau",
91
+ "America/Nipigon",
92
+ "America/Pangnirtung",
93
+ "America/Port-au-Prince",
94
+ "America/Thunder_Bay",
95
+ "America/Toronto",
96
+ "Canada/Eastern",
97
+ "Cuba",
98
+ "US/Michigan",
99
+ "US/Eastern"
100
+ ],
101
+ "label": "Eastern Time",
102
+ "keywords": "Eastern Standard Time EST ET Boston Massachusetts Charleston South Carolina Detroit Florida Havana Iqaluit Louisville Miami Monticello Montreal Nassau New York Nipigon Orlando Pangnirtung Port-au-Prince Petersburg Saint Augustine Thunder Bay Toronto Vincennes Washington D.C Winamac Cuba Michigan",
103
+ "isDst": true,
104
+ "cities": "Boston, Charleston, Detroit, Florida, Havana, Iqaluit, Louisville, Miami, Monticello, Montreal, Nassau, New York, Nipigon, Orlando, Pangnirtung, Port-au-Prince, Petersburg, Saint Augustine, Thunder Bay, Toronto, Vincennes, Washington D.C, Winamac"
105
+ },
106
+ {
107
+ "utc": [
108
+ "America/Anchorage",
109
+ "America/Juneau",
110
+ "America/Nome",
111
+ "America/Sitka",
112
+ "America/Yakutat",
113
+ "US/Alaska"
114
+ ],
115
+ "label": "Alaskan Time",
116
+ "keywords": "Alaskan Standard Time AT Anchorage Juneau Nome Sitka Yakutat",
117
+ "isDst": true,
118
+ "cities": "Anchorage, Juneau, Nome, Sitka, Yakutat"
119
+ },
120
+ {
121
+ "utc": [
122
+ "America/St_Johns",
123
+ "Canada/Newfoundland"
124
+ ],
125
+ "label": "Newfoundland Time",
126
+ "keywords": "Newfoundland Standard Time NT St Johns",
127
+ "isDst": true,
128
+ "cities": "St Johns"
129
+ },
130
+ {
131
+ "utc": [
132
+ "Etc/GMT+10",
133
+ "Pacific/Honolulu",
134
+ "Pacific/Johnston",
135
+ "Pacific/Rarotonga",
136
+ "Pacific/Tahiti",
137
+ "US/Hawaii"
138
+ ],
139
+ "label": "Hawaiian Time",
140
+ "keywords": "Hawaiian Standard Time T GMT+10 Honolulu Johnston Lahaina Rarotonga Tahiti",
141
+ "isDst": false,
142
+ "cities": "Honolulu, Johnston, Lahaina, Rarotonga, Tahiti"
143
+ }
144
+ ]
data/lib/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # NeetoTimeZones
2
+
3
+ A simple and lightweight Ruby gem for working with time zones. This gem provides utility functions for timezones.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ bundle add neeto_time_zones
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ gem install neeto_time_zones
14
+
15
+ ## Usage
16
+
17
+ ### iana_timezone_to_human_readable
18
+
19
+ ```ruby
20
+ NeetoTimeZones::Utils.iana_timezone_to_human_readable("Asia/Calcutta") # => Indian Standard Time
21
+ NeetoTimeZones::Utils.iana_timezone_to_human_readable("America/New_York") # => Eastern Standard Time
22
+ NeetoTimeZones::Utils.iana_timezone_to_human_readable("Europe/Berlin") # => Central Standard Time
23
+ ```
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bigbinary/neeto_time_zones.
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module NeetoTimeZones
6
+ class Utils
7
+ DATA_FILES = [
8
+ "africa.json",
9
+ "america.json",
10
+ "asia.json",
11
+ "atlantic.json",
12
+ "australia.json",
13
+ "europe.json",
14
+ "pacific.json",
15
+ "us_canada.json"
16
+ ]
17
+
18
+ def self.time_zones
19
+ base_path = File.expand_path("../../data", File.dirname(__FILE__))
20
+ time_zone_hash ||= DATA_FILES.flat_map do |file_name|
21
+ json_data = File.read(File.join(base_path, file_name))
22
+ JSON.parse(json_data, symbolize_names: true)
23
+ end
24
+ end
25
+
26
+ def self.iana_timezone_to_human_readable(iana_time_zone)
27
+ time_zone = time_zones.find { |time_zone| time_zone[:utc].include?(iana_time_zone) }
28
+ time_zone&.fetch(:label, nil)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoTimeZones
4
+ VERSION = "0.1.1"
5
+ end
@@ -0,0 +1,4 @@
1
+ require_relative "neeto_time_zones/utils"
2
+
3
+ module NeetoTimeZones
4
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: neeto_time_zones
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Calvin Chiramal
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - calvin.chiramal@bigbinary.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - data/africa.json
21
+ - data/america.json
22
+ - data/asia.json
23
+ - data/atlantic.json
24
+ - data/australia.json
25
+ - data/data/africa.json
26
+ - data/data/america.json
27
+ - data/data/asia.json
28
+ - data/data/atlantic.json
29
+ - data/data/australia.json
30
+ - data/data/europe.json
31
+ - data/data/pacific.json
32
+ - data/data/us_canada.json
33
+ - data/europe.json
34
+ - data/pacific.json
35
+ - data/us_canada.json
36
+ - lib/README.md
37
+ - lib/neeto_time_zones.rb
38
+ - lib/neeto_time_zones/utils.rb
39
+ - lib/neeto_time_zones/version.rb
40
+ homepage: https://github.com/bigbinary/neeto-time-zones
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.4.19
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: A Ruby gem that encapsulates common time_zone related helpers
63
+ test_files: []