{"version":3,"file":"DateStore-CAFh2fXU.js","sources":["../../Vue/src/stores/DateStore.ts"],"sourcesContent":["export const useDateStore = defineStore(\"date\", () => {\r\n const translate = useTranslationStore();\r\n\r\n function dateObjToFormattedDate(date: Date, full?: boolean) {\r\n const monthFormat = full ? \"long\" : \"short\";\r\n try {\r\n const month = new Intl.DateTimeFormat(\r\n [translate.currentLanguageCode, \"en-US\"],\r\n {\r\n month: monthFormat,\r\n },\r\n ).format(date);\r\n const day = new Intl.DateTimeFormat(\r\n [translate.currentLanguageCode, \"en-US\"],\r\n {\r\n day: \"numeric\",\r\n },\r\n ).format(date);\r\n const year = new Intl.DateTimeFormat(\r\n [translate.currentLanguageCode, \"en-US\"],\r\n {\r\n year: \"numeric\",\r\n },\r\n ).format(date);\r\n\r\n if (full) {\r\n const dayOfWeek = new Intl.DateTimeFormat(\r\n [translate.currentLanguageCode, \"en-US\"],\r\n {\r\n weekday: \"long\",\r\n },\r\n ).format(date);\r\n return `${dayOfWeek} - ${day} ${month} ${year}`;\r\n } else {\r\n return `${day} ${month} ${year}`;\r\n }\r\n } catch (err) {\r\n const month = new Intl.DateTimeFormat(\"en-US\", {\r\n month: monthFormat,\r\n }).format(date);\r\n const day = new Intl.DateTimeFormat(\"en-US\", {\r\n day: \"numeric\",\r\n }).format(date);\r\n const year = new Intl.DateTimeFormat(\"en-US\", {\r\n year: \"numeric\",\r\n }).format(date);\r\n if (full) {\r\n const dayOfWeek = new Intl.DateTimeFormat(\"en-US\", {\r\n weekday: \"long\",\r\n }).format(date);\r\n return `${dayOfWeek} - ${day} ${month} ${year}`;\r\n } else {\r\n return `${day} ${month} ${year}`;\r\n }\r\n }\r\n }\r\n\r\n function formatDate(date: string, full?: boolean) {\r\n if (!date) {\r\n return \"\";\r\n }\r\n const [y, m, d] = date.split(\"-\").map((i) => parseInt(i));\r\n const dateobj = new Date(y, m - 1, d);\r\n return dateObjToFormattedDate(dateobj, full);\r\n }\r\n\r\n function formatSlashedDate(date: string) {\r\n const [m, d, y] = date.split(\"/\").map((i) => parseInt(i));\r\n const dateobj = new Date(y, m - 1, d);\r\n return dateObjToFormattedDate(dateobj);\r\n }\r\n\r\n function getShortMonth(date: string) {\r\n return new Intl.DateTimeFormat([translate.currentLanguageCode, \"en-US\"], {\r\n month: \"short\",\r\n }).format(new Date(date + \"T00:00:00\"));\r\n }\r\n\r\n function getFullMonth(date: string) {\r\n return new Intl.DateTimeFormat([translate.currentLanguageCode, \"en-US\"], {\r\n month: \"long\",\r\n }).format(new Date(date + \"T00:00:00\"));\r\n }\r\n\r\n return {\r\n dateObjToFormattedDate,\r\n formatDate,\r\n formatSlashedDate,\r\n getShortMonth,\r\n getFullMonth,\r\n };\r\n});\r\n"],"names":["useDateStore","defineStore","translate","useTranslationStore","dateObjToFormattedDate","date","full","monthFormat","month","day","year","dayOfWeek","err","formatDate","y","m","d","i","dateobj","formatSlashedDate","getShortMonth","getFullMonth"],"mappings":"iFAAa,MAAAA,EAAeC,EAAY,OAAQ,IAAM,CACpD,MAAMC,EAAYC,IAET,SAAAC,EAAuBC,EAAYC,EAAgB,CACpD,MAAAC,EAAcD,EAAO,OAAS,QAChC,GAAA,CACI,MAAAE,EAAQ,IAAI,KAAK,eACrB,CAACN,EAAU,oBAAqB,OAAO,EACvC,CACE,MAAOK,CACT,CAAA,EACA,OAAOF,CAAI,EACPI,EAAM,IAAI,KAAK,eACnB,CAACP,EAAU,oBAAqB,OAAO,EACvC,CACE,IAAK,SACP,CAAA,EACA,OAAOG,CAAI,EACPK,EAAO,IAAI,KAAK,eACpB,CAACR,EAAU,oBAAqB,OAAO,EACvC,CACE,KAAM,SACR,CAAA,EACA,OAAOG,CAAI,EAEb,GAAIC,EAAM,CACF,MAAAK,EAAY,IAAI,KAAK,eACzB,CAACT,EAAU,oBAAqB,OAAO,EACvC,CACE,QAAS,MACX,CAAA,EACA,OAAOG,CAAI,EACb,MAAO,GAAG,OAAAM,EAAS,OAAM,OAAAF,EAAG,KAAI,OAAAD,EAAK,K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