From 772959ff81f9a1b89e6dfb85f6f75e1709341e18 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 2 Apr 2024 09:13:12 -0300 Subject: [PATCH] Improve getLocales code --- src/stores/useWeekdayStore.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/stores/useWeekdayStore.js b/src/stores/useWeekdayStore.js index 4fa9caed2..6cd8f1da6 100644 --- a/src/stores/useWeekdayStore.js +++ b/src/stores/useWeekdayStore.js @@ -43,12 +43,15 @@ export const useWeekdayStore = defineStore('weekdayStore', () => { const getLocales = computed(() => { // El día de mañana esto permitirá ordenar los weekdays en base a el locale si se lo desea reemplazando localeOrder.es por localeOrder[locale] const locales = []; + for (let code of localeOrder.es) { + const weekDay = weekdaysMap[code]; + const locale = t(`weekdays.${weekdaysMap[code].code}`); const obj = { - ...weekdaysMap[code], - locale: t(`weekdays.${weekdaysMap[code].code}`), - localeChar: t(`weekdays.${weekdaysMap[code].code}`).substr(0, 1), - localeAbr: t(`weekdays.${weekdaysMap[code].code}`).substr(0, 3), + ...weekDay, + locale, + localeChar: locale.substr(0, 1), + localeAbr: locale.substr(0, 3), }; locales.push(obj); }