{"id":20031886,"url":"https://github.com/wtnabe/duration-range","last_synced_at":"2026-05-15T05:32:59.485Z","repository":{"id":66523963,"uuid":"363099238","full_name":"wtnabe/duration-range","owner":"wtnabe","description":"Convert `last_week' string to {:begin =\u003e Date, :end =\u003e Date} object and more. For your routine reporting work.","archived":false,"fork":false,"pushed_at":"2021-05-01T23:07:13.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T18:10:50.468Z","etag":null,"topics":["date","ruby","time"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wtnabe.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-30T09:59:50.000Z","updated_at":"2023-01-15T22:00:36.000Z","dependencies_parsed_at":"2023-03-11T00:01:13.364Z","dependency_job_id":null,"html_url":"https://github.com/wtnabe/duration-range","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtnabe%2Fduration-range","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtnabe%2Fduration-range/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtnabe%2Fduration-range/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtnabe%2Fduration-range/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wtnabe","download_url":"https://codeload.github.com/wtnabe/duration-range/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241462776,"owners_count":19966924,"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","ruby","time"],"created_at":"2024-11-13T09:35:09.257Z","updated_at":"2026-05-15T05:32:59.453Z","avatar_url":"https://github.com/wtnabe.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DurationRange\n\nduration range data generator\n\n## Features\n\ngenerate Array / Hash of Date / Time\n\ne.g.\n\n```\n{:begin=\u003eMon, 19 Apr 2021, :end=\u003eSun, 25 Apr 2021} # week as Hash of Date\n[Mon, 19 Apr 2021, Tue, 20 Apr 2021, ... Sun, 25 Apr 2021] # week as Array of Date\n{:begin=\u003e2021-04-01 00:00:00 UTC, :end=\u003e2021-05-01 00:00:00 UTC} # month as Hash of Time\n```\n\navailable classes:\n\n * DurationRange::Date ( default type Array )\n * DurationRange::Time ( default type Hash )\n\nDurationRange::Date generates range using `ge` and `le`. DurationRange::Time differs from that, it uses `ge` and `lt` to generate the range.\n\navailable methods:\n\n * this_week\n * last_week\n * next_week\n * this_month\n * last_month\n * next_month\n * month\n * months\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'duration-range'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install duration-range\n\n## Usage\n\n```\nrequire 'duration-range'\n\nDurationRange::Date.new.this_week.map(\u0026:to_s)\n# =\u003e [\"2021-04-26\", \"2021-04-27\", \"2021-04-28\", \"2021-04-29\", \"2021-04-30\", \"2021-05-01\", \"2021-05-02\"]\n\nDurationRange::Date.new.last_month(as: :hash)\n# =\u003e {:begin=\u003eThu, 01 Apr 2021, :end=\u003eFri, 30 Apr 2021}\n\nDurationRange::Time.new.last_month\n# =\u003e {:begin=\u003e2021-04-01 00:00:00 UTC, :end=\u003e2021-05-01 00:00:00 UTC}\n\nDurationRange::Time.new.month('2021-04')\n# =\u003e {:begin=\u003e2021-04-01 00:00:00 UTC, :end=\u003e2021-05-01 00:00:00 UTC}\n\nDurationRange::Date.new.months('2021-04', '2021-06')\n# =\u003e [Thu, 01 Apr 2021, Fri, 02 Apr 2021, ... Wed, 30 Jun 2021]\n```\n\n## Development\n\nAfter 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.\n\nTo 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](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/wtnabe/duration-range.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtnabe%2Fduration-range","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwtnabe%2Fduration-range","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtnabe%2Fduration-range/lists"}