-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for 'Wed, Sep 27, 2017' date format
DayName, MonthName ScalarDay, ScalarYear
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'helper' | ||
|
||
class TestDefinitions < TestCase | ||
|
||
def setup | ||
end | ||
|
||
# DayName, MonthName ScalarDay, ScalarYear | ||
def test_dn_mn_sd_sy | ||
time = Chronic.parse('Wed Sep 27 2017', :guess => false) | ||
assert_equal Time.local(2017, 9, 27, 0), time.begin | ||
assert_equal Time.local(2017, 9, 28, 0), time.end | ||
|
||
time = Chronic.parse('Wed, Sep 27, 2017', :guess => false) | ||
assert_equal Time.local(2017, 9, 27, 0), time.begin | ||
assert_equal Time.local(2017, 9, 28, 0), time.end | ||
end | ||
|
||
# DayName, MonthName OrdinalDay, ScalarYear | ||
def test_dn_mn_od_sy | ||
time = Chronic.parse('Sun Oct 22nd 2017', :guess => false) | ||
assert_equal Time.local(2017, 10, 22, 0), time.begin | ||
assert_equal Time.local(2017, 10, 23, 0), time.end | ||
|
||
time = Chronic.parse('Mon Oct 30th 2017', :guess => false) | ||
assert_equal Time.local(2017, 10, 30, 0), time.begin | ||
assert_equal Time.local(2017, 10, 31, 0), time.end | ||
|
||
time = Chronic.parse('Sun, Oct 22nd, 2017', :guess => false) | ||
assert_equal Time.local(2017, 10, 22, 0), time.begin | ||
assert_equal Time.local(2017, 10, 23, 0), time.end | ||
|
||
time = Chronic.parse('Mon, Oct 30th, 2017', :guess => false) | ||
assert_equal Time.local(2017, 10, 30, 0), time.begin | ||
assert_equal Time.local(2017, 10, 31, 0), time.end | ||
|
||
end | ||
|
||
end | ||
|