A Go library providing useful extensions like Timedelta and Strftime to the standard time package.
timeutil is a Go library that extends the standard `time` package with additional utilities like Timedelta and Strftime. It provides Python-inspired functionality for easier date and time manipulation, such as representing durations and formatting dates with custom directives. The library solves the problem of missing high-level time operations in Go's core library.
Go developers who need more flexible date and time manipulation, especially those familiar with Python's datetime utilities or requiring advanced formatting beyond Go's standard time package.
Developers choose timeutil for its intuitive, Python-inspired API that simplifies complex time operations, its seamless integration with Go's native time types, and its Unicode support in date formatting, which is not natively available in Go.
timeutil - useful extensions (Timedelta, Strftime, ...) to the golang's time package
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a Timedelta struct with methods like Add, Subtract, and Abs, making date arithmetic intuitive for developers familiar with Python's datetime.timedelta, as shown in the examples for operations.
Allows custom date formatting with strftime directives (e.g., %Y-%m-%d) and supports Unicode in format strings, which Go's standard time.Format does not natively handle, demonstrated with Korean text in the README.
Timedelta can be converted to Go's time.Duration via the Duration() method, enabling easy addition to time.Time values without breaking existing time APIs, as illustrated in the quick start.
The README explicitly lists missing features in the TODO section, such as locale support, strptime for parsing, and auto date parser, limiting its utility for common time manipulation tasks.
For simple time operations, the library adds an extra layer of complexity and dependency, as standard Go time already handles basic arithmetic and formatting without third-party code.