{"id":28157074,"url":"https://github.com/opensource-nepal/go-nepali","last_synced_at":"2025-05-15T08:17:37.002Z","repository":{"id":65788525,"uuid":"595914501","full_name":"opensource-nepal/go-nepali","owner":"opensource-nepal","description":"go-nepali is a go package containing features that will be useful for Nepali projects. ","archived":false,"fork":false,"pushed_at":"2025-04-22T01:52:31.000Z","size":94,"stargazers_count":8,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-22T03:14:40.009Z","etag":null,"topics":["ad-to-bs","bs-to-ad","datetime","go","golang","golang-library","golang-package","nepal","nepali","nepali-date","nepali-date-converter","nepalidateconverter","time"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opensource-nepal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","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,"zenodo":null}},"created_at":"2023-02-01T04:05:25.000Z","updated_at":"2025-04-22T01:51:59.000Z","dependencies_parsed_at":"2024-03-31T07:22:56.148Z","dependency_job_id":"2d203398-23fb-4695-87e4-eae89854d73b","html_url":"https://github.com/opensource-nepal/go-nepali","commit_stats":{"total_commits":54,"total_committers":4,"mean_commits":13.5,"dds":0.4444444444444444,"last_synced_commit":"75730b7dfe66e755d86fb3f805a66bb3ff6cd974"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensource-nepal%2Fgo-nepali","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensource-nepal%2Fgo-nepali/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensource-nepal%2Fgo-nepali/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensource-nepal%2Fgo-nepali/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensource-nepal","download_url":"https://codeload.github.com/opensource-nepal/go-nepali/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301583,"owners_count":22047907,"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":["ad-to-bs","bs-to-ad","datetime","go","golang","golang-library","golang-package","nepal","nepali","nepali-date","nepali-date-converter","nepalidateconverter","time"],"created_at":"2025-05-15T08:16:09.436Z","updated_at":"2025-05-15T08:17:36.931Z","avatar_url":"https://github.com/opensource-nepal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Nepali\n\n[![CI status](https://github.com/opensource-nepal/go-nepali/actions/workflows/nepali-ci.yml/badge.svg?branch=main)](https://github.com/opensource-nepal/go-nepali/actions)\n[![codecov](https://codecov.io/gh/opensource-nepal/go-nepali/branch/main/graph/badge.svg?token=PTUHYWCJ4I)](https://codecov.io/gh/opensource-nepal/go-nepali)\n[![Release](https://img.shields.io/github/v/release/opensource-nepal/go-nepali?label=Latest)](https://github.com/opensource-nepal/go-nepali/releases)\n[![License](https://img.shields.io/github/license/opensource-nepal/go-nepali?label=License)](https://github.com/opensource-nepal/go-nepali/blob/main/LICENSE)\n\n\nThis is a `golang` implementation of the package from [opensource-nepal](https://github.com/opensource-nepal)'s `python` package [nepali](https://github.com/opensource-nepal/py-nepali).\n\nWe'll try to include all the features provided in the aforementioned package. We'll be releasing features in parts to support all or most features given by `go`'s `time` package.\n\n### Installing\n\nTo install this package use `go get`\n\n```shell\n$ go get -u github.com/opensource-nepal/go-nepali\n```\n\nOr if there is some error then, use `go install`\n\n```shell\n$ go install github.com/opensource-nepal/go-nepali\n```\n\n#### Usage\n\n_NOTE: Currently this package is in beta version, so it only includes basic features like date conversion, formatting and parsing. Also, the output is read-only._\n\nIn this package, we provide 2 `go` packages, `nepalitime` and `dateConverter`.\n\n1. `nepalitime`: The functionalities provided in `nepalitime` are described below:\n\n   1. To get a `NepaliTime` object:\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/nepalitime\"\n\n      npTime, err := nepalitime.Date(2079,  10,  15,  14,  29,  6,  7)\n      ```\n\n      The `err` object could containing error if you pass in errorneous values into the `Date` function.\n      \n      Once you have the `NepaliTime` object, you will be able to access methods, some of which are described below:\n      1. `GetEnglishTime()` -\u003e Returns the corresponding English time\n      2. `Date()` -\u003e Returns year, month and day as separate return values\n      3. `Clock()` -\u003e Returns hour, minute and second as separate return values\n\n   2. If you already have a `time.Time` object then, you can get the corresponding `NepaliTime` object using the function `FromEnglishTime`:\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/nepalitime\"\n\n      // just to ensure that the timezone is Asia/Kathmandu\n      // else the time will be adjusted accordingly\n      enTime := time.Date(2023, 1, 29, 14, 29, 6, 7, nepalitime.GetNepaliLocation())\n      nt, err := nepalitime.FromEnglishTime(enTime)\n      ```\n\n   3. To parse a date string into a `NepaliTime` object the `Parse` function can be used. This is the Nepali equivalent of the `time.Parse` function of go but instead of using the time parsing format of `Mon Jan 2 15:04:05 -0700 MST 2006` we decided to go with the `%Y/%m/%d` style parsing. We intend on supporting the go style formatting in the upcoming releases. Please see [directives](#date-directives) section to know which directives we support.\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/nepalitime\"\n\n      datetimeStr := \"2079/10/14\"\n      format := \"%Y/%m/%d\"\n\n      npTime, err := nepalitime.Parse(datetimeStr, format)\n      ```\n\n   4. To get current Nepali time:\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/nepalitime\"\n\n      npTime := nepalitime.Now()\n      ```\n\n   5. To get the current English time in Nepal:\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/nepalitime\"\n\n      enTime := nepalitime.GetCurrentEnglishTime()\n      ```\n   \n   6. To format the `NepaliTime` object to a string that you want.\n      ```go\n      \n      import (\n        \"fmt\"\n        \"github.com/opensource-nepal/go-nepali/nepalitime\"\n      )\n      \n      npTime, _ := nepalitime.Date(2079,  10,  15,  14,  29,  6,  7, 123)\n      fmt.Println(npTime.Format(\"%Y/%m/%d %H:%M:%S:%f\"))\n      ```\n      _Please see [directives](#date-directives) section to know which directives we support._\n\n2. `dateConverter`: The functionalities provided in `dateConverter` are described below:\n\n   1. This is one of the core functionalities in which an English date(not an object) is converted to Nepali date in parts i.e. year, month, day in an array:\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/dateConverter\"\n\n      // npDate is an array of 3 length which contains\n      // year, month and day sequential form\n      npDate, err := dateConverter.EnglishToNepali(2023, 1, 28)\n      ```\n\n   2. To convert a Nepali date(not an object) to English date in parts i.e. year, month, day in an array:\n\n      ```go\n      import \"github.com/opensource-nepal/go-nepali/dateConverter\"\n\n      // enDate is an array of 3 length which contains\n      // year, month and day sequential form\n      enDate, err := dateConverter.NepaliToEnglish(2087, 8, 10)\n      ```\n\n#### Date Directives\n\n| Directive | Meaning                                                  | Example                                  |\n|-----------|----------------------------------------------------------|------------------------------------------|\n| `%d`      | Day of the month as a zero-padded decimal number.        | 01, 02, …, 31                            |\n| `%-d`     | Day of the month as a decimal number.                    | 1, 2, …, 31                              |\n| `%m`      | Month as a zero-padded decimal number.                   | 01, 02, …, 12                            |\n| `%-m`     | Month as a decimal number.                               | 1, 2, …, 12                              |\n| `%B`      | Month as a string                                        | Baisakh, Jestha, ..., Chaitra            |\n| `%A`      | Full name of day of the week                             | Sunday, Monday, ..., Saturday            |\n| `%a`      | Half name of day of the week                             | Sun, Mon, ..., Sat                       |\n| `%y`      | Year without century as a zero-padded decimal number.    | 00, 01, …, 99                            |\n| `%-y`     | Year without century as a decimal number.                | 0, 1, …, 99                              |\n| `%Y`      | Year with century as a zero-padded decimal number.       | 0001, 0002, …, 2078, 2079, …, 9998, 9999 |\n| `%-Y`     | Year with century as a decimal number.                   | 1, 2, …, 2078, 2079, …, 9998, 9999       |\n| `%H`      | Hour (24-hour clock) as a zero-padded decimal number.    | 00, 01, …, 23                            |\n| `%-H`     | Hour (24-hour clock) as a decimal number.                | 0, 1, …, 23                              |\n| `%I`      | Hour (12-hour clock) as a zero-padded decimal number.    | 01, 02, …, 12                            |\n| `%-I`     | Hour (12-hour clock) as a decimal number.                | 1, 2, …, 12                              |\n| `%p`      | Locale’s equivalent of either AM or PM.                  | AM, PM (en_US);\u003cbr\u003e\u003cbr\u003eam, pm (de_DE)    |\n| `%M`      | Minute as a zero-padded decimal number.                  | 00, 01, …, 59                            |\n| `%-M`     | Minute as a decimal number.                              | 0, 1, …, 59                              |\n| `%S`      | Second as a zero-padded decimal number.                  | 00, 01, …, 59                            |\n| `%-S`     | Second as a decimal number.                              | 0, 1, …, 59                              |\n| `%f`      | Nanosecond as a decimal number, zero-padded to 6 digits. | 000000, 000001, …, 999999                |\n| `%-f`     | Nanosecond as a decimal number.                          | 0, 1, …, 999999                          |\n| `%%`      | A literal `'%'` character.                               | %                                        |\n\n## Contribution\n\nWe appreciate feedback and contribution to this package. To get started please see our [contribution guide](contributing.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensource-nepal%2Fgo-nepali","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensource-nepal%2Fgo-nepali","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensource-nepal%2Fgo-nepali/lists"}