neeto_time_zones 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 222407e5ba8abbf7a0ba84594ff11b1498400c1cd2884aa86229e20709e95ff9
4
- data.tar.gz: 5d67c60d18e67503e1b9919b845a15ffe44b502b604a29e3c2068ab7cc8e9c03
3
+ metadata.gz: 52a854e7953c495b3c0d506404d1d2a7d261ca94148d54a4a40c7a243d20a033
4
+ data.tar.gz: a41c0489065e0b52d326e66316eb87d03fdc34530488f513cf3272adfc71de91
5
5
  SHA512:
6
- metadata.gz: ceb924e0a9465d01b06ca91e3b69c56e50fefbfc50bda9f676462041764e05b2a1c83a5dd941376ba9cc42d7e3045dd68bfcfc81e1254d861b47fdd8325ea56f
7
- data.tar.gz: a6aa1f392b38c6adfed4998ff65f1e838e267879f68c0898f680e7c5cef2496cf87c5b173adb95ac9e88521056161592885f8f3a5eddef679d93908959034ac0
6
+ metadata.gz: 7a8c02686e17ff383c48f6724d3ba611e6082d4b3ea68d027b2ffd2c97b6b695f8a5f571c6a397478260df48523afa45a9b174199b0ae8ef1c78439ee77c3a17
7
+ data.tar.gz: 4f1af2a73b45a067138b33c283332ba61d3a23d630e5c9e0a77cd2ce26460f831c84b3a60fc5beba756c031a64b826333173b8e695cef437016fc9f109903fb8
@@ -68,8 +68,10 @@ module NeetoTimeZones
68
68
  "Egypt" => "Africa/Cairo",
69
69
  "Eire" => "Europe/Dublin",
70
70
  "Europe/Kiev" => "Europe/Kyiv",
71
- "Europe/Uzhgorod" => "Europe/Uzhhorod",
72
- "Europe/Zaporozhye" => "Europe/Zaporizhzhia",
71
+ "Europe/Uzhgorod" => "Europe/Kyiv",
72
+ "Europe/Zaporozhye" => "Europe/Kyiv",
73
+ "Europe/Uzhhorod" => "Europe/Kyiv",
74
+ "Europe/Zaporizhzhia" => "Europe/Kyiv",
73
75
  "GB" => "Europe/London",
74
76
  "GB-Eire" => "Europe/London",
75
77
  "GMT+0" => "Etc/GMT",
@@ -19,7 +19,17 @@ module NeetoTimeZones
19
19
 
20
20
  # This method sanitizes the browser timezone to the ones supported by ActiveSupport::TimeZone.
21
21
  def self.sanitize_timezone(timezone)
22
- Constants::TIMEZONES[timezone] || timezone
22
+ Constants::TIMEZONES[timezone] || ActiveSupport::TimeZone[timezone]&.tzinfo&.name || timezone
23
+ end
24
+
25
+ def self.sanitize_time_zone!(time_zone)
26
+ sanitized_time_zone = Constants::TIMEZONES[time_zone] || ActiveSupport::TimeZone[time_zone]&.tzinfo&.name
27
+
28
+ if sanitized_time_zone.nil?
29
+ raise ArgumentError, "Invalid timezone: #{time_zone}"
30
+ else
31
+ sanitized_time_zone
32
+ end
23
33
  end
24
34
  end
25
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NeetoTimeZones
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "neeto_time_zones/constants"
2
4
  require_relative "neeto_time_zones/utils"
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neeto_time_zones
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calvin Chiramal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-06 00:00:00.000000000 Z
11
+ date: 2024-11-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: