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,