chronic 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +5 -0
- data/lib/chronic.rb +1 -1
- data/lib/chronic/chronic.rb +1 -1
- data/lib/chronic/time_zone.rb +2 -2
- data/test/test_parsing.rb +12 -0
- metadata +40 -23
data/HISTORY.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 0.6.2 / 2011-07-28
|
2
|
+
|
3
|
+
* Ensure specific endian handlers are prioritised over normal date handlers
|
4
|
+
* Recognize UTC as timezone and accept HH::MM timezone offset (Jason Dusek)
|
5
|
+
|
1
6
|
# 0.6.1 / 2011-07-21
|
2
7
|
|
3
8
|
* Ensure Handler definitions are executed in the correct order
|
data/lib/chronic.rb
CHANGED
data/lib/chronic/chronic.rb
CHANGED
@@ -284,7 +284,7 @@ module Chronic
|
|
284
284
|
def tokens_to_span(tokens, options)
|
285
285
|
definitions = definitions(options)
|
286
286
|
|
287
|
-
(definitions[:
|
287
|
+
(definitions[:endian] + definitions[:date]).each do |handler|
|
288
288
|
if handler.match(tokens, definitions)
|
289
289
|
good_tokens = tokens.select { |o| !o.get_tag Separator }
|
290
290
|
return handler.invoke(:date, good_tokens, options)
|
data/lib/chronic/time_zone.rb
CHANGED
data/test/test_parsing.rb
CHANGED
@@ -109,6 +109,12 @@ class TestParsing < Test::Unit::TestCase
|
|
109
109
|
def test_handle_sy_sm_sd_t_tz
|
110
110
|
time = parse_now("2011-07-03 22:11:35 +0100")
|
111
111
|
assert_equal 1309727495, time.to_i
|
112
|
+
|
113
|
+
time = parse_now("2011-07-03 22:11:35 +01:00")
|
114
|
+
assert_equal 1309727495, time.to_i
|
115
|
+
|
116
|
+
time = parse_now("2011-07-03 21:11:35 UTC")
|
117
|
+
assert_equal 1309727495, time.to_i
|
112
118
|
end
|
113
119
|
|
114
120
|
def test_handle_rmn_sd_sy
|
@@ -210,6 +216,12 @@ class TestParsing < Test::Unit::TestCase
|
|
210
216
|
time = parse_now("5/27/1979 4am")
|
211
217
|
assert_equal Time.local(1979, 5, 27, 4), time
|
212
218
|
|
219
|
+
time = parse_now("7/12/11")
|
220
|
+
assert_equal Time.local(2011, 7, 12, 12), time
|
221
|
+
|
222
|
+
time = parse_now("7/12/11", :endian_precedence => :little)
|
223
|
+
assert_equal Time.local(2011, 12, 7, 12), time
|
224
|
+
|
213
225
|
# month day overflows
|
214
226
|
time = parse_now("30/2/2000")
|
215
227
|
assert_nil time
|
metadata
CHANGED
@@ -1,29 +1,38 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronic
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Tom Preston-Werner
|
9
14
|
- Lee Jarvis
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
18
|
+
|
19
|
+
date: 2011-07-28 00:00:00 +01:00
|
14
20
|
default_executable:
|
15
21
|
dependencies: []
|
22
|
+
|
16
23
|
description: Chronic is a natural language date/time parser written in pure Ruby.
|
17
|
-
email:
|
24
|
+
email:
|
18
25
|
- tom@mojombo.com
|
19
26
|
- lee@jarvis.co
|
20
27
|
executables: []
|
28
|
+
|
21
29
|
extensions: []
|
22
|
-
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
23
32
|
- README.md
|
24
33
|
- HISTORY.md
|
25
34
|
- LICENSE
|
26
|
-
files:
|
35
|
+
files:
|
27
36
|
- .gemtest
|
28
37
|
- .gitignore
|
29
38
|
- .yardopts
|
@@ -89,30 +98,38 @@ files:
|
|
89
98
|
has_rdoc: true
|
90
99
|
homepage: http://github.com/mojombo/chronic
|
91
100
|
licenses: []
|
101
|
+
|
92
102
|
post_install_message:
|
93
|
-
rdoc_options:
|
103
|
+
rdoc_options:
|
94
104
|
- --charset=UTF-8
|
95
|
-
require_paths:
|
105
|
+
require_paths:
|
96
106
|
- lib
|
97
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
108
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
|
103
|
-
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
117
|
none: false
|
105
|
-
requirements:
|
106
|
-
- -
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
109
125
|
requirements: []
|
126
|
+
|
110
127
|
rubyforge_project: chronic
|
111
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.3.7
|
112
129
|
signing_key:
|
113
130
|
specification_version: 3
|
114
131
|
summary: Natural language date/time parsing.
|
115
|
-
test_files:
|
132
|
+
test_files:
|
116
133
|
- test/helper.rb
|
117
134
|
- test/test_Chronic.rb
|
118
135
|
- test/test_DaylightSavings.rb
|