Skip to content

Commit 58ca2f9

Browse files
committed
feat(MPI-465): "Ajuste en formato de fecha de nacimiento"
1 parent 329841b commit 58ca2f9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/cda/routes/cda.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ router.post('/', async (req: any, res, next) => {
108108
}
109109

110110
cdaData.fecha = moment(cdaData.fecha, 'YYYYMMDDhhmmss').toDate();
111+
const fechaLocal = moment(cdaData.paciente.fechaNacimiento, 'YYYYMMDDhhmmss');
112+
if (fechaLocal.isValid()) {
113+
cdaData.paciente.fechaNacimiento = moment.utc({
114+
year: fechaLocal.year(),
115+
month: fechaLocal.month(),
116+
date: fechaLocal.date()
117+
}).toDate();
118+
}
119+
111120
cdaData.paciente.fechaNacimiento = moment(cdaData.paciente.fechaNacimiento, 'YYYYMMDDhhmmss');
112121
cdaData.paciente.sexo = cdaData.paciente.sexo === 'M' ? 'masculino' : 'femenino';
113122

0 commit comments

Comments
 (0)