Skip to content
The best way for use Day.js easily in your Nuxt.js project.
TypeScript JavaScript Vue
Branch: master
Clone or download
potato4d Merge pull request #79 from potato4d/renovate/prettier-1.x
chore(deps): update dependency prettier to v1.19.1
Latest commit d068acd Nov 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
lib chore: Use require instead of import Oct 27, 2019
test
.all-contributorsrc
.gitignore
.npmignore
.prettierignore
.prettierrc
CHANGELOG.md
LICENSE
README.md
codecov.yml
jest.config.js
package.json
renovate.json
tsconfig.json
yarn.lock

README.md

nuxt-dayjs-module

code style: prettier donate: Patreon License: MIT NPM version All Contributors NPM downloads codecov

The best way for use Day.js easily in your Nuxt.js project.

Installation

$ yarn add nuxt-dayjs-module # or npm install

Usage

1. Register dayjs module to your Nuxt Application

export default {
  // ...
  modules: [
    'nuxt-dayjs-module'
  ],

  // Optional
  dayjs: {
    locales: ['en', 'ja'],
    defaultLocale: 'en'
  }
  // ...
}

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>

Development

$ git clone https://github.com/potato4d/nuxt-dayjs-module.git
$ cd nuxt-dayjs-module
$ yarn

License

MIT @potato4d

Note

This project generated by create-nuxt-module

Contributors

Thanks goes to these wonderful people (emoji key):

Takuma HANATANI(@potato4d)
Takuma HANATANI(@potato4d)

💻 🐛 📖 💡 💬 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

You can’t perform that action at this time.