timesteps 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timesteps/datetime_parse_timestamp.rb +4 -0
- data/spec/timestep_spec.rb +6 -0
- data/timesteps.gemspec +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: f2250572f5f280515d33d4928c198739ba3f5ba9c69ad3dfeb64ee55d982a206
|
4
|
+
data.tar.gz: 38a8b7b8e6339cfa77665c60194eab228ccb2eabdae71617955a0fe2beb2b303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d21b7ad3e786ffca4966c9c7be8637ee316dd91a0e8bf9703c59ccb054c18cd4e3be9fb50f1056b07fac6e7d0391f4718123aeab677ceb2a62801289c810996
|
7
|
+
data.tar.gz: 56462ea294eab5163d9bad21b36939bc3f6cb02204c02efccdc697def79b03298d5de517cabc1ecc1ff5dc0a507217903e23e79e098aea8c801f2868600d2a1a
|
@@ -45,6 +45,10 @@ class DateTime
|
|
45
45
|
mday = 1
|
46
46
|
rest = $4
|
47
47
|
hash = DateTime._parse("#{year}-#{month}-#{mday} 00:00:00 #{rest}")
|
48
|
+
elsif spec =~ /\A(\d{1,2}:\d{2}(:\d{2})?)\s*([+\-]\d{1,2}(:\d{2})?)?\z/
|
49
|
+
time = $1
|
50
|
+
offset = $3 || ""
|
51
|
+
hash = DateTime._parse("1970-01-01 #{time}#{offset}")
|
48
52
|
else
|
49
53
|
hash = DateTime._parse(spec)
|
50
54
|
end
|
data/spec/timestep_spec.rb
CHANGED
@@ -135,6 +135,10 @@ describe "TimeStep.new" do
|
|
135
135
|
is_asserted_by { TimeStep.new("sec").origin == DateTime.new(1970,1,1) }
|
136
136
|
|
137
137
|
end
|
138
|
+
|
139
|
+
example 'without since hh:mm+hh:mm' do
|
140
|
+
is_asserted_by { TimeStep.new("3 hours since 02:00").origin == DateTime.new(1970,1,1,2,0) }
|
141
|
+
end
|
138
142
|
|
139
143
|
example 'since option with format' do
|
140
144
|
|
@@ -503,3 +507,5 @@ describe "TimeStep#truncate" do
|
|
503
507
|
end
|
504
508
|
|
505
509
|
end
|
510
|
+
|
511
|
+
|
data/timesteps.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timesteps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Motoyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
88
|
+
rubygems_version: 3.1.6
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: A library for handling discrete time series in constant increments
|