README
¶
Jalaali
Golang implementation of Jalaali JS and Jalaali Python implementations of Jalaali (Jalali, Persian, Khayyami, Khorshidi, Shamsi) convertion to Gregorian calendar system and vice-versa.
This implementation is based on an algorithm by Kazimierz M. Borkowski. Borkowski claims that this algorithm works correctly for 3000 years!
Documentation on API is available here at Go official documentation site.
Installation
Use go get
on this repository:
$ go get -u github.com/jalaali/go-jalaali
Usage
- Wrapper around Golang time package:
- Call
Jalaali.Now()
to get instance of current time. You can use all function fromtime
package with this wrapper. - Call
Jalaali.From(t)
and pass atime
instance to it. The you can work with it the same way you work withtime
package.
- Call
- Jalaali Formatting:
- Call
JFormat
method of a Jalaali instance and pass it the same formatting options that is used for Golangtime
package. The output will be in Jalaali date and use persian digits and words.
- Call
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLeapYear ¶
IsLeapYear take a Jalaali year and return true if it is leap year. Error is not nil if Jalaali year passed to function is not valid.
func IsValidDate ¶
IsValidDate take Jalaali date and return true if it is valid, otherwise false.
func MonthLength ¶
MonthLength take Jalaali date and return length of that specific month. Error is not nil if Jalaali year passed to function is not valid.
Types ¶
type ErrorInvalidYear ¶
type ErrorInvalidYear struct {
// contains filtered or unexported fields
}
ErrorInvalidYear is happening when year passed is is in proper range.
func (*ErrorInvalidYear) Error ¶
func (e *ErrorInvalidYear) Error() string
type ErrorNilReference ¶
type ErrorNilReference struct{}
ErrorNilReference is happening when a pointer is nil.
func (*ErrorNilReference) Error ¶
func (e *ErrorNilReference) Error() string
type Jalaali ¶
A simple wrapper around Golang default time package. You have all the functionality of default time package and functionalities needed for Jalaali calender.
type Month ¶
type Month int
A Month specifies a month of the year (Farvardin = 1, ...).