From 9799336008ec156358a6ec572f7fecbff2f85f9a Mon Sep 17 00:00:00 2001 From: lemuel Date: Mon, 7 Mar 2022 12:57:54 -0600 Subject: [PATCH] mejora reporte, string vacia si fecha no existe --- server/controller/Prestamo/reporte.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/controller/Prestamo/reporte.js b/server/controller/Prestamo/reporte.js index fd97dc6..238db44 100644 --- a/server/controller/Prestamo/reporte.js +++ b/server/controller/Prestamo/reporte.js @@ -95,10 +95,18 @@ const reporte = async (body) => { fecha: moment(res[i].createdAt).format('YYYY-MM-DD'), hora: moment(res[i].createdAt).format('HH:mm'), horaMaxRecoger: moment(res[i].horaMaxRecoger).format('HH:mm'), - horaInicio: moment(res[i].horaInicio).format('HH:mm'), - horaFin: moment(res[i].horaFin).format('HH:mm'), - fechaEntrega: moment(res[i].horaEntrega).format('YYYY-MM-DD'), - horaEntrega: moment(res[i].horaEntrega).format('HH:mm'), + horaInicio: res[i].horaInicio + ? moment(res[i].horaInicio).format('HH:mm') + : '', + horaFin: res[i].horaFin + ? moment(res[i].horaFin).format('HH:mm') + : '', + fechaEntrega: res[i].horaEntrega + ? moment(res[i].horaEntrega).format('YYYY-MM-DD') + : '', + horaEntrega: res[i].horaEntrega + ? moment(res[i].horaEntrega).format('HH:mm') + : '', modulo: res[i].Equipo.Carrito.Modulo.modulo, carrito: res[i].Equipo.Carrito.carrito, equipo: res[i].Equipo.equipo,