function d2j(jdn) {
		var gy = d2g(jdn).year,
			jy = gy - 621,
			r = jalCal(jy),
			jdn1f = g2d(gy, 3, r.march),
			jd, jm, k;

		// Find number of days that passed since 1 Farvardin.
		k = jdn - jdn1f;
		if (k >= 0) {
			if (k <= 185) {
				// The first 6 months.
				jm = 1 + div(k, 31);
				jd = mod(k, 31) + 1;
				return {
					year: jy,
					month: jm - 1,
					day: jd
				};
			} else {
				// The remaining months.
				k -= 186;
			}
		} else {
			// Previous Jalaali year.
			jy -= 1;
			k += 179;
			if (r.leap === 1) {
				k += 1;
			}
		}
		jm = 7 + div(k, 30);
		jd = mod(k, 30) + 1;
		return {
			year: jy,
			month: jm - 1,
			day: jd
		};
	}
/*
		Converts the Julian Day number to a date in the Jalaali calendar.
		@param jdn Julian Day number
		@return
			jy: Jalaali year (1 to 3100)
			jm: Jalaali month (1 to 12)
			jd: Jalaali day (1 to 29/31)
	*/
Converts the Julian Day number to a date in the Jalaali calendar.
Converts the Julian Day number to a date in the Jalaali calendar .
function d2j(jdn) {
		var gy = d2g(jdn).year,
			jy = gy - 621,
			r = jalCal(jy),
			jdn1f = g2d(gy, 3, r.march),
			jd, jm, k;
		k = jdn - jdn1f;
		if (k >= 0) {
			if (k <= 185) {
				jm = 1 + div(k, 31);
				jd = mod(k, 31) + 1;
				return {
					year: jy,
					month: jm - 1,
					day: jd
				};
			} else {
				k -= 186;
			}
		} else {
			jy -= 1;
			k += 179;
			if (r.leap === 1) {
				k += 1;
			}
		}
		jm = 7 + div(k, 30);
		jd = mod(k, 30) + 1;
		return {
			year: jy,
			month: jm - 1,
			day: jd
		};
	}
function d2j ( jdn ) { var gy = d2g ( jdn ) . year , jy = gy - 621 , r = jalCal ( jy ) , jdn1f = g2d ( gy , 3 , r . march ) , jd , jm , k ; k = jdn - jdn1f ; if ( k >= 0 ) { if ( k <= 185 ) { jm = 1 + div ( k , 31 ) ; jd = mod ( k , 31 ) + 1 ; return { year : jy , month : jm - 1 , day : jd } ; } else { k -= 186 ; } } else { jy -= 1 ; k += 179 ; if ( r . leap === 1 ) { k += 1 ; } } jm = 7 + div ( k , 30 ) ; jd = mod ( k , 30 ) + 1 ; return { year : jy , month : jm - 1 , day : jd } ; }
Converts the Julian Day number to a date in the Jalaali calendar.
Converts the Julian Day number to a date in the Jalaali calendar .
// Find number of days that passed since 1 Farvardin. // The first 6 months. // The remaining months. // Previous Jalaali year.