et-orbi 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/et-orbi.rb +22 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c44c3ff9dc84f7dd7e87950a02dfcb9496a390a
4
- data.tar.gz: 4c2ecd717ff29139f3689372368208cf9da040bf
3
+ metadata.gz: 92e8f11466211f94bfe4d872c6a1566af6c1cf9f
4
+ data.tar.gz: '091a7dd8dd6981ff58bd661091f1ee6f07c67f40'
5
5
  SHA512:
6
- metadata.gz: 58b50b5355dc89c6314b71a2b14bfd294a67ef4cc000bb500af3000e48e2b6741c8cf99e9509511920ee79870d4c36afe15677b9d7022d0cd5e816f6d61a56b6
7
- data.tar.gz: 6e2e3aac93b0d0eefee5dd833e932b60235e18c4ef98355d9859950717d50891fddb5fe5e220c27c2728897de8fa923a8abaedefdb7b0082bbcfbc93cfef0675
6
+ metadata.gz: abe51c5879807fe9b57f1487091bdaeee5ddbec7219824893d1f0068f6bae454400c980924e1eff5e9f4f30a76bcd165916e8430e57e041feae8f06b1ed30556
7
+ data.tar.gz: 406500144fbd7a87d61eb6cfe07e975fc05d5b9f50755b9a4a09326fae2a17997d99b15109c8d70d0d900492ed87518d2c0f0920f1d94573be5dbb97a100f265
@@ -2,6 +2,13 @@
2
2
  # et-orbi CHANGELOG.md
3
3
 
4
4
 
5
+ ## et-orbi 1.1.0 released 2018-03-25
6
+
7
+ - Implement EoTime .utc and .local (based on Time .utc and .local)
8
+ - Add EoTime#translate(target_zone) as #localtime(target_zone) alias
9
+ - Correct EoTime#iso8601 (was always returning zulu iso8601 string)
10
+
11
+
5
12
  ## et-orbi 1.0.9 released 2018-01-19
6
13
 
7
14
  - Silence EoTime#strfz warning
data/README.md CHANGED
@@ -73,7 +73,7 @@ Rails sets its timezone under `config/application.rb`.
73
73
  ### Sister projects
74
74
 
75
75
  * [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) - a cron/at/in/every/interval in-process scheduler, in fact, it's the father project to this fugit project
76
- * [fugit](https://github.com/floraison/fugit) - Time tools for flor and the floraison project. Cron parsing and occurence computing. Timestamps and more.
76
+ * [fugit](https://github.com/floraison/fugit) - Time tools for flor and the floraison project. Cron parsing and occurrence computing. Timestamps and more.
77
77
 
78
78
 
79
79
  ## LICENSE
@@ -7,7 +7,7 @@ require 'tzinfo'
7
7
 
8
8
  module EtOrbi
9
9
 
10
- VERSION = '1.0.9'
10
+ VERSION = '1.1.0'
11
11
 
12
12
  #
13
13
  # module methods
@@ -291,6 +291,16 @@ module EtOrbi
291
291
 
292
292
  EtOrbi.make_time(o)
293
293
  end
294
+
295
+ def utc(*a)
296
+
297
+ EtOrbi.make_from_array(a, EtOrbi.get_tzone('UTC'))
298
+ end
299
+
300
+ def local(*a)
301
+
302
+ EtOrbi.make_from_array(a, EtOrbi.local_tzone)
303
+ end
294
304
  end
295
305
 
296
306
  #
@@ -408,7 +418,6 @@ module EtOrbi
408
418
  ].each do |m|
409
419
  define_method(m) { to_time.send(m) }
410
420
  end
411
- def iso8601(fraction_digits=0); to_time.iso8601(fraction_digits); end
412
421
 
413
422
  def ==(o)
414
423
 
@@ -462,6 +471,12 @@ module EtOrbi
462
471
  strftime('%Y-%m-%d %H:%M:%S %z')
463
472
  end
464
473
 
474
+ def iso8601(fraction_digits=0)
475
+
476
+ s = (fraction_digits || 0) > 0 ? ".%#{fraction_digits}N" : ''
477
+ strftime("%Y-%m-%dT%H:%M:%S#{s}%:z")
478
+ end
479
+
465
480
  # Debug current time by showing local time / delta / utc time
466
481
  # for example: "0120-7(0820)"
467
482
  #
@@ -503,6 +518,8 @@ module EtOrbi
503
518
  EoTime.new(self.to_f, zone)
504
519
  end
505
520
 
521
+ alias translate localtime
522
+
506
523
  def wday_in_month
507
524
 
508
525
  [ count_weeks(-1), - count_weeks(1) ]
@@ -547,7 +564,9 @@ module EtOrbi
547
564
  mn = (off % 3600) / 60
548
565
  sc = 0
549
566
 
550
- if code == '%z'
567
+ if @zone.name == 'UTC'
568
+ 'Z' # align on Ruby ::Time#iso8601
569
+ elsif code == '%z'
551
570
  '%s%02d%02d' % [ sn, hr, mn ]
552
571
  elsif code == '%:z'
553
572
  '%s%02d:%02d' % [ sn, hr, mn ]
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.0.9
4
+ version: 1.1.0
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-01-19 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo