iso8601 0.11.0 → 0.13.0
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/LICENSE +1 -1
- data/README.md +13 -22
- data/lib/iso8601.rb +2 -0
- data/lib/iso8601/atomic.rb +2 -0
- data/lib/iso8601/date.rb +4 -0
- data/lib/iso8601/date_time.rb +6 -2
- data/lib/iso8601/days.rb +2 -0
- data/lib/iso8601/duration.rb +6 -2
- data/lib/iso8601/errors.rb +2 -0
- data/lib/iso8601/hours.rb +2 -0
- data/lib/iso8601/minutes.rb +2 -0
- data/lib/iso8601/months.rb +4 -1
- data/lib/iso8601/seconds.rb +2 -0
- data/lib/iso8601/time.rb +5 -3
- data/lib/iso8601/time_interval.rb +2 -0
- data/lib/iso8601/version.rb +3 -1
- data/lib/iso8601/weeks.rb +2 -0
- data/lib/iso8601/years.rb +5 -0
- data/spec/iso8601/date_spec.rb +2 -0
- data/spec/iso8601/date_time_spec.rb +2 -0
- data/spec/iso8601/days_spec.rb +2 -0
- data/spec/iso8601/duration_spec.rb +9 -0
- data/spec/iso8601/hours_spec.rb +2 -0
- data/spec/iso8601/minutes_spec.rb +2 -0
- data/spec/iso8601/months_spec.rb +7 -0
- data/spec/iso8601/seconds_spec.rb +2 -0
- data/spec/iso8601/time_interval_spec.rb +2 -0
- data/spec/iso8601/time_spec.rb +2 -0
- data/spec/iso8601/weeks_spec.rb +2 -0
- data/spec/iso8601/years_spec.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- metadata +58 -35
- data/CHANGELOG.md +0 -110
- data/CONTRIBUTING.md +0 -57
- data/Gemfile +0 -3
- data/Rakefile +0 -1
- data/iso8601.gemspec +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2974ec0c720d241b0a0911daf76b75ed14b3ebd6c7d7281928e378020dfead9c
|
4
|
+
data.tar.gz: 6b2259287505b9a2cbc55f45b0f79ba1d997398a415e905372c28736a3a3ac52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5eaea339d00bd45c42e0851e2c53690752e845fd032df04f1fd56f459125af1153c1165a6871861e6b7ac7ce9814fdadd4e24081bdcc13aa03a44dd408947f
|
7
|
+
data.tar.gz: 6dc46e177556b17d5545e469fd624071db4dfbd914557b6c641b3bfec04e6af295d2f7c024940cb4777f4c78cb88a271c85147efed2a11299154227373c5bcf8
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# ISO8601
|
2
2
|
|
3
|
+
**[New maintainer wanted](https://github.com/arnau/ISO8601/issues/50)**
|
4
|
+
|
3
5
|
Version 0.9.0 is **not compatible** with previous versions. Atoms and Durations
|
4
6
|
changed their interface when treating base dates so it is only applied when
|
5
7
|
computing the Atom length (e.g. `#to_seconds`). As a consequence, it is no
|
@@ -9,8 +11,6 @@ Version 1.0.0 will lock public interfaces.
|
|
9
11
|
|
10
12
|
Check the [changelog](https://github.com/arnau/ISO8601/blob/master/CHANGELOG.md) if you are upgrading from an older version.
|
11
13
|
|
12
|
-
[](https://gitter.im/arnau/ISO8601?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
13
|
-
|
14
14
|
ISO8601 is a simple implementation of the ISO 8601 (Data elements and
|
15
15
|
interchange formats — Information interchange — Representation of dates and
|
16
16
|
times) standard.
|
@@ -18,13 +18,11 @@ times) standard.
|
|
18
18
|
## Build status
|
19
19
|
|
20
20
|
[](http://travis-ci.org/arnau/ISO8601/)
|
21
|
-
[](https://gemnasium.com/arnau/ISO8601)
|
22
21
|
[](http://badge.fury.io/rb/iso8601)
|
23
22
|
|
24
23
|
## Supported versions
|
25
24
|
|
26
|
-
* MRI 2.
|
27
|
-
* JRuby 9
|
25
|
+
* MRI 2.5, 2.6, 2.7
|
28
26
|
|
29
27
|
## Documentation
|
30
28
|
|
@@ -38,26 +36,18 @@ take a look to the implementation notes:
|
|
38
36
|
|
39
37
|
## Testing
|
40
38
|
|
39
|
+
Install a Ruby version. E.g. you can install Ruby 2.7 with:
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
$ make install
|
46
|
-
$ make test
|
47
|
-
|
48
|
-
You can alse target specific runtimes:
|
41
|
+
```
|
42
|
+
$ nix-shell
|
43
|
+
```
|
49
44
|
|
50
|
-
|
51
|
-
$ make jruby-test
|
52
|
-
|
53
|
-
### Raw
|
54
|
-
|
55
|
-
The old fashion way:
|
56
|
-
|
57
|
-
# Install a Ruby flavour
|
58
|
-
$ bundle install
|
59
|
-
$ bundle exec rspec
|
45
|
+
Then
|
60
46
|
|
47
|
+
```
|
48
|
+
$ bundle install
|
49
|
+
$ bundle exec rake
|
50
|
+
```
|
61
51
|
|
62
52
|
## Contributing
|
63
53
|
|
@@ -65,6 +55,7 @@ The old fashion way:
|
|
65
55
|
|
66
56
|
Please see [CONTRIBUTING.md](./CONTRIBUTING.md)
|
67
57
|
|
58
|
+
|
68
59
|
## License
|
69
60
|
|
70
61
|
Arnau Siches under the [MIT License](https://github.com/arnau/ISO8601/blob/master/LICENSE)
|
data/lib/iso8601.rb
CHANGED
data/lib/iso8601/atomic.rb
CHANGED
data/lib/iso8601/date.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ISO8601
|
2
4
|
##
|
3
5
|
# A Date representation.
|
@@ -112,6 +114,7 @@ module ISO8601
|
|
112
114
|
# @param [String] input
|
113
115
|
#
|
114
116
|
# @return [Array<Integer>]
|
117
|
+
#
|
115
118
|
# rubocop:disable Metrics/AbcSize
|
116
119
|
def atomize(input)
|
117
120
|
week_date = parse_weekdate(input)
|
@@ -128,6 +131,7 @@ module ISO8601
|
|
128
131
|
|
129
132
|
[year, month, day].compact.map(&:to_i)
|
130
133
|
end
|
134
|
+
# rubocop:enable Metrics/AbcSize
|
131
135
|
|
132
136
|
def parse_weekdate(input)
|
133
137
|
/^([+-]?)\d{4}(-?)W\d{2}(?:\2\d)?$/.match(input)
|
data/lib/iso8601/date_time.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ISO8601
|
2
4
|
##
|
3
5
|
# A DateTime representation
|
@@ -47,9 +49,9 @@ module ISO8601
|
|
47
49
|
##
|
48
50
|
# Converts DateTime to a formated string
|
49
51
|
def to_s
|
50
|
-
second_format =
|
52
|
+
second_format = (second % 1).zero? ? '%02d' : '%04.1f'
|
51
53
|
|
52
|
-
format("%04d-%02d-%02dT%02d:%02d:#{second_format}
|
54
|
+
format("%04d-%02d-%02dT%02d:%02d:#{second_format}%s", *atoms)
|
53
55
|
end
|
54
56
|
|
55
57
|
##
|
@@ -96,6 +98,7 @@ module ISO8601
|
|
96
98
|
# It enhances the parsing capabilities of the native DateTime.
|
97
99
|
#
|
98
100
|
# @param [String] date_time The ISO representation
|
101
|
+
#
|
99
102
|
# rubocop:disable Metrics/AbcSize
|
100
103
|
def parse(date_time)
|
101
104
|
raise(ISO8601::Errors::UnknownPattern, date_time) if date_time.empty?
|
@@ -111,6 +114,7 @@ module ISO8601
|
|
111
114
|
|
112
115
|
::DateTime.new(*(date_atoms + time_atoms).compact)
|
113
116
|
end
|
117
|
+
# rubocop:enable Metrics/AbcSize
|
114
118
|
|
115
119
|
##
|
116
120
|
# Validates the date has the right pattern.
|
data/lib/iso8601/days.rb
CHANGED
data/lib/iso8601/duration.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ISO8601
|
2
4
|
##
|
3
5
|
# A duration representation. When no base is provided, all atoms use an
|
@@ -21,8 +23,6 @@ module ISO8601
|
|
21
23
|
# dp = ISO8601::Duration.new('P2Y1MT2H')
|
22
24
|
# di == dp # => true
|
23
25
|
# di == ds # => true
|
24
|
-
#
|
25
|
-
# rubocop:disable Metrics/ClassLength
|
26
26
|
class Duration
|
27
27
|
##
|
28
28
|
# @param [String, Numeric] input The duration pattern
|
@@ -244,6 +244,7 @@ module ISO8601
|
|
244
244
|
# @param [Numeric] value The seconds to promote
|
245
245
|
#
|
246
246
|
# @return [ISO8601::Duration]
|
247
|
+
#
|
247
248
|
# rubocop:disable Metrics/AbcSize
|
248
249
|
def seconds_to_iso(value)
|
249
250
|
return self.class.new('PT0S') if value.zero?
|
@@ -263,6 +264,7 @@ module ISO8601
|
|
263
264
|
|
264
265
|
self.class.new(date + time)
|
265
266
|
end
|
267
|
+
# rubocop:enable Metrics/AbcSize
|
266
268
|
|
267
269
|
def decompose_atom(value, atom)
|
268
270
|
[atom.class.new((value / atom.factor).to_i), (value % atom.factor)]
|
@@ -282,6 +284,7 @@ module ISO8601
|
|
282
284
|
input
|
283
285
|
end
|
284
286
|
|
287
|
+
# rubocop:disable Metrics/AbcSize
|
285
288
|
def valid_pattern?(components)
|
286
289
|
date = [components[:years],
|
287
290
|
components[:months],
|
@@ -297,6 +300,7 @@ module ISO8601
|
|
297
300
|
|
298
301
|
raise(ISO8601::Errors::UnknownPattern, @pattern) if empty
|
299
302
|
end
|
303
|
+
# rubocop:enable Metrics/AbcSize
|
300
304
|
|
301
305
|
def valid_fractions?(values)
|
302
306
|
values = values.reject(&:zero?)
|
data/lib/iso8601/errors.rb
CHANGED
data/lib/iso8601/hours.rb
CHANGED
data/lib/iso8601/minutes.rb
CHANGED
data/lib/iso8601/months.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ISO8601
|
2
4
|
##
|
3
5
|
# A Months atom in a {ISO8601::Duration}
|
@@ -76,10 +78,11 @@ module ISO8601
|
|
76
78
|
else
|
77
79
|
month = initial <= 12 ? initial : (initial % 12)
|
78
80
|
month = 12 if month.zero?
|
79
|
-
year = base.year
|
81
|
+
year = initial <= 12 ? base.year : base.year + (initial / 12).to_i
|
80
82
|
end
|
81
83
|
|
82
84
|
(::Time.utc(year, month) - ::Time.utc(base.year, base.month)) / atom
|
83
85
|
end
|
86
|
+
# rubocop:enable Metrics/AbcSize
|
84
87
|
end
|
85
88
|
end
|
data/lib/iso8601/seconds.rb
CHANGED
data/lib/iso8601/time.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ISO8601
|
2
4
|
##
|
3
5
|
# A Time representation
|
@@ -113,6 +115,7 @@ module ISO8601
|
|
113
115
|
# @param [String] input
|
114
116
|
#
|
115
117
|
# @return [Array<Integer, Float>]
|
118
|
+
#
|
116
119
|
# rubocop:disable Metrics/AbcSize
|
117
120
|
def atomize(input)
|
118
121
|
_, time, zone = parse_timezone(input)
|
@@ -133,6 +136,7 @@ module ISO8601
|
|
133
136
|
|
134
137
|
atoms
|
135
138
|
end
|
139
|
+
# rubocop:enable Metrics/AbcSize
|
136
140
|
|
137
141
|
def require_separator(input)
|
138
142
|
!input.nil?
|
@@ -164,9 +168,7 @@ module ISO8601
|
|
164
168
|
_, offset, separator = zone_regexp.match(zone).to_a.compact
|
165
169
|
|
166
170
|
wrong_pattern = !zone.nil? && offset.nil?
|
167
|
-
if require_separator
|
168
|
-
invalid_separators = zone.to_s.match(/^[+-]\d{2}:?\d{2}$/) && (@separator != separator)
|
169
|
-
end
|
171
|
+
invalid_separators = zone.to_s.match(/^[+-]\d{2}:?\d{2}$/) && (@separator != separator) if require_separator
|
170
172
|
|
171
173
|
!(wrong_pattern || invalid_separators)
|
172
174
|
end
|
data/lib/iso8601/version.rb
CHANGED
data/lib/iso8601/weeks.rb
CHANGED
data/lib/iso8601/years.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ISO8601
|
2
4
|
##
|
3
5
|
# A Years atom in a {ISO8601::Duration}
|
@@ -51,14 +53,17 @@ module ISO8601
|
|
51
53
|
# the year length.
|
52
54
|
#
|
53
55
|
# @return [Numeric]
|
56
|
+
#
|
54
57
|
# rubocop:disable Metrics/AbcSize
|
55
58
|
def to_seconds(base = nil)
|
56
59
|
valid_base?(base)
|
57
60
|
return factor(base) * atom if base.nil?
|
61
|
+
|
58
62
|
target = ::Time.new(base.year + atom.to_i, base.month, base.day, base.hour, base.minute, base.second, base.zone)
|
59
63
|
|
60
64
|
target - base.to_time
|
61
65
|
end
|
66
|
+
# rubocop:enable Metrics/AbcSize
|
62
67
|
|
63
68
|
##
|
64
69
|
# The atom symbol.
|
data/spec/iso8601/date_spec.rb
CHANGED
data/spec/iso8601/days_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
RSpec.describe ISO8601::Duration do
|
@@ -7,6 +9,9 @@ RSpec.describe ISO8601::Duration do
|
|
7
9
|
let(:common_february) { ISO8601::DateTime.new('2010-02-01') }
|
8
10
|
let(:leap_february) { ISO8601::DateTime.new('2000-02-01') }
|
9
11
|
|
12
|
+
let(:common_november) { ISO8601::DateTime.new('2010-11-01') }
|
13
|
+
let(:common_december) { ISO8601::DateTime.new('2010-12-01') }
|
14
|
+
|
10
15
|
it "should raise a ISO8601::Errors::UnknownPattern for any unknown pattern" do
|
11
16
|
expect { ISO8601::Duration.new('') }.to raise_error(ISO8601::Errors::UnknownPattern)
|
12
17
|
expect { ISO8601::Duration.new('P') }.to raise_error(ISO8601::Errors::UnknownPattern)
|
@@ -120,6 +125,10 @@ RSpec.describe ISO8601::Duration do
|
|
120
125
|
expect(ISO8601::Duration.new('P1M').to_seconds(common_year)).to eq(2678400)
|
121
126
|
expect(ISO8601::Duration.new('P19M').to_seconds(ISO8601::DateTime.new('2012-05-01'))).to eq(Time.utc(2014, 12) - Time.utc(2012, 5))
|
122
127
|
expect(ISO8601::Duration.new('P14M').to_seconds(common_year)).to eq(Time.utc(2011, 3) - Time.utc(2010, 1))
|
128
|
+
expect(ISO8601::Duration.new('P1M').to_seconds(common_november)).to eq(Time.utc(2010, 12) - Time.utc(2010, 11))
|
129
|
+
expect(ISO8601::Duration.new('P1M').to_seconds(common_december)).to eq(Time.utc(2011, 1) - Time.utc(2010, 12))
|
130
|
+
expect(ISO8601::Duration.new('P2M').to_seconds(common_november)).to eq(Time.utc(2011, 1) - Time.utc(2010, 11))
|
131
|
+
expect(ISO8601::Duration.new('P3M').to_seconds(common_november)).to eq(Time.utc(2011, 2) - Time.utc(2010, 11))
|
123
132
|
end
|
124
133
|
|
125
134
|
it "should return the seconds of a P[n]M duration in a leap year" do
|
data/spec/iso8601/hours_spec.rb
CHANGED
data/spec/iso8601/months_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
RSpec.describe ISO8601::Months do
|
@@ -7,6 +9,8 @@ RSpec.describe ISO8601::Months do
|
|
7
9
|
let(:common_february) { ISO8601::DateTime.new('2010-02-01') }
|
8
10
|
let(:leap_february) { ISO8601::DateTime.new('2000-02-01') }
|
9
11
|
|
12
|
+
let(:common_november) { ISO8601::DateTime.new('2017-11-01') }
|
13
|
+
|
10
14
|
let(:common_december) { ISO8601::DateTime.new('2017-12-01') }
|
11
15
|
let(:leap_december) { ISO8601::DateTime.new('2000-12-01') }
|
12
16
|
|
@@ -62,6 +66,9 @@ RSpec.describe ISO8601::Months do
|
|
62
66
|
expect(ISO8601::Months.new(1).to_seconds(common_year)).to eq(2678400)
|
63
67
|
expect(ISO8601::Months.new(0).to_seconds(common_year)).to eq(0)
|
64
68
|
expect(ISO8601::Months.new(0).to_seconds(common_december)).to eq(0)
|
69
|
+
expect(ISO8601::Months.new(2).to_seconds(common_november)).to eq(5270400)
|
70
|
+
expect(ISO8601::Months.new(1).to_seconds(common_november)).to eq(2592000)
|
71
|
+
expect(ISO8601::Months.new(0).to_seconds(common_november)).to eq(0)
|
65
72
|
end
|
66
73
|
|
67
74
|
it "should return the amount of seconds for a leap year" do
|
data/spec/iso8601/time_spec.rb
CHANGED
data/spec/iso8601/weeks_spec.rb
CHANGED
data/spec/iso8601/years_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso8601
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnau Siches
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: pry
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.13.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.13.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: pry-doc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.1.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.85'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.85'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-packaging
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
89
|
+
version: 0.1.1
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
96
|
+
version: 0.1.1
|
69
97
|
description: |2
|
70
98
|
ISO8601 is a simple implementation in Ruby of the ISO 8601 (Data elements and
|
71
99
|
interchange formats - Information interchange - Representation of dates
|
@@ -75,16 +103,11 @@ executables: []
|
|
75
103
|
extensions: []
|
76
104
|
extra_rdoc_files: []
|
77
105
|
files:
|
78
|
-
- CHANGELOG.md
|
79
|
-
- CONTRIBUTING.md
|
80
|
-
- Gemfile
|
81
106
|
- LICENSE
|
82
107
|
- README.md
|
83
|
-
- Rakefile
|
84
108
|
- docs/date-time.md
|
85
109
|
- docs/duration.md
|
86
110
|
- docs/time-interval.md
|
87
|
-
- iso8601.gemspec
|
88
111
|
- lib/iso8601.rb
|
89
112
|
- lib/iso8601/atomic.rb
|
90
113
|
- lib/iso8601/date.rb
|
@@ -117,8 +140,9 @@ files:
|
|
117
140
|
homepage: https://github.com/arnau/ISO8601
|
118
141
|
licenses:
|
119
142
|
- MIT
|
120
|
-
metadata:
|
121
|
-
|
143
|
+
metadata:
|
144
|
+
yard.run: yri
|
145
|
+
post_install_message:
|
122
146
|
rdoc_options: []
|
123
147
|
require_paths:
|
124
148
|
- lib
|
@@ -126,29 +150,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
150
|
requirements:
|
127
151
|
- - ">="
|
128
152
|
- !ruby/object:Gem::Version
|
129
|
-
version: 2.
|
153
|
+
version: 2.4.0
|
130
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
155
|
requirements:
|
132
156
|
- - ">="
|
133
157
|
- !ruby/object:Gem::Version
|
134
158
|
version: '0'
|
135
159
|
requirements: []
|
136
|
-
|
137
|
-
|
138
|
-
signing_key:
|
160
|
+
rubygems_version: 3.1.2
|
161
|
+
signing_key:
|
139
162
|
specification_version: 4
|
140
163
|
summary: Ruby parser to work with ISO 8601 dateTimes and durations - http://en.wikipedia.org/wiki/ISO_8601
|
141
164
|
test_files:
|
165
|
+
- spec/spec_helper.rb
|
166
|
+
- spec/iso8601/minutes_spec.rb
|
167
|
+
- spec/iso8601/time_spec.rb
|
168
|
+
- spec/iso8601/seconds_spec.rb
|
142
169
|
- spec/iso8601/date_spec.rb
|
143
|
-
- spec/iso8601/
|
170
|
+
- spec/iso8601/years_spec.rb
|
144
171
|
- spec/iso8601/days_spec.rb
|
145
|
-
- spec/iso8601/
|
172
|
+
- spec/iso8601/weeks_spec.rb
|
173
|
+
- spec/iso8601/date_time_spec.rb
|
146
174
|
- spec/iso8601/hours_spec.rb
|
147
|
-
- spec/iso8601/minutes_spec.rb
|
148
|
-
- spec/iso8601/months_spec.rb
|
149
|
-
- spec/iso8601/seconds_spec.rb
|
150
175
|
- spec/iso8601/time_interval_spec.rb
|
151
|
-
- spec/iso8601/
|
152
|
-
- spec/iso8601/
|
153
|
-
- spec/iso8601/years_spec.rb
|
154
|
-
- spec/spec_helper.rb
|
176
|
+
- spec/iso8601/duration_spec.rb
|
177
|
+
- spec/iso8601/months_spec.rb
|
data/CHANGELOG.md
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
## 0.11.0
|
2
|
-
|
3
|
-
* Add support for unary minus operator (thanks @walterbrebels).
|
4
|
-
|
5
|
-
## 0.10.1
|
6
|
-
|
7
|
-
* Fix `TimeInterval` size for non UTC timezones. (#41)
|
8
|
-
|
9
|
-
## 0.10.0
|
10
|
-
|
11
|
-
* Fix `TimeInterval` with `<duration>/<end>` patterns and leap years.
|
12
|
-
* Fix decimal fractions on date atoms. **WARNING** some duration patterns are
|
13
|
-
no longer valid.
|
14
|
-
|
15
|
-
## 0.9.1
|
16
|
-
|
17
|
-
* Fix `Duration#to_pattern` for negative durations based on a `Numeric` (thanks @figwit).
|
18
|
-
|
19
|
-
## 0.9.0
|
20
|
-
|
21
|
-
This version is **not compatible** with previous versions. Atoms and Durations
|
22
|
-
changed their interface when treating base dates so it is only applied when
|
23
|
-
computing the Atom length (e.g. `#to_seconds`). As a consequence, it is no
|
24
|
-
longer possible to do operations like `DateTime + Duration`.
|
25
|
-
|
26
|
-
* Add time intervals (thanks @Angelmmiguel).
|
27
|
-
* Remove `Duration#to_i`.
|
28
|
-
* Change `Duration#to_seconds` to accept a base `DateTime`.
|
29
|
-
* Remove duration dependency on a base date on the instance level.
|
30
|
-
* Change `Years#to_seconds` and `Months#to_seconds` to accept a base `DateTime`.
|
31
|
-
* Remove atom dependency on a base date on the instance level.
|
32
|
-
* Add `Atomic` mixin.
|
33
|
-
* Remove `Atom` abstract class.
|
34
|
-
* Allow `ISO8601::Duration` to perform operations with `Numeric` (thanks @Angelmmiguel).
|
35
|
-
|
36
|
-
## 0.8.7
|
37
|
-
|
38
|
-
* Make `Atom` comparable with the same kind (thanks @glassbead0).
|
39
|
-
* Fix #18 document interfaces to core date/time classes.
|
40
|
-
|
41
|
-
## 0.8.6
|
42
|
-
|
43
|
-
* Fix #26 operations with Date, DateTime and Time with Duration (e.g. `ISO8601::DateTime.new('2012-07-07T20:20:20Z') - ISO8601::Duration.new('PT10M')`).
|
44
|
-
* Fix #25 accept time components with timezone and only hour component (e.g. `ISO8601::Time.new('T10+01:00')`).
|
45
|
-
* Fix Docker image for testing and inspecting.
|
46
|
-
|
47
|
-
## 0.8.5
|
48
|
-
|
49
|
-
* Fix `DateTime#hash`
|
50
|
-
* Fix `DateTime#second` and `Time#second` precision. Now it's rounded to the
|
51
|
-
first decimal.
|
52
|
-
|
53
|
-
## 0.8.4
|
54
|
-
|
55
|
-
* Remove unwanted log.
|
56
|
-
|
57
|
-
## 0.8.3
|
58
|
-
|
59
|
-
* Fix partial time patterns with timezone: `PThh:mmZ`, `PThhZ`.
|
60
|
-
|
61
|
-
## 0.8.2
|
62
|
-
|
63
|
-
* Fix time components using comma (,) as a decimal separator.
|
64
|
-
|
65
|
-
## 0.8.1
|
66
|
-
|
67
|
-
* Fix durations using comma (,) as a decimal separator.
|
68
|
-
|
69
|
-
## 0.8.0
|
70
|
-
|
71
|
-
* `DateTime` has hash identity by value.
|
72
|
-
* `Time` has hash identity by value.
|
73
|
-
* `Date` has hash identity by value.
|
74
|
-
* `Duration` has hash identity by value.
|
75
|
-
* `Atom` has hash identity by value.
|
76
|
-
* `Atom#value` returns either an integer or a float.
|
77
|
-
* `Atom#to_s` returns a valid ISO8601 subpattern.
|
78
|
-
|
79
|
-
## 0.7.0
|
80
|
-
|
81
|
-
* Add decimal fractions for any component in a duration.
|
82
|
-
* Add a catch all `ISO8601::Errors::StandardError`.
|
83
|
-
* Add support for comma (`,`) as a separator for duration decimal fractions.
|
84
|
-
|
85
|
-
## 0.6.0
|
86
|
-
|
87
|
-
* Add `#hash` to `Duration`, `Date`, `Time` and `DateTime`.
|
88
|
-
|
89
|
-
## 0.5.2
|
90
|
-
|
91
|
-
* Fix `DateTime` when handling empty strings.
|
92
|
-
|
93
|
-
## 0.5.1
|
94
|
-
|
95
|
-
* Fix durations with sign.
|
96
|
-
|
97
|
-
## 0.5.0
|
98
|
-
|
99
|
-
* Drop support for Ruby 1.8.7.
|
100
|
-
* Add support for Rubinius 2.
|
101
|
-
* `ISO8601::DateTime#century` no longer exists. Truncated representations were
|
102
|
-
removed in ISO 8601:2004.
|
103
|
-
* `ISO8601::DateTime#zone` delegates to core `DateTime#zone`.
|
104
|
-
* `ISO8601::DateTime#timezone` no longer exists. Now it delegates to
|
105
|
-
`DateTime#zone`.
|
106
|
-
* A date can have sign: `-1000-01-01`, `+2014-05-06T10:11:12Z`.
|
107
|
-
* A date time can be converted to an array of atoms with `#to_a`.
|
108
|
-
* Ordinal dates supported.
|
109
|
-
* A date component is represented by `ISO8601::Date`.
|
110
|
-
* Week date pattern (YYYY-Wdww, YYYY-Www-D).
|
data/CONTRIBUTING.md
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
Thanks for taking the time to submit a pull request! These are the few
|
4
|
-
guidelines to keep things coherent.
|
5
|
-
|
6
|
-
[Fork the project](http://github.com/arnau/ISO8601/fork) and clone.
|
7
|
-
|
8
|
-
Create your _feature_ branch:
|
9
|
-
|
10
|
-
```sh
|
11
|
-
git checkout -b features/xyz
|
12
|
-
```
|
13
|
-
|
14
|
-
Set up your machine. I recommend using [Docker](https://docker.com):
|
15
|
-
|
16
|
-
```sh
|
17
|
-
make install
|
18
|
-
```
|
19
|
-
|
20
|
-
But of course you can go raw style
|
21
|
-
|
22
|
-
```sh
|
23
|
-
bundle install
|
24
|
-
```
|
25
|
-
|
26
|
-
Add your code and tests and check it passes:
|
27
|
-
|
28
|
-
```sh
|
29
|
-
make test # mri, jruby
|
30
|
-
# or
|
31
|
-
make mri-test
|
32
|
-
make jruby-test
|
33
|
-
```
|
34
|
-
|
35
|
-
Or raw style
|
36
|
-
|
37
|
-
```sh
|
38
|
-
bundle exec rspec
|
39
|
-
```
|
40
|
-
|
41
|
-
Although not required, try to adhere to Rubocop's checks:
|
42
|
-
|
43
|
-
```sh
|
44
|
-
make check
|
45
|
-
```
|
46
|
-
|
47
|
-
Or raw style
|
48
|
-
|
49
|
-
```sh
|
50
|
-
bundle exec rubocop
|
51
|
-
```
|
52
|
-
|
53
|
-
Push your branch and submit a [Pull Request](https://github.com/arnau/iso8601/compare/).
|
54
|
-
|
55
|
-
Add a description of your proposed changes and why they are needed.
|
56
|
-
|
57
|
-
I'll review it as soon as I can.
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
data/iso8601.gemspec
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
-
require 'iso8601/version'
|
3
|
-
|
4
|
-
# rubocop:disable Metrics/BlockLength
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = 'iso8601'
|
7
|
-
s.version = ISO8601::VERSION
|
8
|
-
s.date = Time.now.strftime('%Y-%m-%d')
|
9
|
-
s.authors = ['Arnau Siches']
|
10
|
-
s.email = 'arnau.siches@gmail.com'
|
11
|
-
s.homepage = 'https://github.com/arnau/ISO8601'
|
12
|
-
s.summary = "Ruby parser to work with ISO 8601 dateTimes and durations - http://en.wikipedia.org/wiki/ISO_8601"
|
13
|
-
s.description = <<-DESC
|
14
|
-
ISO8601 is a simple implementation in Ruby of the ISO 8601 (Data elements and
|
15
|
-
interchange formats - Information interchange - Representation of dates
|
16
|
-
and times) standard.
|
17
|
-
DESC
|
18
|
-
s.license = 'MIT'
|
19
|
-
s.rubyforge_project = 'iso8601'
|
20
|
-
s.files = %w[CHANGELOG.md
|
21
|
-
CONTRIBUTING.md
|
22
|
-
Gemfile
|
23
|
-
LICENSE
|
24
|
-
README.md
|
25
|
-
Rakefile
|
26
|
-
iso8601.gemspec
|
27
|
-
docs/date-time.md
|
28
|
-
docs/duration.md
|
29
|
-
docs/time-interval.md
|
30
|
-
lib/iso8601.rb
|
31
|
-
lib/iso8601/atomic.rb
|
32
|
-
lib/iso8601/date.rb
|
33
|
-
lib/iso8601/date_time.rb
|
34
|
-
lib/iso8601/days.rb
|
35
|
-
lib/iso8601/duration.rb
|
36
|
-
lib/iso8601/errors.rb
|
37
|
-
lib/iso8601/hours.rb
|
38
|
-
lib/iso8601/minutes.rb
|
39
|
-
lib/iso8601/months.rb
|
40
|
-
lib/iso8601/seconds.rb
|
41
|
-
lib/iso8601/time.rb
|
42
|
-
lib/iso8601/time_interval.rb
|
43
|
-
lib/iso8601/version.rb
|
44
|
-
lib/iso8601/weeks.rb
|
45
|
-
lib/iso8601/years.rb
|
46
|
-
spec/iso8601/date_spec.rb
|
47
|
-
spec/iso8601/date_time_spec.rb
|
48
|
-
spec/iso8601/days_spec.rb
|
49
|
-
spec/iso8601/duration_spec.rb
|
50
|
-
spec/iso8601/hours_spec.rb
|
51
|
-
spec/iso8601/minutes_spec.rb
|
52
|
-
spec/iso8601/months_spec.rb
|
53
|
-
spec/iso8601/seconds_spec.rb
|
54
|
-
spec/iso8601/time_interval_spec.rb
|
55
|
-
spec/iso8601/time_spec.rb
|
56
|
-
spec/iso8601/weeks_spec.rb
|
57
|
-
spec/iso8601/years_spec.rb
|
58
|
-
spec/spec_helper.rb]
|
59
|
-
s.test_files = s.files.grep(%r{^spec/})
|
60
|
-
s.require_paths = ['lib']
|
61
|
-
|
62
|
-
s.has_rdoc = 'yard'
|
63
|
-
s.required_ruby_version = '>= 2.0.0'
|
64
|
-
s.add_development_dependency 'rspec', '~> 3.6'
|
65
|
-
s.add_development_dependency 'rubocop', '~> 0.50'
|
66
|
-
s.add_development_dependency 'pry', '~> 0.11.0'
|
67
|
-
s.add_development_dependency 'pry-doc', '~> 0.13.4'
|
68
|
-
end
|