728x90
설치
npm i nuxt-dayjs
nuxt.config.ts
export default defineNuxtConfig({
modules: [
'dayjs-nuxt'
]
})
composables
useDayjs composable로 dayjs를 사용할 수 있다.
const dayjs = useDayjs()
dayjs.locale('fr')
configuration
dayjs 기본 설정
export default defineNuxtConfig({
modules: ['dayjs-nuxt'],
dayjs: {
locales: ['ko', 'en'],
plugins: ['timezone'],
defaultLocale: 'ko',
defaultTimezone: 'Asia/Seoul',
},
})
주의할 점
반드시 플러그인에 timezone을 추가해주자
dayjs 라이브러리를 date picker 컴포넌트를 만드는 데 사용했는데, 그 내용은 다음 글에 작성해보겠다.
728x90
'Vue > Nuxt' 카테고리의 다른 글
[ Nuxt ] 일부 페이지에는 Layout 적용 하지 않기 (0) | 2024.12.19 |
---|---|
[ Nuxt ] layout 사용법 (0) | 2024.11.18 |
[ Nuxt ] nuxt/icon 사용하기 (iconify | 로컬 데이터셋) (0) | 2024.11.11 |
[ Nuxt, Tailwind ] custom color 적용 안 되는 이슈 (0) | 2024.11.09 |
[ Nuxt, Tailwind ] custom color 적용 (0) | 2024.11.08 |