Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Dayjs | 44,173 | 5,371 | 11,414 | 5 days ago | 122 | July 01, 2023 | 808 | mit | JavaScript | |
⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API | ||||||||||
Date Fns | 32,359 | 68,280 | 11,158 | 4 days ago | 180 | April 30, 2023 | 628 | mit | TypeScript | |
⏳ Modern JavaScript date utility library ⌛️ | ||||||||||
Awesome Falsehood | 22,086 | 15 days ago | 4 | cc0-1.0 | ||||||
😱 Falsehoods Programmers Believe in | ||||||||||
Luxon | 14,260 | 1,936 | 3,121 | 15 days ago | 139 | March 04, 2023 | 144 | mit | JavaScript | |
⏱ A library for working with dates and times in JS | ||||||||||
Arrow | 8,376 | 3,711 | 1,031 | 2 days ago | 63 | September 03, 2022 | 97 | apache-2.0 | Python | |
🏹 Better dates & times for Python | ||||||||||
Pickadate.js | 7,727 | 172 | 38 | 3 months ago | 18 | May 31, 2019 | 311 | mit | JavaScript | |
The mobile-friendly, responsive, and lightweight jQuery date & time input picker. | ||||||||||
Datetools | 7,089 | 663 | 3 years ago | 13 | September 28, 2017 | 118 | mit | Objective-C | ||
Dates and times made easy in iOS | ||||||||||
Pendulum | 5,715 | 540 | 662 | 2 days ago | 53 | November 23, 2022 | 230 | mit | Python | |
Python datetimes made easy | ||||||||||
Joda Time | 4,936 | 31,269 | 5,883 | 15 days ago | 58 | March 30, 2023 | 44 | apache-2.0 | Java | |
Joda-Time is the widely used replacement for the Java date and time classes prior to Java SE 8. | ||||||||||
Carbon | 3,479 | 36 | 7 days ago | 112 | November 06, 2022 | 3 | mit | Go | ||
A simple, semantic and developer-friendly golang package for datetime |
Chronic is a natural language date/time parser written in pure Ruby. See below for the wide variety of formats Chronic will parse.
$ gem install chronic
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.
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.
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
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.
If you'd like to hack on Chronic, start by forking the repo on GitHub:
The best way to get your changes merged back into core is as follows:
bundle install
bundle exec rake
TZ=utc bundle exec rake
TZ=BST bundle exec rake