et-orbi 1.1.2 → 1.1.3

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
  SHA1:
3
- metadata.gz: 9087de4253106aad0142d0e3a7985b2fd4cef1f4
4
- data.tar.gz: e5b7dc43e253987e3f60b42ce55c4c8b521438d4
3
+ metadata.gz: 6330469df07c1668e684b3b17a7413f58b206791
4
+ data.tar.gz: a8b053546f08ca127a8cf99d71e7b2ff9119687c
5
5
  SHA512:
6
- metadata.gz: 72c25c33cca74a4e487f215ad9b2b6c1fda170d06387e1bd9242a8b04bc51f2885a0773f11658076d1f3c99b4ddb8e93269028500d991fed82ab5a2f144e6c91
7
- data.tar.gz: 220954e56982a997ccee2d2f036f74a10384ab63033055171130cbd984b38c9b1d8148134a57e6db9acb527a35854697e7063a869cb73794d2f529e89a0df7f9
6
+ metadata.gz: 343aa588d3a9fb2cb36ca7ac303797c23d27e5a2dca4d5db640898481d5fe275f63f363ef3b97aa492fe28aa1d2e0e58ed4f134bfb949f8c76d9b2e2e6d6c479
7
+ data.tar.gz: 4b852a4a9ba6aaa55687220511d0df6a37898560cb218dda54ec5f2f3e35ec4fcd4e4a9512624c1c80a574927c9b19d37ea0f71709727ed35a117f36c644e528
@@ -2,6 +2,12 @@
2
2
  # et-orbi CHANGELOG.md
3
3
 
4
4
 
5
+ ## et-orbi 1.1.3 released 2018-07-14
6
+
7
+ - Introduce EtOrbi::EoTime#ambiguous?
8
+ - Introduce EtOrbi::EoTime#to_z for precise timezones (not offsets)
9
+
10
+
5
11
  ## et-orbi 1.1.2 released 2018-05-24
6
12
 
7
13
  - Let EtOrbi.get_tzone understand "CST+0800"
data/CREDITS.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  # et-orbi credits
3
3
 
4
+ * mlotfi2005 https://github.com/mlotfi2005 reported infinite loop, gh-12
4
5
  * Mayur Dave https://github.com/mdave16 reported trailing warning, gh-10
5
6
  * Phil Ross https://github.com/philr added support for upcoming TZInfo 2.x, gh-9
6
7
  * Miles Lane https://github.com/mileslane issue with ActiveSupport::TimeZone, gh-8
@@ -19,3 +19,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
19
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
20
  THE SOFTWARE.
21
21
 
22
+
23
+ Made in Japan
24
+
data/Makefile CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- ## core floraison make ##
2
+ ## gem tasks ##
3
3
 
4
4
  NAME = \
5
5
  $(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name")
@@ -13,12 +13,15 @@ cl: count_lines
13
13
 
14
14
  gemspec_validate:
15
15
  @echo "---"
16
- ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); s.validate"
16
+ ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); p s.validate"
17
17
  @echo "---"
18
18
 
19
19
  name: gemspec_validate
20
20
  @echo "$(NAME) $(VERSION)"
21
21
 
22
+ cw:
23
+ find lib -name "*.rb" -exec ruby -cw {} \;
24
+
22
25
  build: gemspec_validate
23
26
  gem build $(NAME).gemspec
24
27
  mkdir -p pkg
@@ -42,5 +45,5 @@ info:
42
45
 
43
46
  ## done ##
44
47
 
45
- .PHONY: build info push spec
48
+ .PHONY: count_lines gemspec_validate name cw build push spec info
46
49
 
data/README.md CHANGED
@@ -27,6 +27,12 @@ EtOrbi::EoTime.new(0, 'UTC').to_s
27
27
  # => "1970-01-01 00:00:00 +0000"
28
28
  EtOrbi::EoTime.new(0, 'Europe/Moscow').to_s
29
29
  # => "1970-01-01 03:00:00 +0300"
30
+ EtOrbi::EoTime.new(0, 'Europe/Moscow').to_zs
31
+ # => "1970-01-01 03:00:00 Europe/Moscow" # "be precise in your speech"
32
+
33
+ EtOrbi.parse('1970-01-01 03:00:00 Europe/Moscow')
34
+ # => #<EtOrbi::EoTime:0x00007fa4bc83fcd0
35
+ # @seconds=0.0, @zone=#<TZInfo::DataTimezone: Europe/Moscow>, @time=nil>
30
36
  ```
31
37
 
32
38
  More about `EtOrbi::EoTime` instances:
@@ -9,7 +9,7 @@ require 'et-orbi/zone_aliases'
9
9
 
10
10
  module EtOrbi
11
11
 
12
- VERSION = '1.1.2'
12
+ VERSION = '1.1.3'
13
13
 
14
14
  #
15
15
  # module methods
@@ -315,7 +315,8 @@ module EtOrbi
315
315
  (defined?(TZInfo::Data) ? '' : "\nand adding gem 'tzinfo-data'")
316
316
  ) unless @zone
317
317
 
318
- @time = nil # cache for #to_time result
318
+ @time = nil
319
+ # cache for #to_time result
319
320
  end
320
321
 
321
322
  def seconds=(f)
@@ -330,6 +331,23 @@ module EtOrbi
330
331
  @zone = self.class.get_tzone(zone || :current)
331
332
  end
332
333
 
334
+ # Returns true if this EoTime instance corresponds to 2 different UTC
335
+ # times.
336
+ # It happens when transitioning from DST to winter time.
337
+ #
338
+ # https://www.timeanddate.com/time/change/usa/new-york?year=2018
339
+ #
340
+ def ambiguous?
341
+
342
+ @zone.local_to_utc(@zone.utc_to_local(utc))
343
+
344
+ false
345
+
346
+ rescue TZInfo::AmbiguousTime => e
347
+
348
+ true
349
+ end
350
+
333
351
  # Returns this ::EtOrbi::EoTime as a ::Time instance
334
352
  # in the current UTC timezone.
335
353
  #
@@ -464,6 +482,11 @@ module EtOrbi
464
482
  strftime('%Y-%m-%d %H:%M:%S %z')
465
483
  end
466
484
 
485
+ def to_zs
486
+
487
+ strftime('%Y-%m-%d %H:%M:%S %/Z')
488
+ end
489
+
467
490
  def iso8601(fraction_digits=0)
468
491
 
469
492
  s = (fraction_digits || 0) > 0 ? ".%#{fraction_digits}N" : ''
@@ -527,7 +550,7 @@ module EtOrbi
527
550
  #
528
551
  def to_time
529
552
 
530
- @time ||= begin; u = utc; @zone.utc_to_local(u); end
553
+ @time ||= @zone.utc_to_local(utc)
531
554
  end
532
555
 
533
556
  def count_weeks(dir)
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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-24 00:00:00.000000000 Z
11
+ date: 2018-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.6.13
78
+ rubygems_version: 2.5.2
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: time with zones