cnp-decoder
Version:
A function that decodes a romanian CNP and returns a object containing informations about the person it belongs to
33 lines (32 loc) • 747 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBirthMonth = void 0;
const getBirthMonth = (cnp) => {
switch (cnp.slice(3, 5)) {
case '01':
return 0;
case '02':
return 1;
case '03':
return 2;
case '04':
return 3;
case '05':
return 4;
case '06':
return 5;
case '07':
return 6;
case '08':
return 7;
case '09':
return 8;
case '10':
return 9;
case '11':
return 10;
case '12':
return 11;
}
};
exports.getBirthMonth = getBirthMonth;