{"id":15419473,"url":"https://github.com/jonathanbeber/relaxduration","last_synced_at":"2025-04-19T14:52:31.955Z","repository":{"id":57655225,"uuid":"455702800","full_name":"jonathanbeber/relaxduration","owner":"jonathanbeber","description":"If you accept that 1 day is 24 hours in some situations, you might want to parse it in Go too.","archived":false,"fork":false,"pushed_at":"2022-02-04T22:05:33.000Z","size":3,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-23T23:33:00.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanbeber.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":"2022-02-04T21:33:01.000Z","updated_at":"2022-12-07T02:30:05.000Z","dependencies_parsed_at":"2022-09-01T01:40:36.951Z","dependency_job_id":null,"html_url":"https://github.com/jonathanbeber/relaxduration","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/jonathanbeber%2Frelaxduration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Frelaxduration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Frelaxduration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Frelaxduration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanbeber","download_url":"https://codeload.github.com/jonathanbeber/relaxduration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241448918,"owners_count":19964531,"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-10-01T17:25:10.963Z","updated_at":"2025-03-02T02:32:10.247Z","avatar_url":"https://github.com/jonathanbeber.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# relaxduration\n\nIf you accept that 1 day is 24 hours in some situations, you might want\nto parse it in Go too.\n\nThis package tries to handle situations where durations were used\nwithout much care (e.g. 1 day is exactly 24 hours from now, 1 week is\n168 hours from now, etc.) and you have to parse it in `Go` for some\nreason.\n\nI decided to create it after reading this [Golang Google Groups\ndiscussion](https://groups.google.com/g/golang-nuts/c/iSuil_hY7w8) and\n[this issue](https://github.com/golang/go/issues/11473). Since I\nsearched, couldn't find one and, it took just some fun minutes, here we\nare.\n\n# Usage\n\nCheck `example_duration_test.go`, if it's not clear or you do not care\nabout `flags` try something like:\n\n```golang\npackage main\n\nimport (\n\t\"github.com/jonathanbeber/relaxduration\"\n)\n\nfunc main() {\n\td, err := relaxduration.Parse(\"3 days 7 hours and 15 secs\")\n\tif err != nil {\n\t\tprintln(\"unexpected: %v\", err)\n\t}\n\tprintln(d.String())\n\t// Output: 79h0m15s\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanbeber%2Frelaxduration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanbeber%2Frelaxduration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanbeber%2Frelaxduration/lists"}