funcion crear fecha con formato dd-mm-aaaa
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user