nm
nuxt-moment
npm i nuxt-moment
nm

nuxt-moment

Easy integration between nuxt.js and moment

by Dev.DY

1.0.5 (see all)License:MITTypeScript:Not Found
npm i nuxt-moment
Readme

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

Downloads/wk

842

GitHub Stars

15

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

14
VersionTagPublished
1.0.5
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial