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: formats type error #61

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

Conversation

hirotaka
Copy link

@hirotaka hirotaka commented Nov 25, 2024

I added the following configuration to nuxt.config.ts in my Nuxt project.

export default defineNuxtConfig({
  ...
  dayjs: {
    locales: ['ja'],
    plugins: ['relativeTime', 'utc', 'timezone', 'localizedFormat'],
    defaultTimezone: 'Asia/Tokyo',
    defaultLocale: [
      'ja',
      {
        formats: {
          LT: 'HH:mm',
          LTS: 'HH:mm:ss',
          L: 'YYYY/MM/DD',
          LL: 'YYYY年M月D日',
          LLL: 'YYYY年M月D日 HH:mm',
          LLLL: 'YYYY年M月D日 dddd HH:mm',
          l: 'YYYY/MM/DD',
          ll: 'YYYY年M月D日',
          lll: 'YYYY年M月D日 HH:mm',
          llll: 'YYYY年M月D日(ddd) HH:mm',
        },
      },
    ],
  },
})

The following type error occurs:

Object literal may only specify known properties, but 'l' does not exist in type 'FormatOptions'. Did you mean to write 'L'? [2561]

I have added an option for the types of settings that can be specified.

https://day.js.org/docs/en/display/format#list-of-localized-formats

@hirotaka hirotaka marked this pull request as ready for review November 25, 2024 05:41
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.

1 participant