quasar-ui-qcalendar icon indicating copy to clipboard operation
quasar-ui-qcalendar copied to clipboard

fix(ui): use correct type definitions for createNativeLocaleFormatter…

Open ptoal opened this issue 1 year ago • 0 comments
trafficstars

This addresses typescript compiling errors when using the createNativeLocaleFormatter function per the examples in the documentation. The return type of this function is a function, not a string.

Tested this fix on my project, which uses the following snippets of code (taken from docs/src/examples/DayCustomHeader.vue):

<div style="width: 100%; font-size: 0.9em">
   {{ monthFormatter(day, true) }}
</div>
const  monthFormatter = monthFormatterFunc(),

function monthFormatterFunc() {
  const longOptions: Intl.DateTimeFormatOptions = {
    timeZone: 'UTC',
    month: 'long',
  };
  const shortOptions: Intl.DateTimeFormatOptions = {
    timeZone: 'UTC',
    month: 'short',
  };

  return createNativeLocaleFormatter(locale.value, (_tms, short) =>
    short ? shortOptions : longOptions
  );
}```
… (#439)

ptoal avatar May 11 '24 12:05 ptoal