Skip to content
Easy integration between nuxt.js and moment
JavaScript Vue
Branch: master
Clone or download
Latest commit 1ae862b Jan 2, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
lib test: update jest Dec 31, 2019
test
.editorconfig test: add test resource Dec 31, 2019
.eslintignore
.eslintrc.js
.gitignore chore: update ignore Dec 30, 2019
CHANGELOG.md chore(release): 1.0.4 Dec 31, 2019
LICENSE
README.md chore: update README Jan 2, 2020
babel.config.js
commitlint.config.js test: add test resource Dec 31, 2019
husky.config.js test: add test resource Dec 31, 2019
jest.config.js
package.json
renovate.json
yarn.lock test: add yarn.lock Dec 31, 2019

README.md

Nuxt-Moment-Module

npm version npm downloads Circle CI Codecov Dependencies Standard JS License

Easy integration between Nuxt.js and Moment.js

Infos

Install

Install with npm:

npm i nuxt-moment

nuxt.config.js:

module.exports = {
  modules: [
    // Simple usage
    'nuxt-moment'
  ]
}

Usage

Component

export default {
  data () {
    return {
      date: this.$moment().format('LTS')
    }
  },
  computed: {
    computedDate () {
      return this.$moment(new Date).format('LL')
    }
  },
  methods: {
    getDate () {
      return this.$moment()
    }
  }
}

Plugin

export default function({ $moment }) {
  console.log($moment().format('LTS'))
}

Store

export const state = () => ({
  date: new Date()
})

export const mutations = {
  MUTATION (state) {
    state.date = this.$moment().day(10)
  }
}

export const actions = {
  action ({state, commit}) {
    commit('SAMPLE_MUTATIONS', this.$moment().day(5))
  }
}

License

MIT License

Copyright (c) Dev.DY

You can’t perform that action at this time.