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 documentation-tool activejob strscan
Last synced: about 2 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 (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2026-02-10T03:46:08.000Z (21 days ago)
- Last Synced: 2026-02-20T06:51:49.155Z (11 days ago)
- Topics: ruby
- Language: C
- Homepage:
- Size: 1.11 MB
- Stars: 116
- Watchers: 35
- Forks: 48
- Open Issues: 2
- 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: 19
- Commit comment event: 2
- Release event: 2
- Delete event: 14
- Member event: 1
- Pull request event: 70
- Fork event: 9
- Issues event: 6
- Watch event: 33
- Issue comment event: 28
- Push event: 45
- Pull request review comment event: 6
- Pull request review event: 13
Last Year
- Delete event: 8
- Pull request event: 43
- Fork event: 4
- Issues event: 3
- Watch event: 17
- Issue comment event: 25
- Push event: 24
- Pull request review comment event: 5
- Pull request review event: 8
- Create event: 11
Committers metadata
Last synced: 5 days ago
Total Commits: 591
Total Committers: 53
Avg Commits per committer: 11.151
Development Distribution Score (DDS): 0.673
Commits in past year: 49
Committers in past year: 11
Avg Commits per committer in past year: 4.455
Development Distribution Score (DDS) in past year: 0.735
| Name | Commits | |
|---|---|---|
| Nobuyoshi Nakada | n****u@r****g | 193 |
| tadf | t****f@b****e | 154 |
| Hiroshi SHIBATA | h****t@r****g | 77 |
| Burdette Lamar | B****r@Y****m | 24 |
| dependabot[bot] | 4****] | 21 |
| 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 |
| 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 |
| 卜部昌平 | s****i@r****g | 1 |
| and 23 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: 7 days ago
Total issues: 20
Total pull requests: 154
Average time to close issues: 4 months
Average time to close pull requests: 10 days
Total issue authors: 19
Total pull request authors: 32
Average comments per issue: 3.8
Average comments per pull request: 0.84
Merged pull request: 138
Bot issues: 0
Bot pull requests: 23
Past year issues: 3
Past year pull requests: 36
Past year average time to close issues: about 8 hours
Past year average time to close pull requests: about 19 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.44
Past year merged pull request: 28
Past year bot issues: 0
Past year bot pull requests: 11
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] (23)
- BurdetteLamar (18)
- hsbt (16)
- jeremyevans (11)
- olleolleolle (4)
- st0012 (3)
- Stranger6667 (3)
- tricknotes (2)
- andrykonchin (2)
- p0pemaru (2)
- zverok (2)
- casperisfine (2)
- seedot1234 (2)
- radar (2)
Top Issue Labels
Top Pull Request Labels
- dependencies (23)
- documentation (17)
- github_actions (11)
Package metadata
- Total packages: 9
-
Total downloads:
- rubygems: 449,066,555 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: 116
- 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 3 months ago)
- Last Synced: 2026-03-01T12:01:48.479Z (2 days ago)
- Versions: 34
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 224,477,731 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 3 months ago)
- Last Synced: 2026-03-02T01:11:15.988Z (1 day ago)
- Versions: 34
- Dependent Packages: 44
- Dependent Repositories: 15,255
- Downloads: 224,579,572 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 3 months ago)
- Last Synced: 2026-02-28T11:02:37.643Z (3 days 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 5 months ago)
- Last Synced: 2026-02-28T11:02:36.306Z (3 days ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,539 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 5 months ago)
- Last Synced: 2026-02-28T11:02:35.334Z (3 days ago)
- Versions: 4
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 913 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 over 5 years ago)
- Last Synced: 2026-02-28T11:02:37.471Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 2,174 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 5 months ago)
- Last Synced: 2026-02-28T11:02:36.305Z (3 days ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,539 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 5 months ago)
- Last Synced: 2026-02-28T11:02:35.355Z (3 days ago)
- Versions: 4
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 913 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 over 5 years ago)
- Last Synced: 2026-02-28T11:02:35.289Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 2,174 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)
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.71082770719697