{"id":36687694,"url":"https://github.com/goark/koyomi","last_synced_at":"2026-01-12T11:16:16.323Z","repository":{"id":40551489,"uuid":"260081761","full_name":"goark/koyomi","owner":"goark","description":"日本のこよみ","archived":false,"fork":false,"pushed_at":"2025-02-08T03:52:16.000Z","size":345,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T09:57:20.359Z","etag":null,"topics":["calendar","ephemeris","golang","golang-module","golang-package"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goark.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":"2020-04-30T01:05:35.000Z","updated_at":"2025-07-08T23:37:21.000Z","dependencies_parsed_at":"2024-06-02T07:44:04.598Z","dependency_job_id":"cdc47884-46a9-427a-8271-08900feb7a33","html_url":"https://github.com/goark/koyomi","commit_stats":null,"previous_names":["spiegel-im-spiegel/koyomi"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/goark/koyomi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Fkoyomi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Fkoyomi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Fkoyomi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Fkoyomi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goark","download_url":"https://codeload.github.com/goark/koyomi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goark%2Fkoyomi/sbom","scorecard":{"id":432796,"data":{"date":"2025-08-11","repo":{"name":"github.com/goark/koyomi","commit":"5deb2857f3473d62d59d5be63d64ec84d487423e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/lint.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/vulns.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/vulns.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/vulns.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/vulns.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/vulns.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/goark/koyomi/vulns.yml/master?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/lint.yml:49","Warn: goCommand not pinned by hash: .github/workflows/vulns.yml:18","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   2 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:27","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/lint.yml:9","Warn: no topLevel permission defined: .github/workflows/vulns.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T03:46:06.656Z","repository_id":40551489,"created_at":"2025-08-19T03:46:06.656Z","updated_at":"2025-08-19T03:46:06.656Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["calendar","ephemeris","golang","golang-module","golang-package"],"created_at":"2026-01-12T11:16:16.227Z","updated_at":"2026-01-12T11:16:16.313Z","avatar_url":"https://github.com/goark.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [koyomi] -- 日本のこよみ\n\n[![check vulns](https://github.com/goark/koyomi/workflows/vulns/badge.svg)](https://github.com/goark/koyomi/actions)\n[![lint status](https://github.com/goark/koyomi/workflows/lint/badge.svg)](https://github.com/goark/koyomi/actions)\n[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/goark/koyomi/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/goark/koyomi.svg)](https://github.com/goark/koyomi/releases/latest)\n\n**Migrated repository to [github.com/goark/koyomi][koyomi]**\n\n「[国立天文台 天文情報センター 暦計算室](http://eco.mtk.nao.ac.jp/koyomi/)」より日本の暦情報を取得する [Go 言語]用パッケージです。 Google Calendar を経由して取得しています。\n\n取得可能な情報は以下の通りです。\n\n```go\nconst (\n    Holiday   CalendarID = iota + 1 //国民の祝日および休日\n    MoonPhase                       //朔弦望\n    SolarTerm                       //二十四節気・雑節\n    Eclipse                         //日食・月食・日面経過\n    Planet                          //惑星現象\n)\n```\n\n## 簡単な使い方\n\n### CSV 形式で出力\n\n```go\npackage main\n\nimport (\n    \"bytes\"\n    \"io\"\n    \"os\"\n    \"time\"\n\n    \"github.com/goark/koyomi\"\n    \"github.com/goark/koyomi/value\"\n)\n\nfunc main() {\n    start, _ := value.DateFrom(\"2019-05-01\")\n    end := value.NewDate(time.Date(2019, time.May, 31, 0, 0, 0, 0, value.JST))\n    td, err := os.MkdirTemp(os.TempDir(), \"sample\")\n    if err != nil {\n        return\n    }\n    defer func() { _ = os.RemoveAll(td) }()\n    k, err := koyomi.NewSource(\n        koyomi.WithCalendarID(koyomi.Holiday, koyomi.SolarTerm),\n        koyomi.WithStartDate(start),\n        koyomi.WithEndDate(end),\n        koyomi.WithTempDir(td),\n    ).Get()\n    if err != nil {\n        return\n    }\n\n    csv, err := k.EncodeCSV()\n    if err != nil {\n        return\n    }\n    io.Copy(os.Stdout, bytes.NewReader(csv))\n}\n```\n\n### テンプレートを指定して出力\n\n```go\npackage main\n\nimport (\n    \"os\"\n    \"text/template\"\n    \"time\"\n\n    \"github.com/goark/koyomi\"\n    \"github.com/goark/koyomi/value\"\n)\n\nfunc main() {\n    start, _ := value.DateFrom(\"2019-05-01\")\n    end := value.NewDate(time.Date(2019, time.May, 31, 0, 0, 0, 0, value.JST))\n    td, err := os.MkdirTemp(os.TempDir(), \"sample\")\n    if err != nil {\n        return\n    }\n    defer func() { _ = os.RemoveAll(td) }()\n    k, err := koyomi.NewSource(\n        koyomi.WithCalendarID(koyomi.Holiday, koyomi.SolarTerm),\n        koyomi.WithStartDate(start),\n        koyomi.WithEndDate(end),\n        koyomi.WithTempDir(td),\n    ).Get()\n    if err != nil {\n        return\n    }\n\n    myTemplate := `| 日付 | 曜日 | 内容 |\n| ---- |:----:| ---- |\n{{ range . }}| {{ .Date.StringJp }} | {{ .Date.WeekdayJp.ShortStringJp }} | {{ .Title }} |\n{{ end -}}`\n\n    t, err := template.New(\"\").Parse(myTemplate)\n    if err != nil {\n        return\n    }\n    if err := t.Execute(os.Stdout, k.Events()); err != nil {\n        return\n    }\n    //Output:\n    //| 日付 | 曜日 | 内容 |\n    //| ---- |:----:| ---- |\n    //| 2019年5月1日 | 水 | 休日 (天皇の即位の日) |\n    //| 2019年5月2日 | 木 | 休日 |\n    //| 2019年5月2日 | 木 | 八十八夜 |\n    //| 2019年5月3日 | 金 | 憲法記念日 |\n    //| 2019年5月4日 | 土 | みどりの日 |\n    //| 2019年5月5日 | 日 | こどもの日 |\n    //| 2019年5月6日 | 月 | 休日 |\n    //| 2019年5月6日 | 月 | 立夏 |\n    //| 2019年5月21日 | 火 | 小満 |\n}\n```\n\n## おまけ機能\n\n### 西暦⇔和暦 変換\n\n元号を含む和暦と西暦との変換を行います。\n元号は以下のものに対応しています（グレゴリオ暦採用以降）。\n\n| 元号             | 起点           |\n| ---------------- | -------------- |\n| 明治（改暦以降） | 1873年1月1日   |\n| 大正             | 1912年7月30日  |\n| 昭和             | 1926年12月25日 |\n| 平成             | 1989年1月8日   |\n| 令和             | 2019年5月1日   |\n\n#### 西暦から和暦への変換\n\n```go\npackage main\n\nimport (\n    \"flag\"\n    \"fmt\"\n    \"os\"\n    \"strconv\"\n    \"time\"\n\n    \"github.com/goark/koyomi/value\"\n)\n\nfunc main() {\n    flag.Parse()\n    argsStr := flag.Args()\n    tm := time.Now()\n    if len(argsStr) \u003e 0 {\n        if len(argsStr) \u003c 3 {\n            fmt.Fprintln(os.Stderr, \"年月日を指定してください\")\n            return\n        }\n        args := make([]int, 3)\n        for i := 0; i \u003c 3; i++ {\n            num, err := strconv.Atoi(argsStr[i])\n            if err != nil {\n                fmt.Fprintln(os.Stderr, err)\n                return\n            }\n            args[i] = num\n        }\n        tm = time.Date(args[0], time.Month(args[1]), args[2], 0, 0, 0, 0, time.Local)\n    }\n    te := value.NewDate(tm)\n    n, y := te.YearEraString()\n    if len(n) == 0 {\n        fmt.Fprintln(os.Stderr, \"正しい年月日を指定してください\")\n        return\n    }\n    fmt.Printf(\"%s%s%d月%d日\\n\", n, y, te.Month(), te.Day())\n}\n```\n\nこれを実行すると以下のような結果になります。\n\n```\n$ go run sample/sample1.go 2019 4 30\n平成31年4月30日\n\n$ go run sample/sample1.go 2019 5 1\n令和元年5月1日\n```\n\n#### 和暦から西暦への変換\n\n```go\npackage main\n\nimport (\n    \"flag\"\n    \"fmt\"\n    \"os\"\n    \"strconv\"\n    \"time\"\n\n    \"github.com/goark/koyomi/value\"\n)\n\nfunc main() {\n    flag.Parse()\n    argsStr := flag.Args()\n\n    if len(argsStr) \u003c 4 {\n        fmt.Fprintln(os.Stderr, \"元号 年 月 日 を指定してください\")\n        return\n    }\n    name := argsStr[0]\n    args := make([]int, 3)\n    for i := 0; i \u003c 3; i++ {\n        num, err := strconv.Atoi(argsStr[i+1])\n        if err != nil {\n            fmt.Fprintln(os.Stderr, err)\n            return\n        }\n        args[i] = num\n    }\n    te := value.NewDateEra(value.EraName(name), args[0], time.Month(args[1]), args[2])\n    fmt.Println(te.Format(\"西暦2006年1月2日\"))\n}\n```\n\nこれを実行すると以下のような結果になります。\n\n```\n$ go run sample/sample2.go 平成 31 4 30\n西暦2019年4月30日\n\n$ go run sample/sample2.go 令和 1 5 1\n西暦2019年5月1日\n\n$ go run sample/sample2.go 昭和 100 1 1\n西暦2025年1月1日\n```\n\n### 十干十二支を数え上げる\n\n```go\npackage main\n\nimport (\n    \"flag\"\n    \"fmt\"\n    \"os\"\n\n    \"github.com/goark/koyomi/value\"\n    \"github.com/goark/koyomi/zodiac\"\n)\n\nfunc main() {\n    flag.Parse()\n    args := flag.Args()\n    if len(args) \u003c 1 {\n        fmt.Fprintln(os.Stderr, os.ErrInvalid)\n        return\n    }\n    for _, s := range args {\n        t, err := value.DateFrom(s)\n        if err != nil {\n            fmt.Fprintln(os.Stderr, err)\n            continue\n        }\n        kan, shi := zodiac.ZodiacYearNumber(t.Year())\n        fmt.Printf(\"Year %v is %v%v (Eho: %v)\\n\", t.Year(), kan, shi, kan.DirectionJp())\n        kan, shi = zodiac.ZodiacDayNumber(t)\n        fmt.Printf(\"Day %v is %v%v\\n\", t.Format(\"2006-01-02\"), kan, shi)\n    }\n}\n```\n\nこれを実行すると以下のような結果になります。\n\n```\n$ go run sample/sample3.go 2021-07-28\nYear 2021 is 辛丑 (Eho: 南南東微南)\nDay 2021-07-28 is 丁丑\n```\n\n### ユリウス日\n\n```go\npackage main\n\nimport (\n    \"flag\"\n    \"fmt\"\n    \"os\"\n\n    \"github.com/goark/koyomi/jdn\"\n    \"github.com/goark/koyomi/value\"\n)\n\nfunc main() {\n    flag.Parse()\n    args := flag.Args()\n    if len(args) \u003c 1 {\n        fmt.Fprintln(os.Stderr, os.ErrInvalid)\n        return\n    }\n    for _, s := range args {\n        t, err := value.DateFrom(s)\n        if err != nil {\n            fmt.Fprintln(os.Stderr, err)\n            continue\n        }\n        j := jdn.GetJDN(t.Time)\n        fmt.Printf(\"Julian Day Number of %v is %v\\n\", t.Format(\"2006-01-02\"), j)\n    }\n}\n```\n\nこれを実行すると以下のような結果になります。\n\n```\n$ go run sample/sample4.go 2023-02-25\nJulian Day Number of 2023-02-25 is 2460000\n```\n\n## Modules Requirement Graph\n\n[![dependency.png](./dependency.png)](./dependency.png)\n\n## Links\n\n- [国立天文台 天文情報センター 暦計算室](https://eco.mtk.nao.ac.jp/koyomi/)\n    - [今月のこよみ powered by Google Calendar - 国立天文台暦計算室](https://eco.mtk.nao.ac.jp/koyomi/cande/calendar.html)\n    - [ユリウス日について - 国立天文台暦計算室](https://eco.mtk.nao.ac.jp/koyomi/topics/html/topics2023_1.html)\n- [日本の暦情報を取得するパッケージを作ってみた — リリース情報 | text.Baldanders.info](https://text.baldanders.info/release/2020/05/koyomi/)\n\n[Go 言語]: https://go.dev/ \"The Go Programming Language\"\n[koyomi]: https://github.com/goark/koyomi \"goark/koyomi: 日本のこよみ\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoark%2Fkoyomi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoark%2Fkoyomi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoark%2Fkoyomi/lists"}