From d8dc9696149ee91ae5d39d58a42401a02ea721ca Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 28 Mar 2024 16:06:27 -0300 Subject: [PATCH] Fix date utils --- src/filters/date.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/filters/date.js b/src/filters/date.js index 2766d1381..206dc144c 100644 --- a/src/filters/date.js +++ b/src/filters/date.js @@ -26,11 +26,11 @@ export function isValidDate(date) { * // returns "02/12/2022" * toDateFormat(new Date(2022, 11, 2)); */ -export function toDateFormat(date) { +export function toDateFormat(date, locale = 'es-ES') { if (!isValidDate(date)) { return ''; } - return new Date(date).toLocaleDateString('es-ES', { + return new Date(date).toLocaleDateString(locale, { year: 'numeric', month: '2-digit', day: '2-digit', @@ -56,7 +56,7 @@ export function toTimeFormat(date, showSeconds = false) { if (!isValidDate(date)) { return ''; } - return new Date(date).toLocaleDateString('es-ES', { + return new Date(date).toLocaleTimeString('es-ES', { hour: '2-digit', minute: '2-digit', second: showSeconds ? '2-digit' : undefined,