From 2f3e74a64a3cdf37acf65ad6b3f0d28bc6d197ea Mon Sep 17 00:00:00 2001 From: Lemuel Marquez Date: Mon, 12 Apr 2021 13:20:38 -0500 Subject: [PATCH 1/4] fechas con moment en reportes --- server/controller/Servicio/gustavoBazPrada.js | 2 +- server/controller/Servicio/reporte.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/controller/Servicio/gustavoBazPrada.js b/server/controller/Servicio/gustavoBazPrada.js index bfd784b..437975a 100644 --- a/server/controller/Servicio/gustavoBazPrada.js +++ b/server/controller/Servicio/gustavoBazPrada.js @@ -29,7 +29,7 @@ const gustavoBazPrada = async (body) => { nombre: res[i].Usuario.nombre, licenciatura: res[i].Carrera.carrera, correo: res[i].correo, - fechaLiberacion: res[i].fechaLiberacion, + fechaLiberacion: moment(res[i].fechaLiberacion), }); try { fs.unlinkSync(path); diff --git a/server/controller/Servicio/reporte.js b/server/controller/Servicio/reporte.js index 79f3b22..637a395 100644 --- a/server/controller/Servicio/reporte.js +++ b/server/controller/Servicio/reporte.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const moment = require('moment'); const { convertArrayToCSV } = require('convert-array-to-csv'); const { Op } = require('sequelize'); const validar = require('../../helper/validar'); @@ -34,9 +35,9 @@ const reporte = async (body) => { nombre: res[i].Usuario.nombre, licenciatura: res[i].Carrera.carrera, correo: res[i].correo, - fehcaInicio: res[i].fechaInicio, - fechaFin: res[i].fechaFin, - fechaLiberacion: res[i].fechaLiberacion, + fechaInicio: moment(res[i].fechaInicio), + fechaFin: moment(res[i].fechaFin), + fechaLiberacion: moment(res[i].fechaLiberacion), institucion: res[i].Programa.institucion, dependencia: res[i].Programa.dependencia, programa: res[i].Programa.programa, From 6a3b1c036e2bd12ce3301c8452ce3c5220c9dd5e Mon Sep 17 00:00:00 2001 From: Lemuel Marquez Date: Mon, 12 Apr 2021 13:24:09 -0500 Subject: [PATCH 2/4] profesor --- server/controller/Servicio/reporte.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/controller/Servicio/reporte.js b/server/controller/Servicio/reporte.js index 637a395..d3168ee 100644 --- a/server/controller/Servicio/reporte.js +++ b/server/controller/Servicio/reporte.js @@ -41,6 +41,7 @@ const reporte = async (body) => { institucion: res[i].Programa.institucion, dependencia: res[i].Programa.dependencia, programa: res[i].Programa.programa, + profesor: res[i].profesor, clave: res[i].Programa.clavePrograma, status: res[i].Status.status, }); From 3038de9d4afec134890b8129b94f07ae57b4df11 Mon Sep 17 00:00:00 2001 From: Lemuel Marquez Date: Mon, 12 Apr 2021 13:37:50 -0500 Subject: [PATCH 3/4] funcion crear fecha con formato dd-mm-aaaa --- server/controller/Servicio/gustavoBazPrada.js | 2 +- server/controller/Servicio/reporte.js | 7 +++---- server/helper/validar.js | 10 ++++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/server/controller/Servicio/gustavoBazPrada.js b/server/controller/Servicio/gustavoBazPrada.js index 437975a..230fd1b 100644 --- a/server/controller/Servicio/gustavoBazPrada.js +++ b/server/controller/Servicio/gustavoBazPrada.js @@ -29,7 +29,7 @@ const gustavoBazPrada = async (body) => { nombre: res[i].Usuario.nombre, licenciatura: res[i].Carrera.carrera, correo: res[i].correo, - fechaLiberacion: moment(res[i].fechaLiberacion), + fechaLiberacion: validar.crearDDMMAAAA(res[i].fechaLiberacion), }); try { fs.unlinkSync(path); diff --git a/server/controller/Servicio/reporte.js b/server/controller/Servicio/reporte.js index d3168ee..23a93fc 100644 --- a/server/controller/Servicio/reporte.js +++ b/server/controller/Servicio/reporte.js @@ -1,5 +1,4 @@ const fs = require('fs'); -const moment = require('moment'); const { convertArrayToCSV } = require('convert-array-to-csv'); const { Op } = require('sequelize'); const validar = require('../../helper/validar'); @@ -35,9 +34,9 @@ const reporte = async (body) => { nombre: res[i].Usuario.nombre, licenciatura: res[i].Carrera.carrera, correo: res[i].correo, - fechaInicio: moment(res[i].fechaInicio), - fechaFin: moment(res[i].fechaFin), - fechaLiberacion: moment(res[i].fechaLiberacion), + fechaInicio: validar.crearDDMMAAAA(res[i].fechaInicio), + fechaFin: validar.crearDDMMAAAA(res[i].fechaFin), + fechaLiberacion: validar.crearDDMMAAAA(res[i].fechaLiberacion), institucion: res[i].Programa.institucion, dependencia: res[i].Programa.dependencia, programa: res[i].Programa.programa, diff --git a/server/helper/validar.js b/server/helper/validar.js index 18af260..22c5a32 100644 --- a/server/helper/validar.js +++ b/server/helper/validar.js @@ -149,6 +149,15 @@ const isObjectEmpty = (obj) => { return true; }; +const crearDDMMAAAA = (date) => { + const fechaMoment = moment(date); + let ddmmaaaa = ''; + + if (fechaMoment.isValid()) + ddmmaaaa = `${fechaMoment.date()}-${fechaMoment.month()}-${fechaMoment.year()}`; + return ddmmaaaa; +}; + module.exports = { validar, noValido, @@ -164,4 +173,5 @@ module.exports = { validarPreTermino, validarAccesibilidad, isObjectEmpty, + crearDDMMAAAA, }; From 6c3f657623ad63668599a4a75938ba9ea6fed353 Mon Sep 17 00:00:00 2001 From: Lemuel Marquez Date: Mon, 12 Apr 2021 14:17:09 -0500 Subject: [PATCH 4/4] funcion crear fecha con formato dd-mm-aaaa --- server/helper/validar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/helper/validar.js b/server/helper/validar.js index 22c5a32..bbe0708 100644 --- a/server/helper/validar.js +++ b/server/helper/validar.js @@ -154,7 +154,9 @@ const crearDDMMAAAA = (date) => { let ddmmaaaa = ''; if (fechaMoment.isValid()) - ddmmaaaa = `${fechaMoment.date()}-${fechaMoment.month()}-${fechaMoment.year()}`; + ddmmaaaa = `${fechaMoment.date()}/${ + fechaMoment.month() + 1 + }/${fechaMoment.year()}`; return ddmmaaaa; };