et-orbi 1.2.8 → 1.2.10
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 +11 -1
- data/CREDITS.md +6 -4
- data/lib/et-orbi/time.rb +47 -23
- data/lib/et-orbi.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: 12da146d4d75a3fb39edea976685cd6117958484f265f6a7eff404a4f9726224
|
4
|
+
data.tar.gz: b772af0f0e49c040ef15e3b2d23a61b28b540cc7d69f3e338f6fca719057c94b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56992ab662dc9ddcfbf6975332f7e44ee4a0c8eb5a90d519dbc8cd79da0847626f90451c21d5080eee440ba65c93cb16a939d20bb94b442eb5b05ce86cd6eea3
|
7
|
+
data.tar.gz: 6c04743276d444c5d7e38a852c385d643af9e8969f03de382c38661bf61ee6f692a1bebadb7c1700318aa99392c4292b592dbcbc27557cbc15d71e203a47e31a
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,17 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
-
## et-orbi 1.2.
|
5
|
+
## et-orbi 1.2.10 released 2024-03-22
|
6
|
+
|
7
|
+
- Refine #rweek computation, aim more at noon instead of midnight, gh-38
|
8
|
+
|
9
|
+
|
10
|
+
## et-orbi 1.2.9 released 2024-03-13
|
11
|
+
|
12
|
+
- Refine #rweek computation, aim at noon instead of midnight, gh-38
|
13
|
+
|
14
|
+
|
15
|
+
## et-orbi 1.2.8 released 2024-03-11 (13 ans)
|
6
16
|
|
7
17
|
- Cache the @ref time used in the #rweek and #rday computation
|
8
18
|
|
data/CREDITS.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
|
2
2
|
# et-orbi credits
|
3
3
|
|
4
|
+
* Benjami Darcet https://github.com/bdarcet https://github.com/floraison/fugit/issues/67 gh-38
|
5
|
+
* https://github.com/franckduche https://github.com/floraison/fugit/issues/67 gh-38
|
4
6
|
* Igor Viktor https://github.com/gogainda gh-34
|
5
7
|
* phibid, for https://github.com/floraison/fugit/issues/67
|
6
8
|
* Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-32
|
7
|
-
* harsha-flipp
|
8
|
-
* adank92
|
9
|
-
* Stan Hu
|
10
|
-
* d-m-u
|
9
|
+
* harsha-flipp https://github.com/harsha-flipp https://github.com/floraison/fugit/issues/63
|
10
|
+
* adank92 https://github.com/adank92 https://github.com/ondrejbartas/sidekiq-cron/issues/276 gh-28
|
11
|
+
* Stan Hu https://github.com/stanhu Chronic toubles, gh-24, gh-26, etc
|
12
|
+
* d-m-u https://github.com/d-m-u EoTime#==(Time), gh-20, gh-7
|
11
13
|
* Vais Salikhov (https://github.com/vais) missing US timezone aliases, gh-18 gh-19
|
12
14
|
* Wenhui Wang https://github.com/w11th .parse vs Chronic+ActiveSupport, fugit 11
|
13
15
|
* Marcel https://github.com/MTRNord "Mitteleuropaeische Sommerzeit", gh-15
|
data/lib/et-orbi/time.rb
CHANGED
@@ -88,22 +88,34 @@ module EtOrbi
|
|
88
88
|
(defined?(TZInfo::Data) ? '' : "\nand adding gem 'tzinfo-data'")
|
89
89
|
) unless @zone
|
90
90
|
|
91
|
+
touch
|
92
|
+
end
|
93
|
+
|
94
|
+
# Nullify the "caches" used by #to_time, #rweek, and others
|
95
|
+
#
|
96
|
+
def touch
|
97
|
+
|
91
98
|
@time = nil
|
92
|
-
|
99
|
+
@ref = nil
|
93
100
|
end
|
94
101
|
|
95
102
|
def seconds=(f)
|
96
103
|
|
97
|
-
@time = nil
|
98
104
|
@seconds = f
|
105
|
+
|
106
|
+
touch
|
107
|
+
|
108
|
+
f
|
99
109
|
end
|
100
110
|
|
101
111
|
def zone=(z)
|
102
112
|
|
103
|
-
@time = nil
|
104
|
-
@ref = nil
|
105
113
|
|
106
114
|
@zone = self.class.get_tzone(zone || :current)
|
115
|
+
|
116
|
+
touch
|
117
|
+
|
118
|
+
@zone
|
107
119
|
end
|
108
120
|
|
109
121
|
# Returns true if this EoTime instance corresponds to 2 different UTC
|
@@ -232,8 +244,8 @@ module EtOrbi
|
|
232
244
|
def <=(o); @seconds <= _to_f(o); end
|
233
245
|
def <=>(o); @seconds <=> _to_f(o); end
|
234
246
|
|
235
|
-
def add(t); @
|
236
|
-
def subtract(t); @
|
247
|
+
def add(t); @seconds += t.to_f; touch; self; end
|
248
|
+
def subtract(t); @seconds -= t.to_f; touch; self; end
|
237
249
|
|
238
250
|
def +(t); inc(t, 1); end
|
239
251
|
def -(t); inc(t, -1); end
|
@@ -303,19 +315,24 @@ module EtOrbi
|
|
303
315
|
|
304
316
|
def inc(t, dir=1)
|
305
317
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
318
|
+
r =
|
319
|
+
case t
|
320
|
+
when Numeric
|
321
|
+
nt = self.dup
|
322
|
+
nt.seconds += dir * t.to_f
|
323
|
+
nt
|
324
|
+
when ::Time, ::EtOrbi::EoTime
|
325
|
+
fail ArgumentError.new(
|
326
|
+
"Cannot add #{t.class} to EoTime") if dir > 0
|
327
|
+
@seconds + dir * t.to_f
|
328
|
+
else
|
329
|
+
fail ArgumentError.new(
|
330
|
+
"Cannot call add or subtract #{t.class} to EoTime instance")
|
331
|
+
end
|
332
|
+
|
333
|
+
touch
|
334
|
+
|
335
|
+
r
|
319
336
|
end
|
320
337
|
|
321
338
|
def localtime(zone=nil)
|
@@ -336,18 +353,20 @@ module EtOrbi
|
|
336
353
|
#
|
337
354
|
def rweek
|
338
355
|
|
339
|
-
@ref ||= EtOrbi.make_time('2019-01-01
|
356
|
+
@ref ||= EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
357
|
+
noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
|
340
358
|
|
341
|
-
((
|
359
|
+
((noon - @ref) / WEEK_S).floor + 1
|
342
360
|
end
|
343
361
|
|
344
362
|
# "reference week", used in fugit for cron modulo notation
|
345
363
|
#
|
346
364
|
def rday
|
347
365
|
|
348
|
-
@ref ||= EtOrbi.make_time('2019-01-01
|
366
|
+
@ref ||= EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
367
|
+
noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
|
349
368
|
|
350
|
-
((
|
369
|
+
((noon - @ref) / DAY_S).floor + 1
|
351
370
|
end
|
352
371
|
|
353
372
|
def reach(points)
|
@@ -382,6 +401,11 @@ module EtOrbi
|
|
382
401
|
t
|
383
402
|
end
|
384
403
|
|
404
|
+
def clone
|
405
|
+
|
406
|
+
EtOrbi::EoTime.new(@seconds, @zone)
|
407
|
+
end
|
408
|
+
|
385
409
|
protected
|
386
410
|
|
387
411
|
# Returns a Ruby Time instance.
|
data/lib/et-orbi.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: et-orbi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.4.10
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: time with zones
|