{"id":26509755,"url":"https://github.com/readysteady/month","last_synced_at":"2025-03-21T01:36:10.276Z","repository":{"id":14796902,"uuid":"17519023","full_name":"readysteady/month","owner":"readysteady","description":"Ruby gem for working with months","archived":false,"fork":false,"pushed_at":"2025-01-02T11:35:15.000Z","size":49,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T23:15:36.650Z","etag":null,"topics":["date-time","month","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/month","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/readysteady.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-03-07T15:55:49.000Z","updated_at":"2025-01-02T11:35:19.000Z","dependencies_parsed_at":"2024-06-21T16:53:25.778Z","dependency_job_id":"d0982d21-3ded-4461-b112-8cecaabb75ae","html_url":"https://github.com/readysteady/month","commit_stats":{"total_commits":88,"total_committers":6,"mean_commits":"14.666666666666666","dds":0.06818181818181823,"last_synced_commit":"024dd7a16a8715b7b3d870e505376835e1bdccf3"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/readysteady%2Fmonth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/readysteady%2Fmonth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/readysteady%2Fmonth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/readysteady%2Fmonth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/readysteady","download_url":"https://codeload.github.com/readysteady/month/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244722706,"owners_count":20499151,"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":["date-time","month","ruby"],"created_at":"2025-03-21T01:36:09.844Z","updated_at":"2025-03-21T01:36:10.263Z","avatar_url":"https://github.com/readysteady.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# month\n\n![Gem Version](https://badge.fury.io/rb/month.svg)\n![Test Status](https://github.com/readysteady/month/actions/workflows/test.yml/badge.svg)\n\n\nRuby gem for working with months.\n\n\n## Install\n\nUsing Bundler:\n\n    $ bundle add month\n\nUsing RubyGems:\n\n    $ gem install month\n\n\n## Feature tour\n\nYou can create a new Month object with a year and month number:\n\n```ruby\nMonth.new(2014, 1)  # January 2014\n```\n\nAlternatively you can use the Month method to cast various date/time\nobjects to Month objects:\n\n```ruby\nMonth(Date.new(2014, 1, 31))  # January 2014\n\nMonth(Time.at(1234567890))  # February 2009\n```\n\nThe method will idempotently return Month objects as-is:\n\n```ruby\nMonth(Month.new(2014, 1))  # January 2014, same object\n```\n\nUse the Month.parse method to parse a YYYY-MM formatted string:\n\n```ruby\nMonth.parse('2014-01')  # January 2014\n```\n\nThe #year attribute will return the year of the month:\n\n```ruby\nMonth.new(2014, 1).year  # 2014\n```\n\nThe #number attribute will return the number of the month:\n\n```ruby\nMonth.new(2014, 1).number  # 1\n```\n\nThe #name method will return the name of the month as a symbol:\n\n```ruby\nMonth.new(2014, 1).name  # :January\n```\n\nAlternatively you can use predicate methods to test for a given month:\n\n```ruby\nMonth.new(2014, 1).january?  # true\n\nMonth.new(2014, 2).january?  # false\n```\n\nThe #to_s method will return a YYYY-MM formatted string representation\nof the month:\n\n```ruby\nMonth.new(2014, 1).to_s  # \"2014-01\"\n```\n\nYou can add/subtract an integer number of months:\n\n```ruby\nMonth.new(2014, 1) + 1  # February 2014\n\nMonth.new(2014, 1) - 1  # December 2013\n```\n\nThe #step method iterates between 2 months, similar to Date#step:\n\n```ruby\nMonth.new(2014, 1).step(Month.new(2014, 12)) do |month|\n  ...\nend\n```\n\nThe #include? method can be used to test if the month includes a date:\n\n```ruby\nMonth.new(2014, 1).include?(Date.new(2014, 1, 31))  # true\n```\n\nThe #dates method returns a range containing the dates in the month:\n\n```ruby\nMonth.new(2014, 1).dates  # Range containing 31 Date objects\n```\n\nThe #length method returns the number of days in the month:\n\n```ruby\nMonth.new(2014, 1).length  # 31\n```\n\nMonth objects can be used in case expressions.\n\nMonth objects can be used as hash keys.\n\nMonth objects can be used in ranges.\n\nMonth objects are comparable.\n\n\n## Bonus extras\n\nThe Month::Methods module provides methods for constructing Month objects\nand Date objects in a manner that closely resembles written english:\n\n```ruby\ninclude Month::Methods\n\nmonth = January 2014\n\ndate = January 15, 2014\n```\n\nIt is not included globally by default; you can either include it within\nyour own modules/classes or globally within your own application/script.\n\n\n## Thanks\n\nThis current implementation is an accidental rewrite of an older library/gem\nwith the same name/purpose ([fhwang / month](https://github.com/fhwang/month)).\nThanks to Francis for kindly allowing me to re-use the same gem name.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freadysteady%2Fmonth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freadysteady%2Fmonth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freadysteady%2Fmonth/lists"}