Data urodzenia z numeru pesel

 function getBirthdayDateFromPesel(pesel, sign){
      pesel = pesel.split('');

      var year = 1900+parseInt(pesel[0])*10+parseInt(pesel[1]);

      if (pesel[2]>=2 && pesel[2]<8)
        year+=Math.floor(pesel[2]/2)*100;
      if (pesel[2]>=8)
        year-=100;

      var month = (pesel[2]%2)*10+pesel[3];
      var day = pesel[4]*10+pesel[5];

      return day+sign+month+sign+year;
}
Komentarze wyłączone