Jalali
Structural time package for jalali calendar. This package support parse from string, json and time.
Structures
There are three data structures for jalali:
- Jalali jalali date with current system time zone.
- JalaliTehran jalali date with Asia/Tehran time zone.
- JalaliKabul jalali date with Asia/Kabul time zone.
Methods
All structures has following methods for work with date.
IsNil
Check if date object is empty.
jDate.IsNil()
SetTime
Set date from standard time object.
jDate.SetTime(time.Now())
Parse
Parse date from jalali date string.
Note: if date is invalid date object will be nil.
jDate.Parse("1400-01-02")
Time
Get current date as standard time. This function return nil if date is empty.
t := jDate.Time()
Jalali
Get current date as jalali date object. This function return nil if date is empty.
j := jDate.Jalali()
UTC
Get current date as standard time object with utc timezone. This function return nil if date is empty.
utcT :=jDate.UTC()
Format
Format jalali date. This function support standard go time formatting parameters.
f := jDate.Format("2006-01-02")
Helper Functions
TehranTz
Get timezone for Asia/Tehran.
KabulTz
Get timezone for Asia/Kabul.
Parse
Parse jalali date string as time. This function use system timezone.
ParseForLocale
Parse jalali date string as time for timezone.
New
Create new Jalali structure from time object. This function use system timezone.
NewTehran
Create new JalaliTehran structure from time object. This function use Asia/Tehran timezone.
NewKabul
Create new JalaliKabul structure from time object. This function use Asia/Kabul timezone.