{"id":13747640,"url":"https://github.com/jeremyw/stamp","last_synced_at":"2025-05-09T09:30:36.016Z","repository":{"id":56896744,"uuid":"1972109","full_name":"jeremyw/stamp","owner":"jeremyw","description":"Date and time formatting for humans.","archived":false,"fork":false,"pushed_at":"2020-07-22T23:57:50.000Z","size":78,"stargazers_count":963,"open_issues_count":0,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-16T07:16:20.265Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/jeremyw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-29T12:10:00.000Z","updated_at":"2025-01-25T02:27:45.000Z","dependencies_parsed_at":"2022-08-20T17:10:28.135Z","dependency_job_id":null,"html_url":"https://github.com/jeremyw/stamp","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyw%2Fstamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyw%2Fstamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyw%2Fstamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyw%2Fstamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeremyw","download_url":"https://codeload.github.com/jeremyw/stamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253226270,"owners_count":21874304,"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":[],"created_at":"2024-08-03T06:01:35.981Z","updated_at":"2025-05-09T09:30:35.788Z","avatar_url":"https://github.com/jeremyw.png","language":"Ruby","funding_links":[],"categories":["Ruby","Date and Time","Date and Time Processing"],"sub_categories":[],"readme":"# stamp\n\nFormat dates and times based on human-friendly examples, not arcane\n[strftime](http://strfti.me) directives.\n\n[![Build Status](https://secure.travis-ci.org/jeremyw/stamp.png)](http://travis-ci.org/jeremyw/stamp)\n\n## Installation\n\nJust `gem install stamp`, or add stamp to your Gemfile and `bundle install`.\n\n## Usage\n\nYour Ruby dates and times get a powerful new method: `stamp`.\n\nYou might be concerned that \"stamp\" isn't descriptive enough for developers\nreading your code who aren't familiar with this gem. If that's the case, the\nfollowing aliases are provided:\n\n* `stamp_like`\n* `format_like`\n\n### Dates\n\nGive `Date#stamp` an example date string with whatever month, day, year,\nand weekday parts you'd like, and your date will be formatted accordingly:\n\n```ruby\ndate = Date.new(2011, 6, 9)\ndate.stamp(\"March 1, 1999\")         #=\u003e \"June 9, 2011\"\ndate.stamp(\"Jan 1, 1999\")           #=\u003e \"Jun 9, 2011\"\ndate.stamp(\"Jan 01\")                #=\u003e \"Jun 09\"\ndate.stamp(\"Sunday, May 1, 2000\")   #=\u003e \"Thursday, June 9, 2011\"\ndate.stamp(\"Sun Aug 5\")             #=\u003e \"Thu Jun 9\"\ndate.stamp(\"12/31/99\")              #=\u003e \"06/09/11\"\ndate.stamp(\"DOB: 12/31/2000\")       #=\u003e \"DOB: 06/09/2011\"\n```\n\nIt even formats ordinal days!\n\n```ruby\ndate.stamp(\"November 5th\")          #=\u003e \"June 9th\"\ndate.stamp(\"1st of Jan\")            #=\u003e \"9th of Jun\"\n```\n\n### Times\n\n`Time#stamp` supports the same kinds of examples as `Date`, but also formats\nhours, minutes, and seconds when it sees colon-separated values.\n\n```ruby\ntime = Time.utc(2011, 6, 9, 20, 52, 30)\ntime.stamp(\"3:00 AM\")               #=\u003e \"8:52 PM\"\ntime.stamp(\"01:00:00 AM\")           #=\u003e \"08:52:30 PM\"\ntime.stamp(\"23:59\")                 #=\u003e \"20:52\"\ntime.stamp(\"23:59:59\")              #=\u003e \"20:52:30\"\ntime.stamp(\"Jan 1 at 01:00 AM\")     #=\u003e \"Jun 9 at 08:52 PM\"\ntime.stamp(\"23:59 UTC\")             #=\u003e \"20:52 PST\"\n```\n\n## Features\n\n* Abbreviated and full names of months and weekdays are recognized.\n* Days with or without a leading zero work instinctively.\n* Standard time zone abbreviations are recognized; e.g. \"UTC\", \"PST\", \"EST\".\n* Include any extraneous text you'd like; e.g. \"DOB:\".\n\n### Disambiguation by value\n\nYou can use any month, weekday, day, or year value that makes sense in your\nexamples, and stamp can often infer your intent based on context, but there\nmay be times that you need to use unambiguous values to make your intent more\nexplicit.\n\nFor example, \"01/09\" could refer to January 9, September 1, or\nJanuary 2009. More explicit examples include \"12/31\", \"31/12\", and \"12/99\".\n\nUsing unambiguous values will also help people who read the code in the\nfuture, including yourself, understand your intent.\n\n### Rails Integration\n\nStamp makes it easy to configure your Rails application's common date and time\nformats in a more self-documenting way with `DATE_FORMATS`:\n\n```ruby\n# config/initializers/date_formats.rb\nDate::DATE_FORMATS[:short]    = Proc.new { |date| date.stamp(\"Sun Jan 5\") }\nTime::DATE_FORMATS[:military] = Proc.new { |time| time.stamp(\"5 January 23:59\") }\n```\n\nTo use your formats:\n\n```ruby\nDate.today.to_s(:short)   #=\u003e \"Sat Jul 16\"\nTime.now.to_s(:military)  #=\u003e \"16 July 15:35\"\n```\n\n### Limitations\n\n* `DateTime` should inherit stamp behavior from `Date`, but it hasn't been thoroughly tested. Patches welcome!\n\n## Copyright\n\nCopyright (c) 2011 Jeremy Weiskotten (@doctorzaius). See LICENSE.txt for\nfurther details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremyw%2Fstamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeremyw%2Fstamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremyw%2Fstamp/lists"}