A Go library for Persian (Solar Hijri) calendar conversions with full compatibility to Go's standard time package.
Go Persian Calendar is a Go library that implements the Persian (Solar Hijri) calendar system with full conversion capabilities to and from the Gregorian calendar. It solves the problem of handling Persian dates in Go applications by providing a comprehensive API that mirrors Go's standard time package while adding Persian-specific functionality.
Go developers building applications for Persian-speaking markets or needing to handle Persian calendar dates in their systems, including financial, scheduling, and cultural applications.
Developers choose this library because it offers complete Persian calendar functionality with perfect compatibility to Go's standard time package, eliminating the need for custom date handling code while providing accurate conversions and localization features.
The implementation of Persian (Solar Hijri) Calendar in Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Acts as a drop-in replacement for Go's standard time package, using familiar methods like ptime.New() and ptime.Date() for easy adoption in existing codebases, as shown in the getting started examples.
Supports full bidirectional conversion between Persian and Gregorian calendars, plus additional operations like week/month boundaries and date comparisons, demonstrated with methods such as Yesterday() and MonthWeek().
Provides month names in both Iranian and Dari Persian variants via MMM and MMI format specifiers, making it suitable for applications targeting different Persian-speaking regions.
Offers custom Persian date formatting and compatibility with Go's standard time formatting patterns, allowing extensive customization as detailed in the formatting sections of the README.
Cannot handle Gregorian dates before year 1097, returning a zero instance of ptime.Time, which restricts its use in historical or archival applications, as admitted in the limitations section.
Limited to Persian and Gregorian calendars only, with no built-in support for other systems like Islamic Hijri or Julian, requiring additional libraries for multi-calendar projects.
Uses Julian calendar as an intermediary for all conversions, which might introduce unnecessary computational steps compared to direct algorithms, though performance impact is not explicitly addressed.