fix: date local
This commit is contained in:
@@ -101,6 +101,29 @@ export const getDateOnly = (value) => {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
export const getDateToLocal = (value) => {
|
||||
if (!value) return 'Fecha inválida';
|
||||
const date = new Date(value);
|
||||
return date.toLocaleDateString('es-MX', {
|
||||
timeZone: 'America/Mexico_City',
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric'
|
||||
});
|
||||
};
|
||||
|
||||
export const getDateTimeFormat = (value, hour) => {
|
||||
|
||||
const year = value.substring(0, 4);
|
||||
const month = value.substring(5, 7);
|
||||
const day = value.substring(8, 10);
|
||||
|
||||
// Crear la cadena de fecha formateada
|
||||
const dateFormat = `${year}-${month}-${day} 0${hour}:00`;
|
||||
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
export const formatOnlyDate = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // Agregar cero si es necesario
|
||||
|
||||
Reference in New Issue
Block a user