pikaday.js
/*
  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).gy 
        , 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 {
                jy: jy
                , jm: jm
                , jd: 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 {
        jy: jy
        , jm: jm
        , jd: jd
    }
}
function d2j ( jdn ) { var gy = d2g ( jdn ) . gy , 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 { jy : jy , jm : jm , jd : 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 { jy : jy , jm : jm , jd : 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 .
// Calculate Gregorian year (gy). // Find number of days that passed since 1 Farvardin. // The first 6 months. // The remaining months. // Previous Jalaali year.