pikaday.js
/*
  Calculates Gregorian and Julian calendar dates from the Julian Day number
  (jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both
  calendars) to some millions years ahead of the present.
  @param jdn Julian Day number
  @return
    gy: Calendar year (years BC numbered 0, -1, -2, ...)
    gm: Calendar month (1 to 12)
    gd: Calendar day of the month M (1 to 28/29/30/31)
*/
Calculates Gregorian and Julian calendar dates from the Julian Day number
(jdn) for the period since jdn=-34839655  to some millions years ahead of the present.
Calculates Gregorian and Julian calendar dates from the Julian Day number ( jdn ) for the period since jdn = - 34839655 to some millions years ahead of the present .
function d2g(jdn) {
    var j
        , i
        , gd
        , gm
        , gy
    j = 4 * jdn + 139361631
    j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908
    i = div(mod(j, 1461), 4) * 5 + 308
    gd = div(mod(i, 153), 5) + 1
    gm = mod(div(i, 153), 12) + 1
    gy = div(j, 1461) - 100100 + div(8 - gm, 6)
    return {
        gy: gy
        , gm: gm
        , gd: gd
    }
}
function d2g ( jdn ) { var j , i , gd , gm , gy j = 4 * jdn + 139361631 j = j + div ( div ( 4 * jdn + 183187720 , 146097 ) * 3 , 4 ) * 4 - 3908 i = div ( mod ( j , 1461 ) , 4 ) * 5 + 308 gd = div ( mod ( i , 153 ) , 5 ) + 1 gm = mod ( div ( i , 153 ) , 12 ) + 1 gy = div ( j , 1461 ) - 100100 + div ( 8 - gm , 6 ) return { gy : gy , gm : gm , gd : gd } }
Calculates Gregorian and Julian calendar dates from the Julian Day number
(jdn) for the period since jdn=-34839655 (i.e.
Calculates Gregorian and Julian calendar dates from the Julian Day number ( jdn ) for the period since jdn = - 34839655 ( i . e .