local_date_time_attributes 0.1.1 → 0.1.2

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: 2c32b770854306fb5b91ca41a48c0452657dc7f64753c9db4894858d4b9d03f8
4
- data.tar.gz: 5a68e821cb30fef498e1a50c9e97af4a4a54e2df5da7ab9866acf7bb718e3b11
3
+ metadata.gz: 979444c0483d8668e71c4443ff98f9431de32463af28b8a9009d1213442db259
4
+ data.tar.gz: 82f3b12c0b61d953794003c18db211a3806a0b42a0ca33f7dddb00d505602f03
5
5
  SHA512:
6
- metadata.gz: 89e8bbb4feee7621cba35ec4f83e84e8a01a4dd46e389afdad15d254a087d6b49acfea5891e64b875bf63339b437cce2ded224f3076fc850927b9f6b90b4e97e
7
- data.tar.gz: 241ffa8f7852b5020c2cbe15de9618c9132bdce0c69c91c4e2a0349bfcfcbb35f6beb36e69e8dfcf141d8346bba837c293f317a27ca273799e36a6367a28c6ad
6
+ metadata.gz: 44654e2a37cac9eace5e4acb56d311cf125571786cbc48f1da9778ebac958018eec7977ec008a9c56a14412802636de8d6e874e1959d1071b3512031b2f07d2b
7
+ data.tar.gz: 32d83fe883e0830947208a8a3befc91413eb589bb39bebfb0311490812e61649643aa42927737f65f00f12288958053f5302456e167c758f2c5b1835967a8e62
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- local_date_time_attributes (0.1.0)
4
+ local_date_time_attributes (0.1.2)
5
5
  activerecord (>= 5.0)
6
6
  activesupport (>= 5.0)
7
7
 
@@ -11,14 +11,16 @@ module LocalDateTimeAttributes
11
11
  # Returns a datetime in the timezone specified without changing the time
12
12
  def to_local(time_zone = Time.zone.try(:name))
13
13
  return if __getobj__.nil? || time_zone.nil?
14
- ActiveSupport::TimeZone.new(time_zone).local_to_utc(__getobj__).in_time_zone(time_zone)
14
+ converted_timestamp = ActiveSupport::TimeZone.new(time_zone).local_to_utc(__getobj__)
15
+ converted_timestamp.in_time_zone(time_zone) if converted_timestamp.respond_to? :in_time_zone
15
16
  end
16
17
 
17
18
  private
18
19
 
19
20
  def from_local(date_time)
20
21
  return if date_time.nil?
21
- ActiveSupport::TimeZone.new(active_record_timezone).local_to_utc(date_time).in_time_zone(active_record_timezone)
22
+ converted_timestamp = ActiveSupport::TimeZone.new(active_record_timezone).local_to_utc(date_time)
23
+ converted_timestamp.in_time_zone(active_record_timezone) if converted_timestamp.respond_to? :in_time_zone
22
24
  end
23
25
 
24
26
  def active_record_timezone
@@ -1,3 +1,3 @@
1
1
  module LocalDateTimeAttributes
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: local_date_time_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samson Nguyen