{"id":21839334,"url":"https://github.com/darkleaf/date_range_formatter","last_synced_at":"2025-09-11T01:06:52.871Z","repository":{"id":16315785,"uuid":"19064825","full_name":"darkleaf/date_range_formatter","owner":"darkleaf","description":"The simple tool to make work with date ranges in Ruby more enjoyable.","archived":false,"fork":false,"pushed_at":"2022-10-02T19:30:20.000Z","size":23,"stargazers_count":31,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-01T22:43:10.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"XX-net/XX-Net","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darkleaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-23T09:54:25.000Z","updated_at":"2023-03-13T23:23:17.000Z","dependencies_parsed_at":"2022-09-13T11:01:02.359Z","dependency_job_id":null,"html_url":"https://github.com/darkleaf/date_range_formatter","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/darkleaf/date_range_formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkleaf%2Fdate_range_formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkleaf%2Fdate_range_formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkleaf%2Fdate_range_formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkleaf%2Fdate_range_formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darkleaf","download_url":"https://codeload.github.com/darkleaf/date_range_formatter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkleaf%2Fdate_range_formatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274557583,"owners_count":25307516,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-27T21:17:14.252Z","updated_at":"2025-09-11T01:06:52.826Z","avatar_url":"https://github.com/darkleaf.png","language":"Ruby","readme":"# Date Range Formatter\n\n![Build Status](https://github.com/darkleaf/date_range_formatter/actions/workflows/main.yml/badge.svg)\n[![Gem Version](https://badge.fury.io/rb/date_range_formatter.svg)](http://badge.fury.io/rb/date_range_formatter)\n\nThis gem makes working with dates more pretty. It works well with Ruby application and most frameworks like  [Ruby on Rails](https://github.com/rails/rails \"Ruby on Rails\").\n\n## Installation\nVery simple. Just add this code to Gemfile:\n\n    gem 'date_range_formatter'\n\n## Usage\n\nImagine the situation when you need to show dates of some stuff at your website. For example:\n\n    1 - 9 May 2014\n    2 January 2015\n    15 July 2016 - 13 February 2017\n\nAfter that you should call the module DateRangeFormatter with arguments wchich describes the range of dates and format to display. For example, we have date_beginning, date_ending and format by default:\n\n```ruby\nDateRangeFormatter.format('2013-01-14', '2013-02-15')\n#=\u003e '14 January - 15 February 2013'\n```\n\nAlso you can use `format_range` method and enumerable object:\n\n```ruby\nDateRangeFormatter.format_range(['2013-02-20', '2013-01-14', '2013-01-15'])\n#=\u003e '14 January - 20 February 2013'\n```\n\nIf you want to show dates by another format, you can call it:\n\n```ruby\ndate_beginning = Date.new(2013, 01, 14)\ndate_ending = Date.new(2014, 02, 15)\ndate_range_str = DateRangeFormatter.format(date_beginning, date_ending, 'short')\n```\n\nIf you want to show hours, you can call it:\n```ruby\nDateRangeFormatter.format('10:00 2013-01-14', '20:00 2013-01-14', :with_time)\n#=\u003e '14 January 2013, 10am - 08pm'\n```\n\nSee [predefined formats](https://github.com/darkleaf/date_range_formatter/blob/master/lib/locale/en.yml). Also you can override this formats or add your own.\n\nThat's all. Enjoy your profit!\n\n## Other\n\nThis idea was appeared by looking at the [article](https://coderwall.com/p/fkg-ng). Thanks to [@mbillard](https://github.com/mbillard).\n","funding_links":[],"categories":["Date and Time Processing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkleaf%2Fdate_range_formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarkleaf%2Fdate_range_formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkleaf%2Fdate_range_formatter/lists"}