{"id":13395046,"url":"https://github.com/mojombo/chronic","last_synced_at":"2025-05-13T00:23:01.254Z","repository":{"id":65330868,"uuid":"144","full_name":"mojombo/chronic","owner":"mojombo","description":"Chronic is a pure Ruby natural language date parser.","archived":false,"fork":false,"pushed_at":"2023-09-28T02:41:20.000Z","size":689,"stargazers_count":3249,"open_issues_count":148,"forks_count":458,"subscribers_count":69,"default_branch":"master","last_synced_at":"2025-04-23T04:02:41.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://injekt.github.com/chronic","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mojombo.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2008-01-29T06:48:49.000Z","updated_at":"2025-04-21T09:54:45.000Z","dependencies_parsed_at":"2023-02-16T03:46:01.735Z","dependency_job_id":"c0c1eb86-3d5b-4609-aa9e-9d42d3270d14","html_url":"https://github.com/mojombo/chronic","commit_stats":{"total_commits":531,"total_committers":69,"mean_commits":7.695652173913044,"dds":0.416195856873823,"last_synced_commit":"416d50434204c9929a321af508d4289e11a6cf69"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojombo%2Fchronic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojombo%2Fchronic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojombo%2Fchronic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojombo%2Fchronic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mojombo","download_url":"https://codeload.github.com/mojombo/chronic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250492623,"owners_count":21439566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:40.319Z","updated_at":"2025-04-23T18:40:58.232Z","avatar_url":"https://github.com/mojombo.png","language":"Ruby","readme":"Chronic\n=======\n\nChronic is a natural language date/time parser written in pure Ruby. See below\nfor the wide variety of formats Chronic will parse.\n\n## Installation\n\n```\n$ gem install chronic\n```\n\n## Usage\n\n```ruby\nrequire 'chronic'\n\nTime.now   #=\u003e Sun Aug 27 23:18:25 PDT 2006\n\nChronic.parse('tomorrow')\n  #=\u003e Mon Aug 28 12:00:00 PDT 2006\n\nChronic.parse('monday', :context =\u003e :past)\n  #=\u003e Mon Aug 21 12:00:00 PDT 2006\n\nChronic.parse('this tuesday 5:00')\n  #=\u003e Tue Aug 29 17:00:00 PDT 2006\n\nChronic.parse('this tuesday 5:00', :ambiguous_time_range =\u003e :none)\n  #=\u003e Tue Aug 29 05:00:00 PDT 2006\n\nChronic.parse('may 27th', :now =\u003e Time.local(2000, 1, 1))\n  #=\u003e Sat May 27 12:00:00 PDT 2000\n\nChronic.parse('may 27th', :guess =\u003e false)\n  #=\u003e Sun May 27 00:00:00 PDT 2007..Mon May 28 00:00:00 PDT 2007\n\nChronic.parse('6/4/2012', :endian_precedence =\u003e :little)\n  #=\u003e Fri Apr 06 00:00:00 PDT 2012\n\nChronic.parse('INVALID DATE')\n  #=\u003e nil\n```\n\nIf the parser can find a date or time, either a Time or Chronic::Span\nwill be returned (depending on the value of `:guess`). If no\ndate or time can be found, `nil` will be returned.\n\nSee `Chronic.parse` for detailed usage instructions.\n\n## Examples\n\nChronic can parse a huge variety of date and time formats. Following is a\nsmall sample of strings that will be properly parsed. Parsing is case\ninsensitive and will handle common abbreviations and misspellings.\n\n#### Simple\n\n* thursday\n* november\n* summer\n* friday 13:00\n* mon 2:35\n* 4pm\n* 10 to 8\n* 10 past 2\n* half past 2\n* 6 in the morning\n* friday 1pm\n* sat 7 in the evening\n* yesterday\n* today\n* tomorrow\n* last week\n* next week\n* this tuesday\n* next month\n* last winter\n* this morning\n* last night\n* this second\n* yesterday at 4:00\n* last friday at 20:00\n* last week tuesday\n* tomorrow at 6:45pm\n* afternoon yesterday\n* thursday last week\n\n#### Complex\n\n* 3 years ago\n* a year ago\n* 5 months before now\n* 7 hours ago\n* 7 days from now\n* 1 week hence\n* in 3 hours\n* 1 year ago tomorrow\n* 3 months ago saturday at 5:00 pm\n* 7 hours before tomorrow at noon\n* 3rd wednesday in november\n* 3rd month next year\n* 3rd thursday this september\n* 4th day last week\n* fourteenth of june 2010 at eleven o'clock in the evening\n* may seventh '97 at three in the morning\n\n#### Specific Dates\n\n* January 5\n* 22nd of june\n* 5th may 2017\n* February twenty first\n* dec 25\n* may 27th\n* October 2006\n* oct 06\n* jan 3 2010\n* february 14, 2004\n* february 14th, 2004\n* 3 jan 2000\n* 17 april 85\n* 5/27/1979\n* 27/5/1979\n* 05/06\n* 1979-05-27\n* Friday\n* 5\n* 4:00\n* 17:00\n* 0800\n\n#### Specific Times (many of the above with an added time)\n\n* January 5 at 7pm\n* 22nd of june at 8am\n* 1979-05-27 05:00:00\n* 03/01/2012 07:25:09.234567\n* 2013-08-01T19:30:00.345-07:00\n* 2013-08-01T19:30:00.34-07:00\n* etc\n\n\n## Time Zones\n\nChronic allows you to set which Time class to use when constructing times. By\ndefault, the built in Ruby time class creates times in your system's local\ntime zone. You can set this to something like ActiveSupport's\n[TimeZone](http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html)\nclass to get full time zone support.\n\n```\n\u003e\u003e Time.zone = \"UTC\"\n\u003e\u003e Chronic.time_class = Time.zone\n\u003e\u003e Chronic.parse(\"June 15 2006 at 5:45 AM\")\n=\u003e Thu, 15 Jun 2006 05:45:00 UTC +00:00\n```\n\n## Limitations\n\nChronic uses Ruby's built in Time class for all time storage and computation.\nBecause of this, only times that the Time class can handle will be properly\nparsed. Parsing for times outside of this range will simply return `nil`.\nSupport for a wider range of times is planned for a future release.\n\n\n## Contribute\n\nIf you'd like to hack on Chronic, start by forking the repo on GitHub:\n\nhttps://github.com/mojombo/chronic\n\nThe best way to get your changes merged back into core is as follows:\n\n1. Clone down your fork\n1. Create a thoughtfully named topic branch to contain your change\n1. Install the development dependencies by running `bundle install`\n1. Hack away\n1. Add tests and make sure everything still passes by running `bundle exec rake`\n1. Ensure your tests pass in multiple timezones. ie `TZ=utc bundle exec rake` `TZ=BST bundle exec rake`\n1. If you are adding new functionality, document it in the README\n1. Do not change the version number, we will do that on our end\n1. If necessary, rebase your commits into logical chunks, without errors\n1. Push the branch up to GitHub\n1. Send a pull request for your branch\n","funding_links":[],"categories":["Ruby","Date and Time Processing","Date and Time","High Level Tasks"],"sub_categories":["Numbers, Dates, and Time Parsing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojombo%2Fchronic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmojombo%2Fchronic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojombo%2Fchronic/lists"}