to_timezone 0.3.0 → 0.4.1
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 +4 -4
- data/CHANGELOG.md +50 -0
- data/lib/to_timezone/tz_ext.rb +11 -12
- data/lib/to_timezone/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b67706d256c07a1a294abfdcbf61b900ddd15af6c37a6e1f7ec6ed2a3c996a8b
|
|
4
|
+
data.tar.gz: 0a88f24156690bab22c4ba353fb9db5c32a9191a405bd76d6bb647e2f482bddd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 894a78cac2ee9c885e789ae81089e25ce1f8eb061df2395fab5d0cca1fd31eda595e2e86463f310b0c07aa1766afb35a359a0571e78e36c1b63f4d4b88907eba
|
|
7
|
+
data.tar.gz: 8f52381189887ce9e5bb1088460fc3715756100aa6f91f30480867cad8835a9f66daba7ac08cbe3542d68a050b6d3bcb45a266c1b9b87ea77f050787183fe4a5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
1
8
|
## [Unreleased]
|
|
2
9
|
|
|
10
|
+
## [0.4.1] - 2026-06-26
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Replaced `to_time.in_time_zone(timezone)` with `in_time_zone(timezone)` in `TzExtDateTime` to resolve `NoMethodError: undefined method 'deprecator' for ActiveSupport:Module` raised by ActiveSupport 7.2, which deprecated `DateTime#to_time`
|
|
14
|
+
|
|
15
|
+
## [0.4.0] - 2026-06-26
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Updated gem dependencies
|
|
19
|
+
- Improved timezone conversion methods in `TzExt` module
|
|
20
|
+
- Added `ActiveSupport::TimeWithZone` support via conditional include
|
|
21
|
+
|
|
22
|
+
## [0.3.0] - 2025-08-19
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- `tzdata` added as a CI dependency for reliable timezone support across environments
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
- Removed automated release job from CI configuration
|
|
29
|
+
|
|
30
|
+
## [0.2.4] - 2025-08-19
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Refactored timezone conversion methods for `DateTime` and `String` classes
|
|
34
|
+
- Resolved RuboCop offenses across the codebase
|
|
35
|
+
|
|
36
|
+
## [0.2.3] - 2025-08-19
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- CI workflow for automated testing and gem releasing
|
|
40
|
+
|
|
41
|
+
### Removed
|
|
42
|
+
- Removed `timecop` as a development dependency
|
|
43
|
+
|
|
44
|
+
## [0.2.0] - 2025-02-26
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- String support: timezone conversion methods can now be called directly on time strings (e.g. `"2025-02-07 07:00:00 +0800".to_utc`)
|
|
48
|
+
- Added `active_support/core_ext/string/zones` to support `String#in_time_zone`
|
|
49
|
+
|
|
3
50
|
## [0.1.0] - 2025-02-07
|
|
4
51
|
|
|
52
|
+
### Added
|
|
5
53
|
- Initial release
|
|
54
|
+
- Timezone conversion methods (`to_pht`, `to_utc`, `to_ict`, etc.) for `Time` and `DateTime`
|
|
55
|
+
- 150+ timezone abbreviation aliases backed by IANA timezone identifiers
|
data/lib/to_timezone/tz_ext.rb
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'tzs'
|
|
4
|
-
require 'active_support'
|
|
5
|
-
require 'active_support/core_ext/time'
|
|
4
|
+
require 'active_support/time'
|
|
6
5
|
require 'active_support/core_ext/string/zones'
|
|
7
6
|
|
|
8
7
|
module ToTimezone
|
|
8
|
+
# For Time, String, and ActiveSupport::TimeWithZone — all support in_time_zone directly.
|
|
9
9
|
module TzExt
|
|
10
10
|
ToTimezone::Tzs::TIMEZONES.each do |abbr, timezone|
|
|
11
|
-
define_method("to_#{abbr}")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
define_method(:"to_#{abbr}") { in_time_zone(timezone) }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# DateTime supports in_time_zone directly in ActiveSupport 7.x+.
|
|
16
|
+
module TzExtDateTime
|
|
17
|
+
ToTimezone::Tzs::TIMEZONES.each do |abbr, timezone|
|
|
18
|
+
define_method(:"to_#{abbr}") { in_time_zone(timezone) }
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
|
|
22
|
-
# Extend Time and DateTime
|
|
23
23
|
class Time
|
|
24
24
|
include ToTimezone::TzExt
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
class DateTime
|
|
28
|
-
include ToTimezone::
|
|
28
|
+
include ToTimezone::TzExtDateTime
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
class String
|
|
32
32
|
include ToTimezone::TzExt
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# Explicitly patch ActiveSupport::TimeWithZone
|
|
36
35
|
if defined?(ActiveSupport::TimeWithZone)
|
|
37
36
|
class ActiveSupport::TimeWithZone
|
|
38
37
|
include ToTimezone::TzExt
|
data/lib/to_timezone/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: to_timezone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nujian Den Mark Meralpis
|
|
@@ -72,14 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 2.
|
|
75
|
+
version: 2.7.0
|
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
78
|
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
80
|
version: '0'
|
|
81
81
|
requirements: []
|
|
82
|
-
rubygems_version:
|
|
82
|
+
rubygems_version: 4.0.10
|
|
83
83
|
specification_version: 4
|
|
84
84
|
summary: Seamlessly convert Time and DateTime objects to different time zones with
|
|
85
85
|
intuitive methods like `.to_pht`, `.to_ict`, and more.
|