Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

ptoal
Copy link

@ptoal ptoal commented May 11, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant