et-orbi 1.2.4 → 1.2.7

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: d149cca00007283238dcce941bdfea63eaeacb4c41750790fae08b5967acbafc
4
- data.tar.gz: b6fc9ae4924376894010c180b3bd4c8b735b4647635cb7899fa0f8ede1c4f233
3
+ metadata.gz: 23ff138170f965f0a2dc35d38aaa08123ddfd97176d76f5e1b2136306eec812e
4
+ data.tar.gz: 193d8bca6b8cfb34f023aadb504e127fd3f187eb64c10f546327510c8f487e04
5
5
  SHA512:
6
- metadata.gz: 32858697fce82e2ad0d58fa913b8eaf91b4104f6afdb2c447d27edf3dbadc7a6af9610cfdc98d5f1d821f47f604c961417599c5a1a4116cc2e27f7a799c30cde
7
- data.tar.gz: 0c507744256eac6fd376b1023ff2da5c3c73c35cded7cc61ccd5d98ab0ad97a3e6356374aec386dc4a807c8ae1bfd35a340e57b28d04f34b6fb3a989b487f752
6
+ metadata.gz: 9a5747b65189567c49a9dda0936bac7d947deaa8a5067ba4d311d1c80032722baae682acfc111488d8c6b3139fa41238dfec645279983449312c6f5aa8881eb9
7
+ data.tar.gz: 2173668af72a6c2aff4e992201d5c74ffe5f87023f6e52c4c42389c28bb8cab4a231c55142bbc9c12513173260c80bf3b372c0ccad555900f6a7efad01e35482
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## et-orbi 1.2.7 released 2022-03-09
6
+
7
+ - Fix the wday_in_month computation for floraison/fugit#67
8
+
9
+
10
+ ## et-orbi 1.2.6 released 2021-10-30
11
+
12
+ - Favour IANA timezone name in EtOrbi.make_time
13
+
14
+
15
+ ## et-orbi 1.2.5 released 2021-09-18
16
+
17
+ - Re-use the DateTime.parse result
18
+
19
+
5
20
  ## et-orbi 1.2.4 released 2020-03-18
6
21
 
7
22
  - Do not call Chronic (even if enabled) from make_from_array, gh-28
data/CREDITS.md CHANGED
@@ -1,6 +1,9 @@
1
1
 
2
2
  # et-orbi credits
3
3
 
4
+ * phibid, for https://github.com/floraison/fugit/issues/67
5
+ * Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-32
6
+ * harsha-flipp (https://github.com/harsha-flipp) https://github.com/floraison/fugit/issues/63
4
7
  * adank92 (https://github.com/adank92) https://github.com/ondrejbartas/sidekiq-cron/issues/276 gh-28
5
8
  * Stan Hu (https://github.com/stanhu) Chronic toubles, gh-24, gh-26, etc
6
9
  * d-m-u (https://github.com/d-m-u) EoTime#==(Time), gh-20, gh-7
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2017-2020, John Mettraux, jmettraux+flor@gmail.com
2
+ Copyright (c) 2017-2022, John Mettraux, jmettraux+flor@gmail.com
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
 
2
2
  # et-orbi
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/floraison/et-orbi.svg)](http://travis-ci.org/floraison/et-orbi)
5
- [![Build status](https://ci.appveyor.com/api/projects/status/6tbo9lk9qdor8ipl?svg=true)](https://ci.appveyor.com/project/jmettraux/et-orbi)
4
+ [![tests](https://github.com/floraison/et-orbi/workflows/test/badge.svg)](https://github.com/floraison/et-orbi/actions)
6
5
  [![Gem Version](https://badge.fury.io/rb/et-orbi.svg)](http://badge.fury.io/rb/et-orbi)
7
6
  [![Join the chat at https://gitter.im/floraison/fugit](https://badges.gitter.im/floraison/fugit.svg)](https://gitter.im/floraison/fugit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
7
 
@@ -16,6 +15,8 @@ require 'et-orbi'
16
15
 
17
16
  EtOrbi.now
18
17
  # => #<EtOrbi::EoTime:0x007f94d94 ...>
18
+ EtOrbi.now('Asia/Singapore')
19
+ # => #<EtOrbi::EoTime:0x39c96e48 @time=nil, @zone=#<TZInfo::DataTimezone: Asia/Singapore>...>
19
20
  EtOrbi.parse('2017-12-13 13:00:00 America/Jamaica')
20
21
  # => #<EtOrbi::EoTime:0x007f94d90 @zone=#<TZInfo::DataTimezone: America/Jamaica>...>
21
22
  EtOrbi.make_time(Time.now)
@@ -75,7 +76,10 @@ By default, et-orbi relies on [Chronic](https://github.com/mojombo/chronic) to p
75
76
 
76
77
  ```ruby
77
78
  EtOrbi.parse('tomorrow')
78
- # => #<EtOrbi::EoTime:0x007fbc6aa8a560 @seconds=1575687600.0, @zone=#<TZInfo::TimezoneProxy: Asia/Tokyo>, @time=nil>
79
+ # => #<EtOrbi::EoTime:0x007fbc6aa8a560
80
+ # @seconds=1575687600.0,
81
+ # @zone=#<TZInfo::TimezoneProxy: Asia/Tokyo>,
82
+ # @time=nil>
79
83
  EtOrbi.parse('tomorrow').to_s
80
84
  # => "2019-12-07 12:00:00 +0900"
81
85
  ```
@@ -90,10 +94,13 @@ EtOrbi.parse(Chronic.parse('tomorrow').to_s).to_s
90
94
  # => "2019-12-07 12:00:00 +0900"
91
95
  ```
92
96
 
93
- If one has Chronic present in his project but doesn't want it to interfere with et-orbi, it can be disabled at `parse` call:
97
+ If one has Chronic present in their project but doesn't want it to interfere with et-orbi, it can be disabled at `parse` call:
94
98
  ```ruby
95
99
  EtOrbi.parse('tomorrow')
96
- # => #<EtOrbi::EoTime:0x007ffb5b2a2390 @seconds=1575687600.0, @zone=#<TZInfo::TimezoneProxy: Asia/Tokyo>, @time=nil>
100
+ # => #<EtOrbi::EoTime:0x007ffb5b2a2390
101
+ # @seconds=1575687600.0,
102
+ # @zone=#<TZInfo::TimezoneProxy: Asia/Tokyo>,
103
+ # @time=nil>
97
104
  EtOrbi.parse('tomorrow', enable_chronic: false)
98
105
  # ArgumentError: No time information in "tomorrow"
99
106
  # from /home/jmettraux/w/et-orbi/lib/et-orbi/make.rb:31:in `rescue in parse'
data/et-orbi.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = [ 'John Mettraux' ]
12
12
  s.email = [ 'jmettraux+flor@gmail.com' ]
13
- s.homepage = 'http://github.com/floraison/et-orbi'
13
+ s.homepage = 'https://github.com/floraison/et-orbi'
14
14
  s.license = 'MIT'
15
15
  s.summary = 'time with zones'
16
16
 
data/lib/et-orbi/make.rb CHANGED
@@ -25,23 +25,25 @@ module EtOrbi
25
25
  str = [ t.strftime('%F %T'), str_zone ].compact.join(' ')
26
26
  end
27
27
 
28
- begin
29
- DateTime.parse(str)
30
- rescue
31
- fail ArgumentError, "No time information in #{str.inspect}"
32
- end
33
- #end if RUBY_VERSION < '1.9.0'
34
- #end if RUBY_VERSION < '2.0.0'
35
- #
36
- # is necessary since Time.parse('xxx') in Ruby < 1.9 yields `now`
28
+ dt =
29
+ begin
30
+ DateTime.parse(str)
31
+ rescue
32
+ fail ArgumentError, "No time information in #{str.inspect}"
33
+ end
34
+ #end if RUBY_VERSION < '1.9.0'
35
+ #end if RUBY_VERSION < '2.0.0'
36
+ #
37
+ # is necessary since Time.parse('xxx') in Ruby < 1.9 yields `now`
37
38
 
38
39
  zone =
39
40
  opts[:zone] ||
40
41
  get_tzone(str_zone) ||
41
42
  determine_local_tzone
42
43
 
43
- local = Time.parse(str)
44
- secs = zone.local_to_utc(local).to_f
44
+ #local = Time.parse(str)
45
+ #secs = zone.local_to_utc(local).to_f
46
+ secs = zone.local_to_utc(dt).to_time.to_f
45
47
 
46
48
  EoTime.new(secs, zone)
47
49
  end
@@ -84,8 +86,8 @@ module EtOrbi
84
86
  z =
85
87
  zone ||
86
88
  get_as_tzone(t) ||
87
- get_tzone(t.zone) ||
88
- get_local_tzone(t)
89
+ get_local_tzone(t) ||
90
+ get_tzone(t.zone)
89
91
 
90
92
  z ||= t.zone
91
93
  # pass the abbreviation anyway,
data/lib/et-orbi/time.rb CHANGED
@@ -326,7 +326,8 @@ module EtOrbi
326
326
 
327
327
  def wday_in_month
328
328
 
329
- [ count_weeks(-1), - count_weeks(1) ]
329
+ [ count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')), -1),
330
+ - count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')) , 1) ]
330
331
  end
331
332
 
332
333
  def rweek
@@ -385,10 +386,11 @@ module EtOrbi
385
386
  @time ||= @zone.utc_to_local(utc)
386
387
  end
387
388
 
388
- def count_weeks(dir)
389
+ def count_weeks(start, dir)
389
390
 
390
391
  c = 0
391
- t = self
392
+ t = start
393
+
392
394
  until t.month != self.month
393
395
  c += 1
394
396
  t += dir * (7 * 24 * 3600)
data/lib/et-orbi/zones.rb CHANGED
@@ -13,7 +13,7 @@ module EtOrbi
13
13
  (?![-+])
14
14
  |Z
15
15
  )
16
- }x
16
+ }x.freeze
17
17
 
18
18
  # https://en.wikipedia.org/wiki/ISO_8601
19
19
  # Postel's law applies
data/lib/et-orbi.rb CHANGED
@@ -13,6 +13,6 @@ require 'et-orbi/zone'
13
13
 
14
14
  module EtOrbi
15
15
 
16
- VERSION = '1.2.4'
16
+ VERSION = '1.2.7'
17
17
  end
18
18
 
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
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2022-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -73,15 +73,15 @@ files:
73
73
  - lib/et-orbi/zones.rb
74
74
  - lib/et_orbi.rb
75
75
  - lib/etorbi.rb
76
- homepage: http://github.com/floraison/et-orbi
76
+ homepage: https://github.com/floraison/et-orbi
77
77
  licenses:
78
78
  - MIT
79
79
  metadata:
80
- changelog_uri: http://github.com/floraison/et-orbi/blob/master/CHANGELOG.md
81
- documentation_uri: http://github.com/floraison/et-orbi
82
- bug_tracker_uri: http://github.com/floraison/et-orbi/issues
83
- homepage_uri: http://github.com/floraison/et-orbi
84
- source_code_uri: http://github.com/floraison/et-orbi
80
+ changelog_uri: https://github.com/floraison/et-orbi/blob/master/CHANGELOG.md
81
+ documentation_uri: https://github.com/floraison/et-orbi
82
+ bug_tracker_uri: https://github.com/floraison/et-orbi/issues
83
+ homepage_uri: https://github.com/floraison/et-orbi
84
+ source_code_uri: https://github.com/floraison/et-orbi
85
85
  post_install_message:
86
86
  rdoc_options: []
87
87
  require_paths:
@@ -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.0.3
100
+ rubygems_version: 3.1.2
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: time with zones