https://github.com/mojombo/chronic
Chronic is a pure Ruby natural language date parser.
https://github.com/mojombo/chronic
Keywords from Contributors
activerecord activejob mvc rubygems sinatra rack rspec rubocop gem simple
Last synced: about 18 hours ago
JSON representation
Repository metadata
Chronic is a pure Ruby natural language date parser.
- Host: GitHub
- URL: https://github.com/mojombo/chronic
- Owner: mojombo
- License: mit
- Created: 2008-01-29T06:48:49.000Z (about 18 years ago)
- Default Branch: master
- Last Pushed: 2023-09-28T02:41:20.000Z (over 2 years ago)
- Last Synced: 2026-03-01T08:09:34.429Z (2 days ago)
- Language: Ruby
- Homepage: http://injekt.github.com/chronic
- Size: 673 KB
- Stars: 3,255
- Watchers: 67
- Forks: 454
- Open Issues: 157
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
README.md
Chronic
Chronic is a natural language date/time parser written in pure Ruby. See below
for the wide variety of formats Chronic will parse.
Installation
$ gem install chronic
Usage
require 'chronic'
Time.now #=> Sun Aug 27 23:18:25 PDT 2006
Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
#=> Tue Aug 29 05:00:00 PDT 2006
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
Chronic.parse('6/4/2012', :endian_precedence => :little)
#=> Fri Apr 06 00:00:00 PDT 2012
Chronic.parse('INVALID DATE')
#=> nil
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
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
- 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
- this morning
- last night
- this second
- yesterday at 4:00
- last friday at 20:00
- last week tuesday
- tomorrow at 6:45pm
- afternoon yesterday
- thursday last week
Complex
- 3 years ago
- a year ago
- 5 months before now
- 7 hours ago
- 7 days from now
- 1 week hence
- in 3 hours
- 1 year ago tomorrow
- 3 months ago saturday at 5:00 pm
- 7 hours before tomorrow at noon
- 3rd wednesday in november
- 3rd month next year
- 3rd thursday this september
- 4th day last week
- fourteenth of june 2010 at eleven o'clock in the evening
- may seventh '97 at three in the morning
Specific Dates
- January 5
- 22nd of june
- 5th may 2017
- February twenty first
- dec 25
- may 27th
- October 2006
- oct 06
- jan 3 2010
- february 14, 2004
- february 14th, 2004
- 3 jan 2000
- 17 april 85
- 5/27/1979
- 27/5/1979
- 05/06
- 1979-05-27
- Friday
- 5
- 4:00
- 17:00
- 0800
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
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
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
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.
Support for a wider range of times is planned for a future release.
Contribute
If you'd like to hack on Chronic, start by forking the repo on GitHub:
https://github.com/mojombo/chronic
The best way to get your changes merged back into core is as follows:
- Clone down your fork
- Create a thoughtfully named topic branch to contain your change
- Install the development dependencies by running
bundle install - Hack away
- Add tests and make sure everything still passes by running
bundle exec rake - Ensure your tests pass in multiple timezones. ie
TZ=utc bundle exec rakeTZ=BST bundle exec rake - If you are adding new functionality, document it in the README
- Do not change the version number, we will do that on our end
- If necessary, rebase your commits into logical chunks, without errors
- Push the branch up to GitHub
- Send a pull request for your branch
Owner metadata
- Name: Tom Preston-Werner
- Login: mojombo
- Email: tom@mojombo.com
- Kind: user
- Description:
- Website: http://tom.preston-werner.com
- Location: San Francisco
- Twitter: mojombo
- Company: @chatterbugapp, @redwoodjs, @preston-werner-ventures
- Icon url: https://avatars.githubusercontent.com/u/1?v=4
- Repositories: 66
- Last ynced at: 2025-10-20T02:00:30.891Z
- Profile URL: https://github.com/mojombo
GitHub Events
Total
- Pull request event: 1
- Fork event: 26
- Issues event: 12
- Watch event: 32
- Issue comment event: 3
Last Year
- Fork event: 1
- Issues event: 1
- Watch event: 16
Committers metadata
Last synced: 2 days ago
Total Commits: 531
Total Committers: 68
Avg Commits per committer: 7.809
Development Distribution Score (DDS): 0.416
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Lee Jarvis | l****e@j****o | 310 |
| Lee Jarvis | l****s@g****m | 40 |
| Tom Preston-Werner | t****m@m****m | 36 |
| Dāvis | d****h@g****m | 25 |
| Thomas Walpole | t****e@g****m | 7 |
| Mark Dodwell | m****k@m****k | 6 |
| Ben Angel | b****2@g****m | 5 |
| Steve Burkett | s****t@g****m | 4 |
| Alex Dowad | a****g@g****m | 4 |
| Alex Grant | a****t@a****o | 4 |
| Peter Goldstein | p****n@g****m | 4 |
| Jeffrey 'jf' Lim | j****d@g****m | 4 |
| Matthew Moore | m****t@t****m | 3 |
| Dan Rice | d****n@z****m | 3 |
| Jason Dusek | j****k@g****m | 3 |
| Koichi ITO | k****o@g****m | 3 |
| rick | t****e@g****m | 3 |
| Jonathan del Strother | j****r@a****m | 2 |
| Joe Fiorini + Eric Hankinson | j****h@j****m | 2 |
| Jim Mulholland | j****m@j****l | 2 |
| Kenichi Kamiya | k****1@g****m | 2 |
| Marc Hedlund | m****c@p****g | 2 |
| Sam Lehman | s****m@s****m | 2 |
| Sascha Teske | s****e@g****m | 2 |
| Tobias Bühlmann | t****n@g****e | 2 |
| leereilly | l****e@l****t | 2 |
| James McKinney | j****s@s****m | 2 |
| Christian Murphy | c****y@d****m | 2 |
| Bryan Dunsmore | d****b@g****m | 2 |
| AnoHito | a****o@i****t | 2 |
| and 38 more... | ||
Committer domains:
- apple.com: 1
- gmx.net: 1
- jmondo.com: 1
- aaronhurley.com: 1
- brettdgibson.com: 1
- cobaltedge.com: 1
- thekompanee.com: 1
- brian-laptop.(none): 1
- (none).(none): 1
- criticalmass.com: 1
- minigroup.com: 1
- arko.net: 1
- evilmartians.com: 1
- weplay.com: 1
- designinginteractive.com: 1
- michelboaventura.com: 1
- doubleonemedia.com: 1
- isans.net: 1
- drwholdings.com: 1
- slashpoundbang.com: 1
- leereilly.net: 1
- gmx.de: 1
- staq.com: 1
- precipice.org: 1
- joefiorini.com: 1
- audioboo.fm: 1
- zoombody.com: 1
- thrivesmart.com: 1
- apprentice.io: 1
- g5platform.com: 1
- mkdynamic.co.uk: 1
- mojombo.com: 1
- jarvis.co: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 79
Total pull requests: 41
Average time to close issues: over 3 years
Average time to close pull requests: over 2 years
Total issue authors: 69
Total pull request authors: 34
Average comments per issue: 1.8
Average comments per pull request: 1.85
Merged pull request: 14
Bot issues: 0
Bot pull requests: 0
Past year issues: 13
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 5
Past year pull request authors: 1
Past year average comments per issue: 0.08
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- ndregs (9)
- bragboy (2)
- arjunmenon (2)
- FX-HAO (1)
- linjunpop (1)
- carlwiedemann (1)
- sidhunavroop (1)
- TheMeq (1)
- Leonardo-Zappani (1)
- PabloCastellano (1)
- nitesh-varma (1)
- ctrlrsf (1)
- bendangelo (1)
- clari182 (1)
- zoras (1)
Top Pull Request Authors
- mkdynamic (4)
- koic (3)
- davispuh (2)
- jamesmacwilliam (2)
- ivanoblomov (1)
- chenyu777 (1)
- temochka (1)
- mgaskill (1)
- kakra (1)
- MatMoore (1)
- chuttam (1)
- baxter2 (1)
- samlehman (1)
- sirmeth (1)
- petrsigut (1)
Top Issue Labels
- bug (22)
- feature (14)
Top Pull Request Labels
- feature (1)
- bug (1)
Package metadata
- Total packages: 4
-
Total downloads:
- rubygems: 250,998,276 total
- Total docker downloads: 90,718,106
- Total dependent packages: 413 (may contain duplicates)
- Total dependent repositories: 19,028 (may contain duplicates)
- Total versions: 70
- Total maintainers: 3
gem.coop: chronic
Chronic is a natural language date/time parser written in pure Ruby.
- Homepage: http://github.com/mojombo/chronic
- Documentation: http://www.rubydoc.info/gems/chronic/
- Licenses: MIT
- Latest release: 0.10.2 (published over 12 years ago)
- Last Synced: 2026-03-01T14:31:24.174Z (2 days ago)
- Versions: 33
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 125,492,582 Total
- Docker Downloads: 45,359,053
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Downloads: 0.192%
- Average: 0.206%
- Docker downloads count: 0.63%
- Maintainers (2)
rubygems.org: chronic
Chronic is a natural language date/time parser written in pure Ruby.
- Homepage: http://github.com/mojombo/chronic
- Documentation: http://www.rubydoc.info/gems/chronic/
- Licenses: MIT
- Latest release: 0.10.2 (published over 12 years ago)
- Last Synced: 2026-03-01T07:02:05.316Z (2 days ago)
- Versions: 33
- Dependent Packages: 413
- Dependent Repositories: 19,028
- Downloads: 125,487,328 Total
- Docker Downloads: 45,359,053
-
Rankings:
- Dependent packages count: 0.11%
- Downloads: 0.18%
- Dependent repos count: 0.262%
- Average: 0.567%
- Stargazers count: 0.635%
- Docker downloads count: 0.951%
- Forks count: 1.264%
- Maintainers (2)
gem.coop: chronic-mmlac
Chronic is a natural language date/time parser written in pure Ruby.
- Homepage: http://github.com/mojombo/chronic
- Documentation: http://www.rubydoc.info/gems/chronic-mmlac/
- Licenses: MIT
- Latest release: 0.6.4.2 (published over 12 years ago)
- Last Synced: 2026-02-27T22:03:26.421Z (4 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 9,182 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 16.345%
- Downloads: 49.034%
- Maintainers (1)
rubygems.org: chronic-mmlac
Chronic is a natural language date/time parser written in pure Ruby.
- Homepage: http://github.com/mojombo/chronic
- Documentation: http://www.rubydoc.info/gems/chronic-mmlac/
- Licenses: MIT
- Latest release: 0.6.4.2 (published over 12 years ago)
- Last Synced: 2026-03-01T07:20:46.117Z (2 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 9,184 Total
-
Rankings:
- Stargazers count: 0.557%
- Forks count: 1.143%
- Dependent packages count: 15.706%
- Average: 22.482%
- Dependent repos count: 46.782%
- Downloads: 48.22%
- Maintainers (1)
Dependencies
- activesupport ~> 4 development
- minitest ~> 5.0 development
- rake ~> 10 development
- simplecov ~> 0 development
- numerizer ~> 0.2
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
Score: 32.00411188065457