{"id":13412439,"url":"https://github.com/uniplaces/carbon","last_synced_at":"2025-04-11T23:14:42.828Z","repository":{"id":10756781,"uuid":"64838988","full_name":"uniplaces/carbon","owner":"uniplaces","description":"Carbon for Golang, an extension for Time","archived":false,"fork":false,"pushed_at":"2024-01-17T04:35:27.000Z","size":229,"stargazers_count":783,"open_issues_count":1,"forks_count":55,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-04-11T23:14:17.478Z","etag":null,"topics":[],"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/uniplaces.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}},"created_at":"2016-08-03T10:55:52.000Z","updated_at":"2025-03-22T08:17:51.000Z","dependencies_parsed_at":"2024-01-30T04:54:14.540Z","dependency_job_id":null,"html_url":"https://github.com/uniplaces/carbon","commit_stats":{"total_commits":153,"total_committers":15,"mean_commits":10.2,"dds":"0.28104575163398693","last_synced_commit":"89651f161f29f0ddd37359a93e33043ba5db529d"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniplaces%2Fcarbon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniplaces%2Fcarbon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniplaces%2Fcarbon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniplaces%2Fcarbon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uniplaces","download_url":"https://codeload.github.com/uniplaces/carbon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492884,"owners_count":21113163,"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-07-30T20:01:24.682Z","updated_at":"2025-04-11T23:14:42.804Z","avatar_url":"https://github.com/uniplaces.png","language":"Go","funding_links":[],"categories":["开源类库","Date and Time","日期和时间","Open source library","Go","日期和時間","\u003cspan id=\"日期和时间-date-and-time\"\u003e日期和时间 Date and Time\u003c/span\u003e","Relational Databases","日期和时间`用于处理日期和时间的库`"],"sub_categories":["日期时间","Search and Analytic Databases","检索及分析资料库","Appointment Time","Advanced Console UIs","高級控制台界面","高级控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","SQL 查询语句构建库"],"readme":"Carbon\n======\n[![Build Status](https://github.com/uniplaces/carbon/actions/workflows/pull_request.yml/badge.svg)](https://github.com/uniplaces/carbon/actions/workflows/pull_request.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/uniplaces/carbon)](https://goreportcard.com/report/github.com/uniplaces/carbon)\n[![codecov](https://codecov.io/gh/uniplaces/carbon/branch/master/graph/badge.svg)](https://codecov.io/gh/uniplaces/carbon)\n[![GoDoc](https://godoc.org/github.com/uniplaces/carbon?status.svg)](https://godoc.org/github.com/uniplaces/carbon)\n[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)\n\n\nA simple extension for [Time](https://golang.org/pkg/time/#Time) based on PHP's [Carbon](http://carbon.nesbot.com) library.\n\n__Features:__\n\n* [Time](https://golang.org/pkg/time/#Time) is embedded into Carbon (provides access to all of [Time](https://golang.org/pkg/time/#Time)'s functionality)\n* Supports addition and subtraction of dates\n* Provides methods to compare dates\n* Supports date formatting in common formats\n* Easily calculate difference between dates\n* Ease testing with dates by using `carbon.Freeze()` and `carbon.Now()`\n\n__To do:__\n\n* Implement all localization features as in Carbon\n* Improve the code style to be more idiomatic Go\n\n## Getting started\nInstall Carbon:\n```\ngo get github.com/uniplaces/carbon\n```\n\nAdd to your imports to start using Carbon\n```go\nimport \"github.com/uniplaces/carbon\"\n```\n\n## Examples\nA simple example to get you started:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/uniplaces/carbon\"\n)\n\nfunc main() {\n\tfmt.Printf(\"Right now is %s\\n\", carbon.Now().DateTimeString())\n\n\ttoday, _ := carbon.NowInLocation(\"America/Vancouver\")\n\tfmt.Printf(\"Right now in Vancouver is %s\\n\", today)\n\n\tfmt.Printf(\"Tomorrow is %s\\n\", carbon.Now().AddDay())\n\tfmt.Printf(\"Last week is %s\\n\", carbon.Now().SubWeek())\n\n\tnextOlympics, _ := carbon.CreateFromDate(2016, time.August, 5, \"Europe/London\")\n\tnextOlympics = nextOlympics.AddYears(4)\n\tfmt.Printf(\"Next olympics are in %d\\n\", nextOlympics.Year())\n\n\tif carbon.Now().IsWeekend() {\n\t\tfmt.Printf(\"Party time!\")\n\t}\n}\n```\n\nYou can also check the `examples/` folder for more examples.\n\n## Contributing\nPlease feel free to make suggestions, create issues, fork the repository and send pull requests!\n\n## Licence\nCopyright 2016 UNIPLACES\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funiplaces%2Fcarbon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funiplaces%2Fcarbon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funiplaces%2Fcarbon/lists"}