Given a year and days elapsed in it , finds date by storing results in d and m .
function revoffsetDays ( offset , y ) { var month = [ 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] ; if ( isLeap ( y ) ) month [ 2 ] = 29 ; var i ; for ( i = 1 ; i <= 12 ; i ++ ) { if ( offset <= month [ i ] ) break ; offset = offset - month [ i ] ; } d2 = offset ; m2 = i ; }