jdl-chronic 0.3.0.1 → 0.3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,11 +63,18 @@ class Chronic::RepeaterTime < Chronic::Repeater #:nodoc:
63
63
 
64
64
  unless @current_time
65
65
  first = true
66
+
67
+ # midnight = DateTime.new(y=@now.year, m=@now.month, d=@now.day)
68
+ # yesterday_midnight = midnight - 1
69
+ # tomorrow_midnight = midnight + 1
70
+ # offset_fix = midnight.gmt_offset - tomorrow_midnight.gmt_offset
71
+ #
72
+ #
66
73
  midnight = Chronic.time_class.local(@now.year, @now.month, @now.day)
67
74
 
68
75
  yesterday_midnight = midnight - full_day
69
76
  tomorrow_midnight = midnight + full_day
70
-
77
+
71
78
  offset_fix = midnight.gmt_offset - tomorrow_midnight.gmt_offset
72
79
  tomorrow_midnight += offset_fix
73
80
 
@@ -49,4 +49,21 @@ class TestRepeaterDayName < Test::Unit::TestCase
49
49
  assert_equal Time.local(2006, 8, 8), span.end
50
50
  end
51
51
 
52
+ def test_next_past_across_dst_boundary
53
+ @now = Time.local(2009, 3, 10, 0, 0, 0, 0)
54
+ wednesdays = Chronic::RepeaterDayName.new(:wednesday)
55
+ wednesdays.start = @now
56
+
57
+ span = wednesdays.next(:past)
58
+
59
+ assert_equal Time.local(2009, 3, 4), span.begin
60
+ assert_equal Time.local(2009, 3, 5), span.end
61
+
62
+ span = wednesdays.next(:past)
63
+
64
+ assert_equal Time.local(2009, 2, 25), span.begin
65
+ assert_equal Time.local(2009, 2, 26), span.end
66
+ end
67
+
68
+
52
69
  end
data/test/test_parsing.rb CHANGED
@@ -704,6 +704,14 @@ class TestParsing < Test::Unit::TestCase
704
704
  # assert_equal Time.local(2007, 11, 5, 11), t1
705
705
  end
706
706
 
707
+ # Testing a bug where asking for "yesterday" at a specific time on the day after
708
+ # Daylight Saving Time starts results in nil being returned.
709
+ def test_yesterday_is_dst
710
+ t1 = Chronic.parse("yesterday", :now => Date.parse('03/09/2009'))
711
+ assert_equal Time.local(2009, 3, 8, 0), t1
712
+ end
713
+
714
+
707
715
  private
708
716
  def parse_now(string, options={})
709
717
  Chronic.parse(string, {:now => TIME_2006_08_16_14_00_00 }.merge(options))
metadata CHANGED
@@ -1,15 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jdl-chronic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.1
4
+ hash: 83
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 0
10
+ - 2
11
+ version: 0.3.0.2
5
12
  platform: ruby
6
13
  authors:
7
- - Tom Preston-Werner
14
+ - Tom Preston-Werner (modified with DST bug fixes by JDL)
8
15
  autorequire: chronic
9
16
  bindir: bin
10
17
  cert_chain: []
11
18
 
12
- date: 2009-02-25 00:00:00 -08:00
19
+ date: 2010-12-01 00:00:00 -06:00
13
20
  default_executable:
14
21
  dependencies: []
15
22
 
@@ -22,14 +29,12 @@ extensions: []
22
29
  extra_rdoc_files:
23
30
  - README
24
31
  files:
25
- - lib/chronic
26
32
  - lib/chronic/chronic.rb
27
33
  - lib/chronic/grabber.rb
28
34
  - lib/chronic/handlers.rb
29
35
  - lib/chronic/ordinal.rb
30
36
  - lib/chronic/pointer.rb
31
37
  - lib/chronic/repeater.rb
32
- - lib/chronic/repeaters
33
38
  - lib/chronic/repeaters/repeater_day.rb
34
39
  - lib/chronic/repeaters/repeater_day_name.rb
35
40
  - lib/chronic/repeaters/repeater_day_portion.rb
@@ -50,7 +55,6 @@ files:
50
55
  - lib/chronic/separator.rb
51
56
  - lib/chronic/time_zone.rb
52
57
  - lib/chronic.rb
53
- - lib/numerizer
54
58
  - lib/numerizer/numerizer.rb
55
59
  - test/suite.rb
56
60
  - test/test_Chronic.rb
@@ -73,6 +77,8 @@ files:
73
77
  - README
74
78
  has_rdoc: true
75
79
  homepage: http://chronic.rubyforge.org
80
+ licenses: []
81
+
76
82
  post_install_message:
77
83
  rdoc_options:
78
84
  - --main
@@ -80,23 +86,29 @@ rdoc_options:
80
86
  require_paths:
81
87
  - lib
82
88
  required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
83
90
  requirements:
84
91
  - - ">="
85
92
  - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
86
96
  version: "0"
87
- version:
88
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
89
99
  requirements:
90
100
  - - ">="
91
101
  - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
92
105
  version: "0"
93
- version:
94
106
  requirements: []
95
107
 
96
108
  rubyforge_project:
97
- rubygems_version: 1.2.0
109
+ rubygems_version: 1.3.7
98
110
  signing_key:
99
- specification_version: 2
111
+ specification_version: 3
100
112
  summary: A natural language date parser with timezone support
101
113
  test_files:
102
114
  - test/suite.rb