{"id":41347852,"url":"https://github.com/hollson/month","last_synced_at":"2026-01-23T07:12:22.798Z","repository":{"id":57566274,"uuid":"339408558","full_name":"hollson/month","owner":"hollson","description":"Month is a golang data type similar to time. Time. It is used to express  bills, tax periods, monthly, etc","archived":false,"fork":false,"pushed_at":"2021-02-17T14:06:08.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T09:19:03.106Z","etag":null,"topics":["month","types"],"latest_commit_sha":null,"homepage":"","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/hollson.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":"2021-02-16T13:32:53.000Z","updated_at":"2021-07-27T09:05:16.000Z","dependencies_parsed_at":"2022-08-27T18:41:10.424Z","dependency_job_id":null,"html_url":"https://github.com/hollson/month","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hollson/month","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollson%2Fmonth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollson%2Fmonth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollson%2Fmonth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollson%2Fmonth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hollson","download_url":"https://codeload.github.com/hollson/month/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollson%2Fmonth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["month","types"],"created_at":"2026-01-23T07:12:22.005Z","updated_at":"2026-01-23T07:12:22.790Z","avatar_url":"https://github.com/hollson.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Month数据类型\n`month.Month`是一个跟`time.Time`类似的**月期类型**，适用于表达年月数据，如账单、税期、月刊等信息。\n\n\u003cbr/\u003e\n\n## 安装\n```go\ngo get github.com/hollson/month\n```\n\u003cbr/\u003e\n\n## 使用示例\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"time\"\n\n    \"github.com/hollson/month\"\n)\n\nfunc main() {\n    Instance()\n    Methods()\n    Ranges()\n}\n\n// 创建Month实例\nfunc Instance() {\n    m1 := month.Current()\n    m2 := month.Month(202101)\n    m3 := month.New(2021, 12)\n    m4 := month.FromTime(time.Now())\n    m5 := month.FromDot(201801)\n    m6 := month.FromTick(3)\n    m7 := month.Min()\n    m8 := month.Max()\n    fmt.Printf(\" %v\\n %v\\n %v\\n %v\\n %v\\n %v\\n %v\\n %v\\n\",\n        m1, m2, m3, m4, m5, m6, m7, m8)\n}\n\n// 实例方法\nfunc Methods() {\n    m := month.FromDot(201801)\n    fmt.Println(m.Year())\n    fmt.Println(m.Month())\n    fmt.Println(m.Add(-2))\n    fmt.Println(m.Add(13))\n    fmt.Println(m.Prev())\n    fmt.Println(m.Next())\n    fmt.Println(m.Tick())\n    fmt.Println(m.Diff(month.Month(201812)))\n    fmt.Println(m.Diff(month.Month(201711)))\n    fmt.Println(m.Quarter())\n    fmt.Println(m.String())\n    fmt.Println(m.Format(\"YY年MM月\"))\n    fmt.Println(m.Format(\"yyyy年mm月\"))\n    fmt.Println(m.Format(\"mm月yyyy年\"))\n    fmt.Println(m.Format(\"yyyy-mm yyyy-mm\"))\n}\n\n// 集合遍历\nfunc Ranges() {\n    month.Range(month.Month(202002), month.Month(202103), func(m month.Month) {\n        fmt.Printf(\"%d - %d\\n\", m.Year(), m.Month())\n    })\n    fmt.Println(month.Span(month.Month(202002), month.Month(202103)))\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhollson%2Fmonth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhollson%2Fmonth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhollson%2Fmonth/lists"}