Package Exports
- @nuxtjs/dayjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nuxtjs/dayjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@nuxtjs/dayjs
The best way for use Day.js easily in your Nuxt.js project.
Installation
$ yarn add @nuxtjs/dayjs # or npm installUsage
1. Register dayjs module to your Nuxt Application
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
}
// ...
}2. Use $dayjs on Context, Vue instance
with Context
<script>
export default {
asyncData({ $dayjs }) {
return {
now: $dayjs().format('YYYY/MM/DD')
}
}
}
</script>with Vue instance
<script>
export default {
data() {
return {
latestClicked: null
}
},
methods: {
handleClickButton() {
this.latestClicked = this.$dayjs().format('YYYY/MM/DD')
}
}
}
</script>For Typescript users
Add the types to your "types" array in tsconfig.json after the @nuxt/types entry.
tsconfig.json
{
"compilerOptions": {
"types": [
"@nuxt/types",
"@nuxtjs/dayjs"
]
}
}Development
$ git clone https://github.com/nuxt-community/dayjs-module.git
$ cd @nuxtjs/dayjs
$ yarnLicense
MIT @potato4d
Note
This project generated by create-nuxt-module
Contributors
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!
