nuxt-moment

Easy integration between Nuxt.js and Moment.js
5,981 15
Install
npm install nuxt-moment
Latest Version:1.0.5
License:MIT
Last Updated:Jul 18, 2023
Links: GitHub  ·  npm
Maintainer: kdydesign

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

Related Packages

nuxt-translation-manager

Simple and easy to use translation manager for nuxt and nuxt-i18n that allows to...

16,873 19
@traum-ferienwohnungen/nuxt-advanced-healthcheck

Module for adding healthcheck urls to a nuxt project

2,949 3
@nuxtjs/svg

Super simple svg loading module for Nuxt.js

848,162 342
nuxt-purgecss

Drop superfluous CSS! A neat PurgeCSS wrapper for Nuxt.js

522,398 496
@nuxt-alt/google-analytics

An alternative google analytics 4 module for nuxt3

934 2

Version History

Version Released License
1.0.5 MIT
1.0.4 MIT
1.0.1 MIT
1.0.0 MIT