{"id":20009649,"url":"https://github.com/boolproof/p6y","last_synced_at":"2025-09-20T11:18:23.324Z","repository":{"id":180684409,"uuid":"476444282","full_name":"boolproof/p6y","owner":"boolproof","description":"Duration string parser for GO","archived":false,"fork":false,"pushed_at":"2022-04-02T19:56:44.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T01:43:59.011Z","etag":null,"topics":["duration","duration-parsing","golang","iso-8601"],"latest_commit_sha":null,"homepage":"","language":"Go","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/boolproof.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":"2022-03-31T19:11:46.000Z","updated_at":"2022-04-02T12:48:00.000Z","dependencies_parsed_at":"2023-07-28T00:15:55.545Z","dependency_job_id":null,"html_url":"https://github.com/boolproof/p6y","commit_stats":null,"previous_names":["boolproof/p6y"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/boolproof/p6y","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolproof%2Fp6y","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolproof%2Fp6y/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolproof%2Fp6y/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolproof%2Fp6y/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boolproof","download_url":"https://codeload.github.com/boolproof/p6y/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boolproof%2Fp6y/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276085270,"owners_count":25582516,"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-20T02:00:10.207Z","response_time":63,"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":["duration","duration-parsing","golang","iso-8601"],"created_at":"2024-11-13T07:16:43.113Z","updated_at":"2025-09-20T11:18:23.280Z","avatar_url":"https://github.com/boolproof.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# p6y - duration string parsing in GO\nPackage provides parsing of duration information encoded in string compliant with format described by **ISO 8601** (https://en.wikipedia.org/wiki/ISO_8601#Durations).\n\n## Current limitations\nOnly `PnYnMnDTnHnMnS` and `PnW` formats are parsed by the package (no suppport for both `PYYYYMMDDThhmmss` and `P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]`).\n\nPackage can not parse values with fractions (only integer values).\n\nIf parsing is successfull (no error), use following result struct methods to access intrger values of duration components:\n- `Years()`\n- `Months()`\n- `Days()`\n- `Weeks()`\n- `Hours()`\n- `Minutes()`\n- `Seconds()`\n\n## Example usage\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/boolproof/p6y\"\n)\n\nfunc main() {\n\td, err := p6y.NewDuration(\"P7Y5DT12H\")\n\tif err == nil {\n\t\tfmt.Printf(\"This will take %d years, %d months,\"+\n\t\t\t\"%d days and %d hours\\n\",\n\t\t\td.Years(), d.Months(), d.Days(), d.Hours())\n\n\t\t//outputs: \"This will take 7 years, 0 months, 5 days and 12 hours\"\n\t} else {\n\t\tfmt.Println(err.Error())\n\t}\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboolproof%2Fp6y","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboolproof%2Fp6y","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboolproof%2Fp6y/lists"}