fixes: vehicles & proposals

This commit is contained in:
Alexandro Uc Santos
2024-08-07 20:54:39 -06:00
parent 75af1a9bf4
commit 59f2b20890
12 changed files with 162 additions and 91 deletions

View File

@@ -59,6 +59,7 @@ export const getDateMonthDay = (value) => {
export const getDateMonthDayEs = (value, isFull = false) => {
const date = new Date(value)
// date.setHours(date.getHours());
let month = '';
if(isFull) {
month = months[date.getMonth()];
@@ -75,10 +76,10 @@ export const getDateTime = (value, hour) => {
// Obtener los componentes de la fecha
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2); // Agrega cero al principio si es necesario
const day = ('0' + date.getDate()).slice(-2); // Agrega cero al principio si es necesario
const hours = ('0' + date.getHours()).slice(-2); // Agrega cero al principio si es necesario
const minutes = ('0' + date.getMinutes()).slice(-2); // Agrega cero al principio si es necesario
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
const hours = ('0' + date.getHours()).slice(-2);
const minutes = ('0' + date.getMinutes()).slice(-2);
// Crear la cadena de fecha formateada
const dateFormat = `${year}-${month}-${day} ${hours}:${minutes}`;
@@ -86,6 +87,21 @@ export const getDateTime = (value, hour) => {
return dateFormat;
}
export const getDateOnly = (value) => {
const date = new Date(value);
date.setHours(date.getHours());
// Obtener los componentes de la fecha
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
const dateFormat = `${day}/${month}/${year}`;
return dateFormat;
}
export const formatOnlyDate = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // Agregar cero si es necesario