The best way for use Day.js easily in your Nuxt.js project.
npm install @nuxtjs/dayjs






> The best way for use Day.js easily in your Nuxt.js project.
``bash`
$ yarn add @nuxtjs/dayjs # or npm install
`js
export default {
// ...
modules: [
'@nuxtjs/dayjs'
],
// Optional
dayjs: {
locales: ['en', 'ja'],
defaultLocale: 'en',
defaultTimeZone: 'Asia/Tokyo',
plugins: [
'utc', // import 'dayjs/plugin/utc'
'timezone' // import 'dayjs/plugin/timezone'
] // Your Day.js plugin
}
// ...
}
`
with Context
`html`
with Vue instance
`html`
Add the types to your "types" array in tsconfig.json after the @nuxt/types entry.
For dayjs plugins, add their relative types like dayjs/plugin/_pluginName_.
#### tsconfig.json
`json`
{
"compilerOptions": {
"types": [
"@nuxt/types",
"@nuxtjs/dayjs",
"dayjs/plugin/relativeTime",
]
}
}
`bash``
$ git clone https://github.com/nuxt-community/dayjs-module.git
$ cd @nuxtjs/dayjs
$ yarn
MIT @potato4d
This project generated by create-nuxt-module
Thanks goes to these wonderful people (emoji key):
![]() Takuma HANATANI(@potato4d) 💻 🐛 📖 💡 💬 👀 | Bryan Daniel Velastegui Lucero 💻 | Wei 💻 | かずえもん 📖 | Daiki Ojima 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!