Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. carbon

carbon

Apache-2.0Gov0.2.2

A simple Go extension for time.Time with date manipulation, comparison, formatting, and difference calculation.

GitHubGitHub
781 stars55 forks0 contributors

What is carbon?

Carbon is a Go library that extends the standard time.Time package with additional functionality inspired by PHP's Carbon library. It provides a more convenient, chainable API for common date and time operations like arithmetic, comparison, and formatting while maintaining full compatibility with Go's native time package.

Target Audience

Go developers who need to perform frequent date and time manipulations, such as adding days or comparing dates, and want a more intuitive interface than the standard library offers.

Value Proposition

Developers choose Carbon because it offers an intuitive, chainable API that simplifies date handling, embeds Go's time.Time for full compatibility, and includes testing utilities like time freezing, making it a practical alternative to raw time.Time operations.

Overview

Carbon for Golang, an extension for Time

Use Cases

Best For

  • Performing date arithmetic like adding or subtracting days, weeks, months, or years in Go applications.
  • Comparing dates with convenience methods such as IsPast(), IsFuture(), or IsWeekend().
  • Formatting dates into common string representations without manual parsing.
  • Calculating differences between dates in various units like days or years.
  • Testing time-dependent code by freezing time with carbon.Freeze() and carbon.Now().
  • Working with dates across different time zones and locations, such as converting between 'America/Vancouver' and 'Europe/London'.

Not Ideal For

  • Projects requiring comprehensive localization and internationalization support, as Carbon's localization features are marked as incomplete in the README.
  • Teams that prioritize minimal dependencies and strict adherence to Go's standard library for date operations to avoid third-party overhead.
  • Applications where performance-critical date manipulations demand zero abstraction layers, as Carbon adds some overhead compared to raw time.Time.

Pros & Cons

Pros

Chainable API

Offers a fluent interface for date manipulations, making code more readable with methods like carbon.Now().AddDay() as shown in examples.

Full Compatibility

Embeds Go's time.Time, ensuring seamless interoperability with existing code and leveraging all native time package functionality.

Testing Utilities

Includes carbon.Freeze() and carbon.Now() for easy time freezing in tests, simplifying scenarios that depend on specific dates.

Time Zone Support

Facilitates working with multiple time zones, such as creating dates in 'America/Vancouver' and 'Europe/London', per the README examples.

Cons

Incomplete Localization

The README explicitly notes that not all localization features from PHP's Carbon are implemented, limiting use in internationalized applications.

Non-Idiomatic Code

Admits a need to improve code style to be more idiomatic Go, which could affect maintainability and community adoption.

Dependency Overhead

Introduces a third-party library where Go's standard time package might suffice, adding complexity for simple date operations.

Frequently Asked Questions

Quick Stats

Stars781
Forks55
Contributors0
Open Issues0
Last commit2 years ago
CreatedSince 2016

Tags

#datetime#testing-utilities#golang#date-formatting#time-manipulation#date-arithmetic

Built With

G
Go

Included in

Go169.1k
Auto-fetched 8 hours ago

Related Projects

carboncarbon

A simple, semantic and developer-friendly time package for golang

Stars5,225
Forks262
Last commit21 days ago
nownow

Now is a time toolkit for golang

Stars4,687
Forks238
Last commit2 months ago
dateparsedateparse

GoLang Parse many date strings without knowing format in advance.

Stars2,142
Forks174
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub