Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
256 commits
Select commit Hold shift + click to select a range
e565e73
Handles day, month names with scalar day and year
Jan 31, 2012
f50d4cd
Ensures 31st parses correctly with day names
Jan 31, 2012
f7ef57f
Merge pull request #80 from joefiorini/master
Feb 1, 2012
6ab19c6
Release 0.6.7
Feb 1, 2012
edcbd91
tomdoc lib/chronic.rb
Feb 1, 2012
fe1fafe
tomdoc lib/chronic/chronic.rb
Feb 1, 2012
625344c
Merge branch 'handle_sd_sm' of github.com:mojombo/chronic into handle…
Feb 2, 2012
4884a57
updated changes for #59
Feb 2, 2012
0a8193c
ensure periods are treated the same as colons
Feb 8, 2012
0e80065
updated changes
Feb 8, 2012
3f17281
downcase test filenames
Feb 8, 2012
82863e5
lets get with the times and start using minitest
Feb 8, 2012
6a36a37
remove .gemtest
Feb 8, 2012
98429ff
remove .yardopts
Feb 8, 2012
f5a2470
tomdoc all the things \o/
Feb 8, 2012
4aba019
Update README for endian_precedence options
cfabianski Apr 6, 2012
ae44b56
Merge pull request #92 from cfabianski/master
Apr 8, 2012
3f3c51a
add autoload support
Apr 20, 2012
8b89584
fixed require of chronic/chronic
Apr 20, 2012
a761e71
Merge pull request #95 from An0Hit0/master
Apr 21, 2012
8d2e4d2
Added tests to verify behavior of RepeaterDayPortion
jeremyf May 15, 2012
5042ae5
Merge pull request #98 from jeremyf/dst-fix
May 16, 2012
f9aa0e2
handle text starting w/ a ...
May 25, 2012
0d3abd1
any number of spaces may preceed
May 25, 2012
0024100
add support for an hour
May 25, 2012
6c08067
handle any case AN
May 25, 2012
3d3c1fc
Add support for common time abbreviations.
May 25, 2012
41d226d
Move support for time abbreviations to repeater.
May 25, 2012
122810d
Add tests for time abbreviations.
May 25, 2012
14c39ff
Merge pull request #102 from dunsmoreb/feature/time-abbreviations
May 28, 2012
f5eeaf7
support parsing day(scalar)-month(name)-year(scalar)
May 31, 2012
1f1f9ea
Merge branch 'master' of github.com:mojombo/chronic
May 31, 2012
2b5917f
Merge pull request #101 from steveburkett/a_phrase
May 31, 2012
7c5f962
modify an? gsub regexp to simplify
May 31, 2012
953d16f
updated history
May 31, 2012
7585ccb
only execute #offset on repeaters which handle them
May 31, 2012
b75dedd
ensure use of 'second' at the start of string acts as ordinal
Jun 24, 2012
53b62a9
ensure a single whitespace character is prepended when replacing post…
Jun 29, 2012
b554169
updated history
Jun 29, 2012
89340ac
support parsing EXIF date format
Aug 1, 2012
b370284
updated history file
Aug 1, 2012
cdf07ea
Release 0.7.0
Aug 1, 2012
8fde667
Introduce failing test for sm/sd with time
digitalcora Sep 7, 2012
2b4fdb0
Fix sd/sm test that shouldn't return nil
digitalcora Sep 7, 2012
32b1980
Handle sm/sd and sd/sm with time
digitalcora Sep 7, 2012
201e2c3
Merge pull request #114 from grantovich/handle-sm-sd-with-time
Sep 7, 2012
d1c4a9d
support optional 'at' with anchor
Sep 8, 2012
a1a64e6
allow anchor handler to accept any optional separators
Sep 16, 2012
077a66e
support time when parsing dd-mmm-yyy <time>
Sep 16, 2012
78e0d33
fix time repeater scanning regexp
Sep 16, 2012
e2fe763
add handler for "on <day>" without timestamp
Sep 16, 2012
bbbeb92
group generic handlers into one
Sep 16, 2012
62b6073
support ISO 8601 format
Sep 16, 2012
b36c1e0
support "<ordinal> of this month"
Sep 16, 2012
644ae2e
updated history
Sep 16, 2012
ce29308
Release 0.8.0
Sep 16, 2012
8724d0e
Release 0.8.0
Sep 16, 2012
8cbc079
Release 0.8.0
Sep 16, 2012
a149026
Release 0.8.0
Sep 16, 2012
ad98d38
merge chronic/chronic.rb into chronic.rb
Sep 16, 2012
9004615
remove deprecated code
Sep 16, 2012
8b8053c
handle parsing usec from strings
leejarvis Sep 21, 2012
b0a5fab
Fix negative TZ offsets returning nil
digitalcora Sep 28, 2012
326141d
Merge pull request #133 from grantovich/fix-negative-time-zones
leejarvis Sep 28, 2012
1130ba2
Moved body of Chronic.parse and related methods to Chronic::Parser cl…
alexdowad Oct 1, 2012
e07d519
Moved Chronic::Parser into a new file
alexdowad Oct 2, 2012
a9555bc
Added a test for thread safety of Chronic.parse to test suite
alexdowad Oct 2, 2012
9bae166
Added next/last week to documentation
Oct 16, 2012
ba4f481
Merge pull request #140 from joshwalsh/patch-1
leejarvis Oct 17, 2012
b13fac2
Revert "Added a test for thread safety of Chronic.parse to test suite"
alexdowad Oct 17, 2012
522b091
Merge pull request #138 from alexdowad/new_test
leejarvis Oct 27, 2012
d410d18
use explicit requires and avoid #autoload
leejarvis Oct 27, 2012
e1c972b
no need to expand class lookup for Parser
leejarvis Oct 27, 2012
2b93f06
remove internal ChronicPain exception class
leejarvis Oct 27, 2012
9904edb
avoid raising if an invalid config option is passed
leejarvis Oct 27, 2012
e5be1ed
avoid raising if an invalid context is passed
leejarvis Oct 27, 2012
37a8c23
move constant and attr calls above initialize method
leejarvis Oct 27, 2012
1174ba3
clean up some documentation
leejarvis Oct 27, 2012
1c0c1fa
remove deprecated numericize_numbers method
leejarvis Oct 27, 2012
ac76dd2
more comment cleanups
leejarvis Oct 27, 2012
21b7676
ensure a timestamp with no delimiter but a suffixed day portion isn't…
leejarvis Oct 27, 2012
c3b311c
Added support for time expressions such as '10 till' or 'half past two'
deanrad Oct 28, 2012
07cb5e9
updated history
leejarvis Oct 29, 2012
cef2d4d
updated Readme formatting
leejarvis Oct 29, 2012
44e6196
support for (fairly common, and equally stupid) excel date formats
jmondo Oct 30, 2012
5901743
Merge pull request #149 from jmondo/master
leejarvis Oct 30, 2012
7d639e7
updated HISTORY
leejarvis Oct 30, 2012
ed76d6e
do not attempt to create dates that are out of range
leejarvis Nov 5, 2012
cd78f11
Added support for RepeaterDayName, RepeaterMonthName, Ordinal/ScalarD…
Nov 14, 2012
8042173
Merge pull request #153 from kareemk/master
leejarvis Nov 14, 2012
73af1c1
updated history file
leejarvis Nov 14, 2012
d9ce2b8
Adding support for Scalar, Repeater, Scalar, Repeater, Pointer
Dec 3, 2012
07c34a3
Merge pull request #155 from kareemk/master
leejarvis Dec 3, 2012
37740ed
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Dec 3, 2012
2fa6bae
fixes: #154 Future context with no year specified
Dec 17, 2012
1f61dd0
respecting coding style
Dec 18, 2012
d63b7ad
Merge pull request #157 from anaMZ/master
leejarvis Dec 18, 2012
2f8759e
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Dec 18, 2012
9b24610
allow month regexp to accept :/. with substrings
leejarvis Dec 21, 2012
ab0c43b
updated history file
leejarvis Dec 21, 2012
2117d99
bump version
leejarvis Dec 21, 2012
09359dd
Release 0.9.0
leejarvis Dec 21, 2012
1c32d54
Minor fix: Remove duplicate 'require chronic/ordinal' from chronic.rb
HassenIO Dec 31, 2012
58f6067
Merge pull request #160 from hassinus/no_duplicate_require
leejarvis Dec 31, 2012
badd3ca
support ISO8601-compatible YYYY-MM format
leejarvis Jan 7, 2013
e6d98a6
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Jan 7, 2013
df9b579
Fix compatibility with ruby 2.0.0-rc1
Jan 16, 2013
11dc6e9
Merge pull request #165 from brainopia/patch-1
leejarvis Jan 16, 2013
e86d794
remove ambiguous leading 0's in timestamps whenever we include day po…
leejarvis Jan 24, 2013
f418252
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Jan 24, 2013
8734abd
Add support to travis
Jan 30, 2013
e0cb642
Merge pull request #171 from michelboaventura/master
leejarvis Jan 31, 2013
f6f5690
remove unused variable
kachick Jan 29, 2013
84b57ab
use parentheses at argument of an assertion
kachick Jan 29, 2013
0ef3f90
Merge pull request #170 from kachick/improve-remove_warnings
leejarvis Jan 31, 2013
f5f1e1d
properly numerize "twelfth"
Feb 10, 2013
f9ee3dc
fix ordinals involving tens and big numbers
Feb 10, 2013
44ffdf4
Merge pull request #172 from jpmckinney/master
leejarvis Feb 11, 2013
181131b
ensure chronic removes periods from day portions
leejarvis Feb 12, 2013
a243ae1
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Feb 12, 2013
99ccbd8
ensure Token#inspect works like Token#to_s
leejarvis Feb 25, 2013
72ce18e
updated HISTORY
leejarvis Feb 25, 2013
cd1738a
Release 0.9.0
leejarvis Feb 25, 2013
4237b1c
Release 0.9.1
leejarvis Feb 25, 2013
f1fe1b5
Release 0.9.1
leejarvis Feb 25, 2013
85aba4b
Fix failing year/month test
Mar 6, 2013
0fc06e1
Merge pull request #178 from cpmurphy/fix_test_sy_sm
leejarvis Mar 12, 2013
c845df7
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Mar 12, 2013
d12c1ac
update my email address
leejarvis Mar 23, 2013
cf3b448
Parse times after noon in past context correctly
Apr 12, 2013
fcf836d
Merge pull request #183 from cpmurphy/context_prob
leejarvis Apr 12, 2013
b908694
Merge branch 'master' of github.com:mojombo/chronic
leejarvis Apr 12, 2013
f90ab0c
rescue out of bound argument errors received from Time.parse
leejarvis Apr 17, 2013
9c65c9d
Ensure D[ap].m. is parsed correctly (ie 4p.m.)
leejarvis May 25, 2013
c9758e0
Removed Ruby warnings.
tbuehlmann May 27, 2013
9a828dd
add failing Chronic.parse example to README
johari Jun 21, 2013
fc5427a
Merge pull request #190 from johari/readme
leejarvis Jun 21, 2013
6125ce6
Adapted warning specific code.
tbuehlmann Jul 30, 2013
22a129f
Merge pull request #188 from tbuehlmann/ruby-warnings
leejarvis Jul 30, 2013
40f1aad
Pass ordinal only strings to Time.parse
leejarvis Jul 30, 2013
f019cd6
Support for time with subseconds.
davispuh Jul 29, 2013
1b4af3b
Use `snake_case` instead of `camelCase`
davispuh Jul 30, 2013
f753f3c
Add test for argument exception in repeater_time
davispuh Jul 30, 2013
e68d360
Merge pull request #195 from davispuh/subsecond
leejarvis Jul 30, 2013
648c61e
Improve regexp when matching for negative timezone
davispuh Jul 30, 2013
aecbed0
Add test for date in `dd-mm-yyyy` format
davispuh Jul 30, 2013
caeac74
Parse dates in format `dd.mm.yyyy` (ie. separated with dots)
davispuh Jul 30, 2013
7e27b43
Add tests for dates which are separated with dots
davispuh Jul 30, 2013
c5d28a9
Merge pull request #197 from davispuh/date_with_dots
leejarvis Jul 31, 2013
9f46692
Merge branch 'fix_regexp' of https://github.com/davispuh/chronic into…
leejarvis Jul 31, 2013
51b6ecd
Fix parsing for negative timezone with miliseconds
davispuh Aug 1, 2013
8475a90
Merge pull request #200 from davispuh/fix_ms_timezone
leejarvis Aug 1, 2013
a398f31
handle day name, month name, ordinal day and year
brettg Aug 15, 2013
1eacebe
Merge pull request #204 from brettg/handle_rdn_rmn_od_sy
leejarvis Aug 15, 2013
2ee9ab8
Improve Handler.match so that pattern elements can be Arrays containi…
davispuh Aug 5, 2013
53d7e7a
Improve Separators
davispuh Aug 5, 2013
2e7a3e1
Refactor Scalar and Ordinal parsing classes
davispuh Aug 5, 2013
781830f
Add :hours24 option for Parser so can force 24-hour clock
davispuh Aug 5, 2013
1e7b5d1
Simplify `could_be_*` methods
davispuh Aug 12, 2013
4e3081f
Merge pull request #202 from davispuh/parser_improvements
leejarvis Aug 15, 2013
786ac53
Improve .gitignore
davispuh Aug 22, 2013
eb912a6
Use SimpleCov instead of rcov and improve Rakefile
davispuh Aug 22, 2013
dbf2e0c
Add offset support for Chronic::construct and improve Date, Time classes
davispuh Aug 22, 2013
c9d8642
Change :guess option so can specify which part of Span should return
davispuh Aug 22, 2013
18b7cfd
Merge pull request #206 from davispuh/parser_improvements
leejarvis Aug 24, 2013
e1a72e0
document changes
davispuh Aug 24, 2013
6a38768
Merge pull request #207 from davispuh/changelog
leejarvis Aug 25, 2013
cc88aaa
Update HISTORY
leejarvis Aug 25, 2013
005427a
Bump version
leejarvis Aug 25, 2013
768523f
Release 0.10.0
leejarvis Aug 25, 2013
6d127da
Support `ActiveSupport::TimeZone` as `Chronic.time_class` (fixes #208)
davispuh Aug 27, 2013
97d2397
Merge pull request #209 from davispuh/timezone_fix
leejarvis Aug 27, 2013
d7a2e4b
update history
leejarvis Aug 27, 2013
25fa187
Bump version
leejarvis Aug 27, 2013
ace1c57
Release 0.10.1
leejarvis Aug 27, 2013
b212b1c
Ruby 1.8 compatibility
davispuh Sep 5, 2013
7793dd6
Merge pull request #212 from davispuh/patch-1
davispuh Sep 6, 2013
0af4aea
Bump version
leejarvis Sep 9, 2013
7d3d82d
Release 0.10.2
leejarvis Sep 9, 2013
1853dab
Add an option to set the first day of the week
goodtouch Sep 27, 2013
39fb3f4
Cleans up and replaces double quotes with single where no ruby eval
yatish27 Nov 10, 2013
8a3e147
Merge pull request #226 from yatish27/clean-up
leejarvis Nov 11, 2013
06ab9c8
Merge pull request #216 from goodtouch/allow-weeks-to-start-on-monday
davispuh Nov 12, 2013
77adb0a
Refactor "if new_tag" logic from #scan for Timezone, Sign, Separator,…
TalkativeTree Dec 10, 2013
f00ddd8
Merge pull request #235 from TalkativeTree/refactor/#scan
leejarvis Dec 10, 2013
3298df8
remove @@definitions from Parser#definitions and replace with an inst…
TalkativeTree Dec 12, 2013
2cdb70f
create a Definition class, SpanDefinitions and then appropriate types…
TalkativeTree Dec 12, 2013
1a2dd35
create a Dictionary class and SpanDictionary subclass responsible for…
TalkativeTree Dec 12, 2013
35772af
Change definition testing to test Chronic::SpanDictionary.new instead…
TalkativeTree Dec 13, 2013
a3006f5
Merge pull request #236 from TalkativeTree/refactor/Parser#definitions
leejarvis Jan 4, 2014
0e0a143
Fix Chronic.parse('t') raising NoMethodError
Jan 24, 2014
9979bad
Don't mutate Token#word when inspecting tokens
Jan 24, 2014
fccf3ba
Merge pull request #244 from jdelStrother/inspect
davispuh Jan 24, 2014
6c76568
Merge pull request #243 from jdelStrother/nomethoderror
leejarvis Jan 24, 2014
060cf4d
Move tags to own directory
davispuh Mar 20, 2014
f4dce94
Merge pull request #252 from davispuh/tags
davispuh Mar 25, 2014
1ea8248
fixed issue when dealing with dates without given year, that lays in …
synopia Apr 7, 2014
589c57a
Add a Gemfile
dnrce Apr 10, 2014
7efdf11
Instruct developers to use Bundler
dnrce Apr 10, 2014
774a66a
Merge pull request #255 from synopia/master
davispuh Apr 11, 2014
7852b2e
Merge pull request #256 from zoombody/bundler
davispuh Apr 11, 2014
e4136f2
Ignore .bundle directory
dnrce Apr 21, 2014
1b0fb8e
Merge pull request #257 from zoombody/bundler
davispuh Apr 21, 2014
05ed556
Switch to using numerizer gem
davispuh Mar 20, 2014
a60220f
Merge pull request #258 from davispuh/numerizer
davispuh Apr 24, 2014
868b2fe
Dealing with cases like '2 Nov 10'
arencinosa May 10, 2014
b760fae
Added parser support for "midday"
May 12, 2014
cd739fd
Merge pull request #260 from arencinosa/parsing_scalar_rmn_scalar_sep…
leejarvis May 15, 2014
61570de
Create version file and use it for Rakefile, instead of parsing with …
davispuh May 28, 2014
1eaf613
Update token processing
davispuh Apr 11, 2014
7047625
Improve Scalar and Ordinal matching for dates and times
davispuh Mar 20, 2014
eb6ff7e
added functionality to let you use as many millisecond digits as you …
samlehman Jun 18, 2014
67128d7
removed reference to pry
samlehman Jun 18, 2014
c3595ef
Raise error on unsupported options
dnagir Jul 2, 2014
1b93e33
Merge pull request #262 from davispuh/version
davispuh Jul 29, 2014
9e1d6c9
Add Ruby 2.0.0 and Ruby 2.1.2 to Travis build matrix
greysteil Jun 20, 2014
4a92354
support short-hand year notation
mkdynamic Sep 12, 2014
9794067
add support for quarter units (i.e. this quarter)
mkdynamic Sep 12, 2014
2aae211
add support for quarters with scalar/repeater/pointer pattern
mkdynamic Sep 12, 2014
218ef9a
add support for name quarters
mkdynamic Sep 12, 2014
a7d6996
Merge branch 'add-midday-support' of https://github.com/bluefuton/chr…
davispuh Sep 13, 2014
7c7f488
Merge branch 'update-travis' of https://github.com/greysteil/chronic …
davispuh Sep 13, 2014
77e9b75
Merge branch 'milliseconds' of https://github.com/samlehman/chronic i…
davispuh Sep 13, 2014
4eb7578
Merge branch 'validate_options' of https://github.com/dnagir/chronic …
davispuh Sep 13, 2014
6835310
add support for rmn_s_r_p pattern
mkdynamic Sep 13, 2014
b795579
fix bug handling sm_sd in past context
mkdynamic Sep 13, 2014
120c8a0
Merge branch 'quarters' of https://github.com/delighted/chronic into …
davispuh Sep 27, 2014
9b4d026
Merge branch 'shorthand-year' of https://github.com/delighted/chronic…
davispuh Sep 27, 2014
72707dc
Merge branch 'handle-rmn_s_r_p' of https://github.com/delighted/chron…
davispuh Sep 27, 2014
8cc5d72
Merge branch 'fix-past-context-in-sm_sd' of https://github.com/deligh…
davispuh Sep 27, 2014
ac52e62
Merge branch 'tokenize' of https://github.com/davispuh/chronic into beta
davispuh Sep 27, 2014
9a4d6b2
Merge branch 'beta'
davispuh Dec 22, 2016
4a55a4e
Do not delete :now from the options hash.
temochka Oct 6, 2014
4776d8a
Fix warnings: `Use assert_nil if expecting nil`
koic Feb 22, 2017
fa547b4
Use the latest Rubies on Travis
koic Feb 23, 2017
73e4a94
CI against Ruby 2.4.1
koic Apr 4, 2017
86db388
Fix Chronic.parse year 00 returns nil
renziver Jun 28, 2017
d1f74b1
Merge pull request #359 from renziver/master
davispuh Aug 3, 2017
fba307a
Merge pull request #354 from koic/use_latest_rubies
davispuh Aug 3, 2017
556228c
Merge pull request #353 from koic/fix_deprecated_warnings
davispuh Aug 3, 2017
3eb45f7
Minor fixes (proposal)
kant Dec 10, 2017
df691d9
Merge pull request #371 from kant/patch-1
davispuh Dec 10, 2017
0da6254
Improve German date format parser
kakra Jul 8, 2015
0bf4c09
Provide test case for German date parsing
kakra Jan 12, 2018
2b1eae7
Merge pull request #307 from kakra/patch-1
davispuh Jan 12, 2018
15921e5
Migrate CI to GitHub Actions
petergoldstein Feb 3, 2022
7c06407
essage=Add Ruby 3.2
petergoldstein Jan 30, 2023
55d51e7
Loosen gem constraints
petergoldstein Jan 30, 2023
b39fa5e
Remove truffleruby version
petergoldstein Jan 30, 2023
416d504
Merge pull request #408 from petergoldstein/feature/migrate_to_github…
davispuh Jan 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .gemtest
Empty file.
30 changes: 30 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

name: test

on: [ push, pull_request ]

jobs:

test:

if: " ! (contains(github.event.head_commit.message, 'skip ci') || contains(github.event.head_commit.message, 'ci skip'))"

name: ${{matrix.ruby}} on ${{matrix.os}}

strategy:
matrix:
os: [ ubuntu-latest ]
ruby: [ 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby-9.2, jruby-9.3, truffleruby ]
experimental: [ false ]
fail-fast: false
runs-on: ${{matrix.os}}
continue-on-error: ${{matrix.experimental}}

steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true
- run: bundle exec rake

9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
pkg
*.rbc
rdoc
.yardoc
doc
/.bundle/
/pkg/
/coverage/
/doc/
/tags/
Gemfile.lock
3 changes: 0 additions & 3 deletions .yardopts

This file was deleted.

3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gemspec
63 changes: 63 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
# 0.10.2 / 2013-09-09

* Fix 1.8.7 support (due to be dropped in 0.11.0)
* Bugfix for times with negative zones

# 0.10.1 / 2013-08-27

* Support `ActiveSupport::TimeZone` (#209, #208)

# 0.10.0 / 2013-08-25

* Chronic will parse subseconds correctly
for all supported date/time formats (#195, #198 and #200)
* Support for date format: dd.mm.yyyy (#197)
* Option `:hours24` to parse as 24 hour clock (#201 and #202)
* `:guess` option allows to specify which part of Span to return.
(accepted values `false`,`true`,`:begin`, `:middle`, `:end`)
* Replace `rcov` with `SimpleCov` for coverage generation
* Add more tests
* Various changes in codebase (#202 and #206)

# 0.9.1 / 2013-02-25

* Ensure Chronic strips periods from day portions (#173)
* Properly numerize "twelfth", "twentieth" etc. (#172, James McKinney)
* Ensure Chronic is compatible with Ruby 2.0.0 (#165, Ravil Bayramgalin)

# 0.9.0 / 2012-12-21

* Implement Chronic::Parser class and create an instance of this class
instead of leaving all data in the class level of Chronic
* Various bug fixes
* Add support for excel date formats (#149, @jmondo)
* Added support for time expressions such as '10 till' or 'half
past two' (#146, @chicagogrooves)
* Add support for RepeaterDayName, RepeaterMonthName,
Ordinal/ScalarDay and Time (#153, @kareemk)

# 0.8.0 / 2012-09-16

* Support parsing "<ordinal> of this month" (#109)
* Support parsing ISO 8601 format (#115)
* Support parsing "on <day>" without a timestamp (#117)
* Fix time parsing regexp (#125)
* Support time when parsing dd-mm-yyy <time> (#126)
* Allow anchor handler to accept any separators (at, on) (#128)
* Support parsing EXIF date format (#112)
* Start using minitest for testing
* Ensure periods are interpreted as colons (#81).
* Support month/day and day/month parsing (#59).
* Support day(scalar)-month(name)-year(scalar) (#99).
* Handle text starting with 'a' or 'an' (#101, @steveburkett).
* Ensure post medium timestamps are correctly formatted (#89)

# 0.6.7 / 2012-01-31

* Handle day, month names with scalar day and year (Joe Fiorini)
* Ensure 31st parses correctly with day names (Joe Fiorini)

# 0.6.6 / 2011-11-23

* `Chronic.parse('thur')` no longer returns `nil` (@harold)

# 0.6.5 / 2011-11-04

* Fix bug when parsing ordinal repeaters (#73)
Expand Down
101 changes: 55 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,78 @@
Chronic
=======

## DESCRIPTION

Chronic is a natural language date/time parser written in pure Ruby. See below
for the wide variety of formats Chronic will parse.

## Installation

## INSTALLATION

### RubyGems

$ [sudo] gem install chronic
```
$ gem install chronic
```

### GitHub
## Usage

$ git clone git://github.com/mojombo/chronic.git
$ cd chronic && gem build chronic.gemspec
$ gem install chronic-<version>.gem
```ruby
require 'chronic'

Time.now #=> Sun Aug 27 23:18:25 PDT 2006

## USAGE
Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006

You can parse strings containing a natural language date using the
`Chronic.parse` method.
Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006

require 'chronic'
Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006

Time.now #=> Sun Aug 27 23:18:25 PDT 2006
Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
#=> Tue Aug 29 05:00:00 PDT 2006

Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('may 27th', :now => Time.local(2000, 1, 1))
#=> Sat May 27 12:00:00 PDT 2000

Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('may 27th', :guess => false)
#=> Sun May 27 00:00:00 PDT 2007..Mon May 28 00:00:00 PDT 2007

Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
Chronic.parse('6/4/2012', :endian_precedence => :little)
#=> Fri Apr 06 00:00:00 PDT 2012

Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
#=> Tue Aug 29 05:00:00 PDT 2006
Chronic.parse('INVALID DATE')
#=> nil
```

Chronic.parse('may 27th', :now => Time.local(2000, 1, 1))
#=> Sat May 27 12:00:00 PDT 2000

Chronic.parse('may 27th', :guess => false)
#=> Sun May 27 00:00:00 PDT 2007..Mon May 28 00:00:00 PDT 2007
If the parser can find a date or time, either a Time or Chronic::Span
will be returned (depending on the value of `:guess`). If no
date or time can be found, `nil` will be returned.

See `Chronic.parse` for detailed usage instructions.


## EXAMPLES
## Examples

Chronic can parse a huge variety of date and time formats. Following is a
small sample of strings that will be properly parsed. Parsing is case
insensitive and will handle common abbreviations and misspellings.

Simple
#### Simple

* thursday
* november
* summer
* friday 13:00
* mon 2:35
* 4pm
* 10 to 8
* 10 past 2
* half past 2
* 6 in the morning
* friday 1pm
* sat 7 in the evening
* yesterday
* today
* tomorrow
* last week
* next week
* this tuesday
* next month
* last winter
Expand All @@ -83,9 +86,10 @@ Simple
* afternoon yesterday
* thursday last week

Complex
#### Complex

* 3 years ago
* a year ago
* 5 months before now
* 7 hours ago
* 7 days from now
Expand All @@ -101,7 +105,7 @@ Complex
* fourteenth of june 2010 at eleven o'clock in the evening
* may seventh '97 at three in the morning

Specific Dates
#### Specific Dates

* January 5
* 22nd of june
Expand All @@ -126,37 +130,41 @@ Specific Dates
* 17:00
* 0800

Specific Times (many of the above with an added time)
#### Specific Times (many of the above with an added time)

* January 5 at 7pm
* 22nd of june at 8am
* 1979-05-27 05:00:00
* 03/01/2012 07:25:09.234567
* 2013-08-01T19:30:00.345-07:00
* 2013-08-01T19:30:00.34-07:00
* etc


## TIME ZONES
## Time Zones

Chronic allows you to set which Time class to use when constructing times. By
default, the built in Ruby time class creates times in your system's local
time zone. You can set this to something like ActiveSupport's
[TimeZone](http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html)
class to get full time zone support.

>> Time.zone = "UTC"
>> Chronic.time_class = Time.zone
>> Chronic.parse("June 15 2006 at 5:45 AM")
=> Thu, 15 Jun 2006 05:45:00 UTC +00:00

```
>> Time.zone = "UTC"
>> Chronic.time_class = Time.zone
>> Chronic.parse("June 15 2006 at 5:45 AM")
=> Thu, 15 Jun 2006 05:45:00 UTC +00:00
```

## LIMITATIONS
## Limitations

Chronic uses Ruby's built in Time class for all time storage and computation.
Because of this, only times that the Time class can handle will be properly
parsed. Parsing for times outside of this range will simply return nil.
parsed. Parsing for times outside of this range will simply return `nil`.
Support for a wider range of times is planned for a future release.


## CONTRIBUTE
## Contribute

If you'd like to hack on Chronic, start by forking the repo on GitHub:

Expand All @@ -166,9 +174,10 @@ The best way to get your changes merged back into core is as follows:

1. Clone down your fork
1. Create a thoughtfully named topic branch to contain your change
1. Install the development dependencies by running `bundle install`
1. Hack away
1. Add tests and make sure everything still passes by running `rake`
1. Ensure your tests pass in multiple timezones. ie `TZ=utc rake` `TZ=BST rake`
1. Add tests and make sure everything still passes by running `bundle exec rake`
1. Ensure your tests pass in multiple timezones. ie `TZ=utc bundle exec rake` `TZ=BST bundle exec rake`
1. If you are adding new functionality, document it in the README
1. Do not change the version number, we will do that on our end
1. If necessary, rebase your commits into logical chunks, without errors
Expand Down
54 changes: 38 additions & 16 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
require 'date'
$:.unshift File.expand_path('../lib', __FILE__)
require 'chronic/version'

def version
contents = File.read File.expand_path('../lib/chronic.rb', __FILE__)
contents[/VERSION = "([^"]+)"/, 1]
Chronic::VERSION
end

task :test do
def do_test
require 'chronic'
$:.unshift './test'
Dir.glob('test/test_*.rb').each { |t| require File.basename(t) }
end

desc "Generate RCov test coverage and open in your browser"
def open_command
case RUBY_PLATFORM
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
'start'
when /darwin|mac os/
'open'
else
'xdg-open'
end
end

desc 'Run tests'
task :test do
do_test
end

desc 'Generate SimpleCov test coverage and open in your browser'
task :coverage do
require 'rcov'
sh "rm -fr coverage"
sh "rcov test/test_*.rb"
sh "open coverage/index.html"
require 'simplecov'
FileUtils.rm_rf('./coverage')
SimpleCov.command_name 'Unit Tests'
SimpleCov.at_exit do
SimpleCov.result.format!
sh "#{open_command} #{SimpleCov.coverage_path}/index.html"
end
SimpleCov.start
do_test
end

desc "Open an irb session preloaded with this library"
desc 'Open an irb session preloaded with this library'
task :console do
sh "irb -Ilib -rchronic"
sh 'irb -Ilib -rchronic'
end

desc "Release Chronic version #{version}"
Expand All @@ -36,11 +58,11 @@ task :release => :build do
sh "gem push pkg/chronic-#{version}.gem"
end

desc "Build a gem from the gemspec"
desc 'Build a gem from the gemspec'
task :build do
sh "mkdir -p pkg"
sh "gem build chronic.gemspec"
sh "mv chronic-#{version}.gem pkg"
FileUtils.mkdir_p 'pkg'
sh 'gem build chronic.gemspec'
FileUtils.mv("./chronic-#{version}.gem", "pkg")
end

task :default => :test
task :default => :test
Loading