func (h HijriDate) ToGregorian() time.Time {
	// Calculate the passed days from the passed hijri years
	passedYear := h.Year - 1
	nCycles := passedYear / 30
	leftoverYears := passedYear % 30
	passedDays := nCycles*10631 + leftoverYears*354

	// Consider leap years to the count of passed days
	for year := int64(1); year <= leftoverYears; year++ {
		if isLeapYear(year, h.Pattern) {
			passedDays++
		}
	}

	// Increase the passed days from the passed hijri months
	passedMonths := h.Month - 1
	for month := int64(1); month <= passedMonths; month++ {
		passedDays += 29 + month%2
	}

	// Increase passed days using current hijri day
	passedDays += h.Day

	// Calculate Julian Days since Hijri epoch
	jd := 1948438.5 + float64(passedDays)
	return juliandays.ToTime(jd)
}
// ToGregorian convert Hijri date to Gregorian date using Golang standard time.
ToGregorian convert Hijri date to Gregorian date using Golang standard time.
// ToGregorian convert Hijri date to Gregorian date using Golang standard time .
func (h HijriDate) ToGregorian() time.Time {
	passedYear := h.Year - 1
	nCycles := passedYear / 30
	leftoverYears := passedYear % 30
	passedDays := nCycles*10631 + leftoverYears*354
	for year := int64(1); year <= leftoverYears; year++ {
		if isLeapYear(year, h.Pattern) {
			passedDays++
		}
	}
	passedMonths := h.Month - 1
	for month := int64(1); month <= passedMonths; month++ {
		passedDays += 29 + month%2
	}
	passedDays += h.Day
	jd := 1948438.5 + float64(passedDays)
	return juliandays.ToTime(jd)
}
func ( h HijriDate ) ToGregorian ( ) time . Time { passedYear := h . Year - 1 nCycles := passedYear / 30 leftoverYears := passedYear % 30 passedDays := nCycles * 10631 + leftoverYears * 354 for year := int64 ( 1 ) ; year <= leftoverYears ; year ++ { if isLeapYear ( year , h . Pattern ) { passedDays ++ } } passedMonths := h . Month - 1 for month := int64 ( 1 ) ; month <= passedMonths ; month ++ { passedDays += 29 + month % 2 } passedDays += h . Day jd := 1948438.5 + float64 ( passedDays ) return juliandays . ToTime ( jd ) }
ToGregorian convert Hijri date to Gregorian date using Golang standard time.
ToGregorian convert Hijri date to Gregorian date using Golang standard time .
// Calculate the passed days from the passed hijri years // Consider leap years to the count of passed days // Increase the passed days from the passed hijri months // Increase passed days using current hijri day // Calculate Julian Days since Hijri epoch