chronic 0.6.5 → 0.6.6
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.
- data/HISTORY.md +4 -0
- data/lib/chronic.rb +2 -2
- data/lib/chronic/repeater.rb +1 -1
- data/test/test_parsing.rb +28 -0
- metadata +2 -2
data/HISTORY.md
CHANGED
data/lib/chronic.rb
CHANGED
@@ -28,7 +28,7 @@ require 'date'
|
|
28
28
|
#
|
29
29
|
# @author Tom Preston-Werner, Lee Jarvis
|
30
30
|
module Chronic
|
31
|
-
VERSION = "0.6.
|
31
|
+
VERSION = "0.6.6"
|
32
32
|
|
33
33
|
class << self
|
34
34
|
|
@@ -100,7 +100,7 @@ require 'chronic/repeaters/repeater_time'
|
|
100
100
|
|
101
101
|
class Time
|
102
102
|
def self.construct(year, month = 1, day = 1, hour = 0, minute = 0, second = 0)
|
103
|
-
warn "
|
103
|
+
warn "Time.construct will be deprecated in version 0.7.0. Please use Chronic.construct instead"
|
104
104
|
Chronic.construct(year, month, day, hour, minute, second)
|
105
105
|
end
|
106
106
|
|
data/lib/chronic/repeater.rb
CHANGED
@@ -58,7 +58,7 @@ module Chronic
|
|
58
58
|
/^m[ou]n(day)?$/ => :monday,
|
59
59
|
/^t(ue|eu|oo|u|)s?(day)?$/ => :tuesday,
|
60
60
|
/^we(d|dnes|nds|nns)(day)?$/ => :wednesday,
|
61
|
-
/^th(u
|
61
|
+
/^th(u|ur|urs|ers)(day)?$/ => :thursday,
|
62
62
|
/^fr[iy](day)?$/ => :friday,
|
63
63
|
/^sat(t?[ue]rday)?$/ => :saturday,
|
64
64
|
/^su[nm](day)?$/ => :sunday
|
data/test/test_parsing.rb
CHANGED
@@ -539,6 +539,34 @@ class TestParsing < Test::Unit::TestCase
|
|
539
539
|
time = parse_now("last wed")
|
540
540
|
assert_equal Time.local(2006, 8, 9, 12), time
|
541
541
|
|
542
|
+
monday = Time.local(2006, 8, 21, 12)
|
543
|
+
assert_equal monday, parse_now("mon")
|
544
|
+
assert_equal monday, parse_now("mun")
|
545
|
+
|
546
|
+
tuesday = Time.local(2006, 8, 22, 12)
|
547
|
+
assert_equal tuesday, parse_now("tue")
|
548
|
+
assert_equal tuesday, parse_now("tus")
|
549
|
+
|
550
|
+
wednesday = Time.local(2006, 8, 23, 12)
|
551
|
+
assert_equal wednesday, parse_now("wed")
|
552
|
+
assert_equal wednesday, parse_now("wenns")
|
553
|
+
|
554
|
+
thursday = Time.local(2006, 8, 17, 12)
|
555
|
+
assert_equal thursday, parse_now("thu")
|
556
|
+
assert_equal thursday, parse_now("thur")
|
557
|
+
|
558
|
+
friday = Time.local(2006, 8, 18, 12)
|
559
|
+
assert_equal friday, parse_now("fri")
|
560
|
+
assert_equal friday, parse_now("fry")
|
561
|
+
|
562
|
+
saturday = Time.local(2006, 8, 19, 12)
|
563
|
+
assert_equal saturday, parse_now("sat")
|
564
|
+
assert_equal saturday, parse_now("satterday")
|
565
|
+
|
566
|
+
sunday = Time.local(2006, 8, 20, 12)
|
567
|
+
assert_equal sunday, parse_now("sun")
|
568
|
+
assert_equal sunday, parse_now("sum")
|
569
|
+
|
542
570
|
# day portion
|
543
571
|
|
544
572
|
time = parse_now("this morning")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-23 00:00:00.000000000Z
|
14
14
|
dependencies: []
|
15
15
|
description: Chronic is a natural language date/time parser written in pure Ruby.
|
16
16
|
email:
|