https://github.com/ruby/date
A subclass of Object includes Comparable module for handling dates.
https://github.com/ruby/date
Keywords
ruby
Keywords from Contributors
rubygems bigdecimal repl webrick activerecord debugger mvc activejob strscan documentation-tool
Last synced: about 5 hours ago
JSON representation
Repository metadata
A subclass of Object includes Comparable module for handling dates.
- Host: GitHub
- URL: https://github.com/ruby/date
- Owner: ruby
- License: other
- Created: 2017-03-31T01:24:49.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2026-04-27T12:17:17.000Z (3 days ago)
- Last Synced: 2026-04-30T12:01:00.801Z (about 10 hours ago)
- Topics: ruby
- Language: C
- Homepage:
- Size: 1.07 MB
- Stars: 116
- Watchers: 35
- Forks: 50
- Open Issues: 3
- Releases: 26
-
Metadata Files:
- Readme: README.md
- License: COPYING
README.md
Date
The official date library for Ruby.
Installation
Add this line to your application's Gemfile:
gem 'date'
And then execute:
$ bundle
Or install it yourself as:
$ gem install date
Usage
require 'date'
A Date object is created with Date::new, Date::jd, Date::ordinal, Date::commercial, Date::parse, Date::strptime, Date::today, Time#to_date, etc.
require 'date'
Date.new(2001,2,3)
#=> #<Date: 2001-02-03 ...>
Date.jd(2451944)
#=> #<Date: 2001-02-03 ...>
Date.ordinal(2001,34)
#=> #<Date: 2001-02-03 ...>
Date.commercial(2001,5,6)
#=> #<Date: 2001-02-03 ...>
Date.parse('2001-02-03')
#=> #<Date: 2001-02-03 ...>
Date.strptime('03-02-2001', '%d-%m-%Y')
#=> #<Date: 2001-02-03 ...>
Time.new(2001,2,3).to_date
#=> #<Date: 2001-02-03 ...>
All Date objects are immutable; hence cannot modify themselves.
The concept of a date object can be represented as a tuple of the day count, the offset and the day of calendar reform.
The day count denotes the absolute position of a temporal dimension. The offset is relative adjustment, which determines decoded local time with the day count. The day of calendar reform denotes the start day of the new style. The old style of the West is the Julian calendar which was adopted by Caesar. The new style is the Gregorian calendar, which is the current civil calendar of many countries.
The day count is virtually the astronomical Julian day number. The offset in this class is usually zero, and cannot be specified directly.
A Date object can be created with an optional argument, the day of calendar reform as a Julian day number, which should be 2298874 to 2426355 or negative/positive infinity. The default value is Date::ITALY (2299161=1582-10-15). See also sample/cal.rb.
$ ruby sample/cal.rb -c it 10 1582
October 1582
S M Tu W Th F S
1 2 3 4 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
$ ruby sample/cal.rb -c gb 9 1752
September 1752
S M Tu W Th F S
1 2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
A Date object has various methods. See each reference.
d = Date.parse('3rd Feb 2001')
#=> #<Date: 2001-02-03 ...>
d.year #=> 2001
d.mon #=> 2
d.mday #=> 3
d.wday #=> 6
d += 1 #=> #<Date: 2001-02-04 ...>
d.strftime('%a %d %b %Y') #=> "Sun 04 Feb 2001"
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/date.
License
The gem is available as open source under the terms of the 2-Clause BSD License.
Owner metadata
- Name: The Ruby Programming Language
- Login: ruby
- Email: info@ruby-lang.org
- Kind: organization
- Description: Repositories related to the Ruby Programming language
- Website: https://www.ruby-lang.org/
- Location: Matsue, Japan
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/210414?v=4
- Repositories: 171
- Last ynced at: 2023-04-09T03:40:20.875Z
- Profile URL: https://github.com/ruby
GitHub Events
Total
- Create event: 21
- Commit comment event: 2
- Release event: 2
- Delete event: 20
- Member event: 1
- Pull request event: 82
- Fork event: 9
- Issues event: 6
- Watch event: 33
- Issue comment event: 29
- Push event: 51
- Pull request review comment event: 8
- Pull request review event: 15
Last Year
- Delete event: 13
- Pull request event: 52
- Fork event: 2
- Issues event: 3
- Watch event: 12
- Issue comment event: 24
- Push event: 28
- Pull request review event: 9
- Pull request review comment event: 7
- Create event: 11
Committers metadata
Last synced: 2 days ago
Total Commits: 604
Total Committers: 54
Avg Commits per committer: 11.185
Development Distribution Score (DDS): 0.68
Commits in past year: 60
Committers in past year: 12
Avg Commits per committer in past year: 5.0
Development Distribution Score (DDS) in past year: 0.633
| Name | Commits | |
|---|---|---|
| Nobuyoshi Nakada | n****u@r****g | 193 |
| tadf | t****f@b****e | 154 |
| Hiroshi SHIBATA | h****t@r****g | 77 |
| dependabot[bot] | 4****] | 31 |
| Burdette Lamar | B****r@Y****m | 25 |
| naruse | n****e@b****e | 16 |
| Jeremy Evans | c****e@j****t | 13 |
| zzak | z****k@b****e | 8 |
| Jean Boussier | j****r@g****m | 5 |
| Maciej Mensfeld | m****j@m****l | 5 |
| kazu | k****u@b****e | 4 |
| Yusuke Endoh | m****e@r****g | 4 |
| usa | u****a@b****e | 4 |
| Olle Jonsson | o****n@g****m | 4 |
| kosaki | k****i@b****e | 3 |
| nagachika | n****a@b****e | 3 |
| svn | s****n@b****e | 3 |
| zverok | z****e@g****m | 3 |
| stomar | s****r@b****e | 3 |
| Akira Matsuda | r****e@d****p | 2 |
| Andrew Konchin | a****n@g****m | 2 |
| Benoit Daloze | e****p@g****m | 2 |
| Dmitry Dygalo | d****o@g****m | 2 |
| Kenta Murata | m****n@m****p | 2 |
| Marc-Andre Lafortune | g****b@m****a | 2 |
| Ryunosuke Sato | t****s@g****m | 2 |
| Takashi Kokubun | t****n@g****m | 2 |
| akr | a****r@b****e | 2 |
| yui-knk | y****k@b****e | 2 |
| Stan Lo | s****o@s****m | 2 |
| and 24 more... | ||
Committer domains:
- ruby-lang.org: 4
- headius.com: 1
- colby.fyi: 1
- ruby-dev.jp: 1
- atdot.net: 1
- atg.auto: 1
- peterzhu.ca: 1
- us.ibm.com: 1
- ryanbigg.com: 1
- axini.com: 1
- shopify.com: 1
- marc-andre.ca: 1
- mrkn.jp: 1
- dio.jp: 1
- mensfeld.pl: 1
- jeremyevans.net: 1
Issue and Pull Request metadata
Last synced: 3 days ago
Total issues: 20
Total pull requests: 163
Average time to close issues: 4 months
Average time to close pull requests: 9 days
Total issue authors: 19
Total pull request authors: 33
Average comments per issue: 3.8
Average comments per pull request: 0.88
Merged pull request: 146
Bot issues: 0
Bot pull requests: 30
Past year issues: 3
Past year pull requests: 41
Past year average time to close issues: about 8 hours
Past year average time to close pull requests: about 17 hours
Past year issue authors: 3
Past year pull request authors: 11
Past year average comments per issue: 0.33
Past year average comments per pull request: 0.73
Past year merged pull request: 33
Past year bot issues: 0
Past year bot pull requests: 16
Top Issue Authors
- dmikurube (2)
- americodls (1)
- ssoulless (1)
- owst (1)
- eregon (1)
- JonathanTron (1)
- pelbyl (1)
- zdavatz (1)
- sshaw (1)
- headius (1)
- amboxer21 (1)
- akiotajima (1)
- MSP-Greg (1)
- rbUUbr (1)
- ziouf (1)
Top Pull Request Authors
- nobu (42)
- dependabot[bot] (30)
- BurdetteLamar (18)
- hsbt (16)
- jeremyevans (11)
- olleolleolle (4)
- st0012 (3)
- Stranger6667 (3)
- tricknotes (2)
- byroot (2)
- andrykonchin (2)
- p0pemaru (2)
- zverok (2)
- casperisfine (2)
- seedot1234 (2)
Top Issue Labels
Top Pull Request Labels
- dependencies (30)
- github_actions (18)
- documentation (17)
Package metadata
- Total packages: 10
-
Total downloads:
- rubygems: 495,980,716 total
- Total docker downloads: 9,006,302,396
- Total dependent packages: 44 (may contain duplicates)
- Total dependent repositories: 15,255 (may contain duplicates)
- Total versions: 117
- Total maintainers: 7
- Total advisories: 1
gem.coop: date
The official date library for Ruby.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/date/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 3.5.1 (published 5 months ago)
- Last Synced: 2026-04-30T14:38:48.147Z (about 7 hours ago)
- Versions: 34
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 248,113,666 Total
- Docker Downloads: 4,503,151,198
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Docker downloads count: 0.004%
- Average: 0.033%
- Downloads: 0.129%
- Maintainers (5)
rubygems.org: date
The official date library for Ruby.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/date/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 3.5.1 (published 5 months ago)
- Last Synced: 2026-04-29T22:20:14.853Z (about 23 hours ago)
- Versions: 34
- Dependent Packages: 44
- Dependent Repositories: 15,255
- Downloads: 247,856,702 Total
- Docker Downloads: 4,503,151,198
-
Rankings:
- Docker downloads count: 0.009%
- Dependent repos count: 0.285%
- Downloads: 0.421%
- Dependent packages count: 0.67%
- Average: 2.059%
- Forks count: 4.332%
- Stargazers count: 6.636%
- Maintainers (5)
- Advisories:
proxy.golang.org: github.com/ruby/date
- Homepage:
- Documentation: https://pkg.go.dev/github.com/ruby/date#section-documentation
- Licenses: other
- Latest release: v3.5.1+incompatible (published 5 months ago)
- Last Synced: 2026-04-30T14:38:49.299Z (about 7 hours ago)
- Versions: 26
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Forks count: 4.017%
- Stargazers count: 5.224%
- Average: 7.405%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
gem.coop: ed-precompiled_date
The official date library for Ruby.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/ed-precompiled_date/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 3.4.2 (published 7 months ago)
- Last Synced: 2026-04-30T14:38:48.562Z (about 7 hours ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,867 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Forks count: 3.901%
- Stargazers count: 5.425%
- Average: 21.644%
- Downloads: 98.894%
- Maintainers (1)
gem.coop: edouard-dummy_date
The official date library for Ruby.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/edouard-dummy_date/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 3.4.1 (published 7 months ago)
- Last Synced: 2026-04-30T14:38:48.438Z (about 7 hours ago)
- Versions: 4
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,072 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Forks count: 3.896%
- Stargazers count: 5.415%
- Average: 21.669%
- Downloads: 99.032%
- Maintainers (1)
gem.coop: ydate
A subclass of Object includes Comparable module for handling dates.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/ydate/
- Licenses: BSD-2-Clause
- Latest release: 3.0.1 (published almost 6 years ago)
- Last Synced: 2026-04-30T14:38:48.343Z (about 7 hours ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 2,235 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 31.258%
- Downloads: 93.774%
- Maintainers (1)
rubygems.org: ed-precompiled_date
The official date library for Ruby.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/ed-precompiled_date/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 3.4.2 (published 7 months ago)
- Last Synced: 2026-04-30T14:38:48.578Z (about 7 hours ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,867 Total
-
Rankings:
- Forks count: 3.668%
- Stargazers count: 5.06%
- Dependent packages count: 14.231%
- Average: 31.603%
- Dependent repos count: 43.59%
- Downloads: 91.463%
- Maintainers (1)
rubygems.org: edouard-dummy_date
The official date library for Ruby.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/edouard-dummy_date/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 3.4.1 (published 7 months ago)
- Last Synced: 2026-04-30T14:38:48.311Z (about 7 hours ago)
- Versions: 4
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,072 Total
-
Rankings:
- Forks count: 3.706%
- Stargazers count: 5.054%
- Dependent packages count: 14.232%
- Average: 31.658%
- Dependent repos count: 43.594%
- Downloads: 91.705%
- Maintainers (1)
rubygems.org: ydate
A subclass of Object includes Comparable module for handling dates.
- Homepage: https://github.com/ruby/date
- Documentation: http://www.rubydoc.info/gems/ydate/
- Licenses: BSD-2-Clause
- Latest release: 3.0.1 (published almost 6 years ago)
- Last Synced: 2026-04-30T14:38:48.258Z (about 7 hours ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 2,235 Total
-
Rankings:
- Forks count: 4.515%
- Stargazers count: 6.833%
- Dependent packages count: 15.706%
- Average: 34.071%
- Dependent repos count: 46.782%
- Downloads: 96.522%
- Maintainers (1)
guix: ruby-date
Ruby @code{Object} subclass with date comparison capability
- Homepage: https://github.com/ruby/date
- Documentation: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/ruby-xyz.scm#n388
- Licenses: bsd-2
- Latest release: 3.3.3 (published about 2 months ago)
- Last Synced: 2026-04-27T16:18:38.431Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- bundler >= 0 development
- rake >= 0 development
- rake-compiler >= 0 development
- test-unit >= 0 development
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- actions/checkout v3 composite
- actions/checkout v6 composite
- actions/create-github-app-token v2 composite
- convictional/trigger-workflow-and-wait v1.6.5 composite
- actions/checkout 1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 composite
- ruby/setup-ruby d5126b9b3579e429dd52e51e68624dda2e05be25 composite
- rubygems/release-gem 1c162a739e8b4cb21a676e97b087e8268d8fc40b composite
- step-security/harden-runner 20cf305ff2072d973412fa9b1e3a4f227bda3c76 composite
Score: 31.742908070148403