neeto_time_zones 0.1.2 → 0.1.4

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: bde59921dfd00affe2caf7c5fda3c1aebcfc21eadd054d515f8fa4ca6a1f6277
4
+ data.tar.gz: d6a906af7d117613418837fdb86773c22b38ccf40f4b611f0ff28224a6e76355
5
5
  SHA512:
6
- metadata.gz: ceb924e0a9465d01b06ca91e3b69c56e50fefbfc50bda9f676462041764e05b2a1c83a5dd941376ba9cc42d7e3045dd68bfcfc81e1254d861b47fdd8325ea56f
7
- data.tar.gz: a6aa1f392b38c6adfed4998ff65f1e838e267879f68c0898f680e7c5cef2496cf87c5b173adb95ac9e88521056161592885f8f3a5eddef679d93908959034ac0
6
+ metadata.gz: 941848e0073482e63bea8d58c36954b8840d6561f3aec75c7efd51b1b1f59db4cf8b61c841b5a09e4cea30105609b1fcca9e9ebecf64ac72214e9d1219959a24
7
+ data.tar.gz: d53ffbd90305a3015053993ac6e43322b08fa3782c2038a35eb47751475a604ce6e0e83ce9079ae827924967aa27f8ed518bd15c2fed94cc146c1ec1775abdc3
@@ -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,19 @@ 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
+ return nil if timezone.nil?
23
+
24
+ Constants::TIMEZONES[timezone] || ActiveSupport::TimeZone[timezone]&.tzinfo&.name || timezone
25
+ end
26
+
27
+ def self.sanitize_time_zone!(time_zone)
28
+ sanitized_time_zone = Constants::TIMEZONES[time_zone] || ActiveSupport::TimeZone[time_zone]&.tzinfo&.name
29
+
30
+ if sanitized_time_zone.nil?
31
+ raise ArgumentError, "Invalid timezone: #{time_zone}"
32
+ else
33
+ sanitized_time_zone
34
+ end
23
35
  end
24
36
  end
25
37
  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.4"
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.4
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: