{"version":3,"file":"formatUtils.cjs","names":["DialtoneLocalization"],"sources":["../../../components/datepicker/formatUtils.js"],"sourcesContent":["import { DialtoneLocalization } from '@/localization';\n\n/**\n * Formats a date into a long format using the specified locale.\n *\n * @param {Date} date - The date to format.\n * @param {string} [locale='default'] - The locale to use for formatting. Defaults to 'default'.\n * @returns {string} The formatted date string.\n */\nexport function formatLong (date, locale = null) {\n  return new Intl.DateTimeFormat(locale || DialtoneLocalization.getPreferredLocale(), { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }).format(date);\n}\n\n/**\n * Formats the given date in medium format.\n *\n * @param {Date} date - The date to be formatted.\n * @param {string} [locale='default'] - The locale to be used for formatting. Defaults to 'default'.\n * @returns {string} The formatted date string in medium format.\n */\nexport function formatMedium (date, locale = null) {\n  return new Intl.DateTimeFormat(locale || DialtoneLocalization.getPreferredLocale(), { year: 'numeric', month: 'long', day: 'numeric' }).format(date);\n}\n\n/**\n * Formats a date into a short string representation.\n * @param {Date} date - The date to format.\n * @param {string} [locale='default'] - The locale to use for formatting. Defaults to 'default'.\n * @param {boolean} [showWeekday=true] - Whether to include the weekday in the formatted string. Defaults to true.\n * @returns {string} The formatted date string.\n */\nexport function formatShort (date, locale = null, showWeekday = true) {\n  const options = showWeekday ? { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' } : { year: 'numeric', month: 'short', day: 'numeric' };\n  return new Intl.DateTimeFormat(locale || DialtoneLocalization.getPreferredLocale(), options).format(date);\n}\n\n/**\n * Formats a date without the year.\n *\n * @param {Date} date - The date to format.\n * @param {string} [locale='default'] - The locale to use for formatting. Defaults to 'default'.\n * @param {boolean} [abbreviated=false] - Whether to use abbreviated month names. Defaults to false.\n * @returns {string} The formatted date without the year.\n */\nexport function formatNoYear (date, locale = null, abbreviated = false) {\n  const monthFormat = abbreviated ? 'short' : 'long';\n  return new Intl.DateTimeFormat(locale || DialtoneLocalization.getPreferredLocale(), { month: monthFormat, day: 'numeric' }).format(date);\n}\n\n/**\n * Formats a date into a numerical string representation.\n *\n * @param {Date} date - The date to format.\n * @param {string} [locale='default'] - The locale to use for formatting. Defaults to 'default'.\n * @returns {string} The formatted numerical date string.\n */\nexport function formatNumerical (date, locale = null) {\n  return new Intl.DateTimeFormat(locale || DialtoneLocalization.getPreferredLocale(), { year: '2-digit', month: '2-digit', day: '2-digit' }).format(date);\n}\n\nexport default {\n  formatLong,\n  formatMedium,\n  formatShort,\n  formatNoYear,\n  formatNumerical,\n};\n"],"mappings":"+IASA,SAAgB,EAAY,EAAM,EAAS,KAAM,CAC/C,OAAO,IAAI,KAAK,eAAe,GAAUA,EAAAA,qBAAqB,oBAAoB,CAAE,CAAE,QAAS,OAAQ,KAAM,UAAW,MAAO,OAAQ,IAAK,UAAW,CAAC,CAAC,OAAO,EAAK,CAUvK,SAAgB,EAAc,EAAM,EAAS,KAAM,CACjD,OAAO,IAAI,KAAK,eAAe,GAAUA,EAAAA,qBAAqB,oBAAoB,CAAE,CAAE,KAAM,UAAW,MAAO,OAAQ,IAAK,UAAW,CAAC,CAAC,OAAO,EAAK,CAUtJ,SAAgB,EAAa,EAAM,EAAS,KAAM,EAAc,GAAM,CACpE,IAAM,EAAU,EAAc,CAAE,QAAS,QAAS,KAAM,UAAW,MAAO,QAAS,IAAK,UAAW,CAAG,CAAE,KAAM,UAAW,MAAO,QAAS,IAAK,UAAW,CACzJ,OAAO,IAAI,KAAK,eAAe,GAAUA,EAAAA,qBAAqB,oBAAoB,CAAE,EAAQ,CAAC,OAAO,EAAK,CAW3G,SAAgB,EAAc,EAAM,EAAS,KAAM,EAAc,GAAO,CACtE,IAAM,EAAc,EAAc,QAAU,OAC5C,OAAO,IAAI,KAAK,eAAe,GAAUA,EAAAA,qBAAqB,oBAAoB,CAAE,CAAE,MAAO,EAAa,IAAK,UAAW,CAAC,CAAC,OAAO,EAAK,CAU1I,SAAgB,EAAiB,EAAM,EAAS,KAAM,CACpD,OAAO,IAAI,KAAK,eAAe,GAAUA,EAAAA,qBAAqB,oBAAoB,CAAE,CAAE,KAAM,UAAW,MAAO,UAAW,IAAK,UAAW,CAAC,CAAC,OAAO,EAAK,CAGzJ,IAAA,EAAe,CACb,aACA,eACA,cACA,eACA,kBACD"}