timely 0.12.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8539b3725c833746cf31c1d13ffcd8d1a1f76d1e3fae9d06008898864cc6fa3
4
- data.tar.gz: 5d748cb1025dd1f359433f4e543881bb5b28c6e988fdec85ab63a4fa04736548
3
+ metadata.gz: 76d53f7128d1f8fefc57f6c424ba275bc4ecb2a417ec36f81424b9e71b2859d8
4
+ data.tar.gz: 224b5a5144121bb69d2c01cd0dd79f21a70a58a2d92fe206ee58fc3ddb3cb809
5
5
  SHA512:
6
- metadata.gz: 8d035c9679c8ab9e0435d8a942404f9ed141f710328b5e95a555b43d96f5b114f8552a93758c56afbf46aba20b221ef44bb6fdde687432dd11893cff1fc52044
7
- data.tar.gz: d573289fbef814691ac96847c178e0750eed4f3193754efa9ec259df849e49ec885358c7bb7b3a87e4b54211c5d49633e285f94d08df4520deb3a31bcd69acb7
6
+ metadata.gz: e6210ba90bcca9ee930c78e5c5487fd9f30145ec32a15b896ebd1aaf0428bd9b8d8a0c98df95b443d9c2935e66efffd9788bf48428f5cbf5c0afb5b40c1f6f30
7
+ data.tar.gz: 7310aa84aadf17a0159652fc11c84295966fdf552759f4dfabfa169895768f8508f35be1a59d6bde4681c11e84e15989c2158024317eaeabd694969271c5b133
data/CHANGELOG.md CHANGED
@@ -1,77 +1,85 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0
4
+
5
+ - [TF-36] Add to_seconds method in Period class
6
+
7
+ ## 0.13.0
8
+
9
+ - [PLAT-1175] Update to Ruby 3.2
10
+
3
11
  ## 0.12.0
4
12
 
5
- * [PLAT-954] Handle additional `to_s` deprecation on Rails 7
13
+ - [PLAT-954] Handle additional `to_s` deprecation on Rails 7
6
14
 
7
15
  ## 0.11.0
8
16
 
9
- * [PLAT-346] Handle `to_s` deprecation on Rails 7
17
+ - [PLAT-346] Handle `to_s` deprecation on Rails 7
10
18
 
11
19
  ## 0.10.0
12
20
 
13
- * [PLAT-183] Publish coveralls with github actions add ruby 3.1 to test matrix
21
+ - [PLAT-183] Publish coveralls with github actions add ruby 3.1 to test matrix
14
22
 
15
23
  ## 0.9.0
16
24
 
17
- * [TT-8614] Update to build with github actions / ruby 3.0 / rails 6.1
25
+ - [TT-8614] Update to build with github actions / ruby 3.0 / rails 6.1
18
26
 
19
27
  ## 0.8.0
20
28
 
21
- * [TT-6441] Turns out we don't actually need time difference in QT
22
- * [TT-6661] Fix issue when detecting intersecting date groups
29
+ - [TT-6441] Turns out we don't actually need time difference in QT
30
+ - [TT-6661] Fix issue when detecting intersecting date groups
23
31
 
24
32
  ## 0.7.0
25
33
 
26
- * [TT-6441] Due to TimeDifference being unmaintained bring it into the timely library
34
+ - [TT-6441] Due to TimeDifference being unmaintained bring it into the timely library
27
35
 
28
36
  ## 0.6.0
29
37
 
30
- * [TT-6402] Require date group weekdays bit field to be not null/nil
31
- IMPORTANT: Rails projects must add a migration to make this field not null!
32
- * [TT-6401] Remove Rails 3 support, unused methods
38
+ - [TT-6402] Require date group weekdays bit field to be not null/nil
39
+ IMPORTANT: Rails projects must add a migration to make this field not null!
40
+ - [TT-6401] Remove Rails 3 support, unused methods
33
41
 
34
42
  ## 0.5.0
35
43
 
36
- * [TT-6193] Date group scopes for more efficient searches/restrictions
44
+ - [TT-6193] Date group scopes for more efficient searches/restrictions
37
45
 
38
46
  ## 0.4.2
39
47
 
40
- * [TT-5794] Fix belongs_to associations are not explicitly marked optional
48
+ - [TT-5794] Fix belongs_to associations are not explicitly marked optional
41
49
 
42
50
  ## 0.4.1
43
51
 
44
- * [TT-5674] Make multi year date format friendlier
52
+ - [TT-5674] Make multi year date format friendlier
45
53
 
46
54
  ## 0.4.0
47
55
 
48
- * [TT-5648] Fix date_range to string when a single month covers a year period
56
+ - [TT-5648] Fix date_range to string when a single month covers a year period
49
57
 
50
58
  ## 0.3.4
51
59
 
52
- * [TT-4812] Remove bootstrap class from calender tag
60
+ - [TT-4812] Remove bootstrap class from calender tag
53
61
 
54
62
  ## 0.3.3
55
63
 
56
- * Skipped due to mis-tagged version
64
+ - Skipped due to mis-tagged version
57
65
 
58
66
  ## 0.3.2
59
67
 
60
- * [TT-4716] Better exception message when a range is invalid
68
+ - [TT-4716] Better exception message when a range is invalid
61
69
 
62
70
  ## 0.3.1
63
71
 
64
- * Using Fixnum is deprecated
72
+ - Using Fixnum is deprecated
65
73
 
66
74
  ## 0.3.0
67
75
 
68
- * Add time zone awareness for Time#on (e.g. Rails)
69
- * Required Timely.load to load overrides
76
+ - Add time zone awareness for Time#on (e.g. Rails)
77
+ - Required Timely.load to load overrides
70
78
 
71
79
  ## 0.2.0
72
80
 
73
- * Rails 5 support
81
+ - Rails 5 support
74
82
 
75
83
  ## 0.1.0
76
84
 
77
- * Initial release
85
+ - Initial release
@@ -29,5 +29,30 @@ module Timely
29
29
  def to_s
30
30
  "#{number} #{units.to_s.gsub('_', '')}"
31
31
  end
32
+
33
+ def to_seconds
34
+ case units
35
+ when :seconds
36
+ number
37
+ when :minutes
38
+ number.minute.in_seconds
39
+ when :hours
40
+ number.hour.in_seconds
41
+ when :days
42
+ number.day.in_seconds
43
+ when :weeks
44
+ number.week.in_seconds
45
+ when :months
46
+ number.month.in_seconds
47
+ when :years
48
+ number.year.in_seconds
49
+ when :calendar_days
50
+ ::Time.now.advance(days: number - 1).end_of_day - ::Time.now
51
+ when :calendar_months
52
+ ::Time.now.advance(months: number - 1).end_of_month - ::Time.now
53
+ when :calendar_years
54
+ ::Time.now.advance(years: number - 1).end_of_year - ::Time.now
55
+ end
56
+ end
32
57
  end
33
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Timely
4
- VERSION = '0.12.0'
4
+ VERSION = '0.14.0'
5
5
  end
data/timely.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.files = Dir["CHANGELOG.md", "README.md", "timely.gemspec", "lib/**/*"]
19
19
  spec.executables = []
20
20
  spec.require_paths = ['lib']
21
- spec.required_ruby_version = '>= 2.7'
21
+ spec.required_ruby_version = '>= 3.0'
22
22
 
23
23
  spec.add_development_dependency 'activerecord', '>=6', '<8'
24
24
  spec.add_development_dependency 'activesupport', '>=6', '<8'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-04 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -253,14 +253,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
254
  - - ">="
255
255
  - !ruby/object:Gem::Version
256
- version: '2.7'
256
+ version: '3.0'
257
257
  required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  requirements:
259
259
  - - ">="
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubygems_version: 3.3.3
263
+ rubygems_version: 3.4.1
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: Set of time, date, weekday related methods.