{"id":13483843,"url":"https://github.com/sshaw/yymmdd","last_synced_at":"2025-08-16T16:33:05.422Z","repository":{"id":19539921,"uuid":"22787914","full_name":"sshaw/yymmdd","owner":"sshaw","description":"Tiny DSL for idiomatic date parsing and formatting in Ruby","archived":false,"fork":false,"pushed_at":"2014-08-11T03:04:12.000Z","size":153,"stargazers_count":77,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-27T17:54:31.710Z","etag":null,"topics":["date","dsl","metaprogramming","ruby","syntax-sugar"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"vsudilov/flask-consulate","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-09T14:34:35.000Z","updated_at":"2024-08-19T05:37:41.000Z","dependencies_parsed_at":"2022-08-20T18:20:40.807Z","dependency_job_id":null,"html_url":"https://github.com/sshaw/yymmdd","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fyymmdd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fyymmdd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fyymmdd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fyymmdd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshaw","download_url":"https://codeload.github.com/sshaw/yymmdd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229749273,"owners_count":18118321,"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","dsl","metaprogramming","ruby","syntax-sugar"],"created_at":"2024-07-31T17:01:15.842Z","updated_at":"2024-12-17T00:44:13.455Z","avatar_url":"https://github.com/sshaw.png","language":"Ruby","funding_links":[],"categories":["Gems","Date and Time Processing"],"sub_categories":["Misc"],"readme":"# YYMMDD\n\n[![Build Status](https://travis-ci.org/sshaw/yymmdd.png?branch=master)](https://travis-ci.org/sshaw/yymmdd)\n\nTiny DSL for idiomatic date parsing and formatting.\n\n## Overview\n\n    require \"yymmdd\"\n\n    include YYMMDD\n\n    puts yy/mm              # 14/08 (i.e., today's date)\n    puts yyyy/mm            # 2014/08\n    date = ymd(411207)      # Date.new(1941, 12, 7)\n\n    date = Date.today\n    puts yyyy.mm.dd(date)   # 2014.08.09\n    puts dd/mm/yy(date)     # 08/09/14\n    puts ymd(date)          # 1489\n\tputs yymmdd(date)       # 140809\n\n    date = yyyy.mm.dd(\"1941.12.07\")  # Date.new(1941, 12, 7)\n    date = mm.dd.yy(\"11.22.63\")      # Date.new(1963, 11, 22)\n    date = mm/dd/yy(\"11/21/99\")      # ...\n    date = mm/dd/yyyy(\"11/21/1999\")\n    date = mm-dd-yyyy(\"11-21-1999\")\n    date = m-d-y(\"11-21-99\")\n\n## Installation\n\n### Rubygems:\n\n    gem install yymmdd\n\n### Bundler:\n\n    gem \"yymmdd\"\n\n## Usage\n\nAll functions are [`module_function`s](http://www.ruby-doc.org/core-2.1.2/Module.html#method-i-module_function)\nso you must `include YYMMDD` to use them.\n\nWhen given a `String` it will attempt to parse it as the specified format and return a `Date`.\n\nWhen given a `Date` it will return a `String` in the specified format.\n\nAn `ArgumentError` is raised if the date can't be parsed or formatted.\n\nWith no arguments it will return an instance of a `String`-like object (it overrides `to_s` and `to_str`) representing\ntoday's date in the specified format. In the most common cases you can treat it like a `String`:\n\n    date = yyyy/mm/dd\n\tputs \"Today's date: #{date}\"\n    text = [\"Dates: \", yy/mm, yyyy/mm].join(\", \")\n\ttext = \"A great date: \" \u003c\u003c date\n\nBut in some instances you'll have to expilictly call `to_s`:\n\n    printf \"Today's date: %s\\n\", date.to_s\n\nAll the heavy lifting is done by `Date#strftime` and `Date.strptime`.\n\n### Format Specifiers\n\nThe table below lists the available format specifiers. All of these can be separated by one of the supported\ndelimiters: `\"/\"`, `\".\"`, or `\"-\"`.\n\n\u003ctable\u003e\n  \u003cthead\u003e\n\t\u003cth\u003eName\u003c/th\u003e\u003cth\u003eFormat\u003c/th\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003ed\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eday of the year, no 0 padding\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003edd\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eday of the year\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003em\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eday of the month, no 0 padding\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003emm\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eday of the month\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003ey\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e2 digit year\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003eyy\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e2 digit year\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t  \u003ctd\u003e\u003ccode\u003eyyyy\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e4 digit year\u003c/td\u003e\n\t\u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\nThere are also combined, delimiterless functions for all combinations of the above, e.g., `ymd`, `mdy`, `yymmdd`, etc...\n\n## Caveats\n\nDue to operator precedence you can't mix delimiters.\n\n## Author\n\nSkye Shaw [sshaw AT gmail.com]\n\n## License\n\nReleased under the MIT License: www.opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshaw%2Fyymmdd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshaw%2Fyymmdd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshaw%2Fyymmdd/lists"}