GithubHelp home page GithubHelp logo

kdydesign / nuxt-moment-module Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 0.0 828 KB

Easy integration between nuxt.js and moment

License: MIT License

JavaScript 62.68% Vue 37.32%
nuxt nuxt-module mement nuxt-moment nuxtjs momentjs nuxt-moment-module vue vuejs

nuxt-moment-module's Introduction

Nuxt-Moment-Module

npm version npm downloads Circle CI Codecov 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

nuxt-moment-module's People

Contributors

dependabot[bot] avatar kdydesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nuxt-moment-module's Issues

Other time formats needed

I think you can add to readme.md some other formats like "LL" and "LTS". Because I need to use D/M/Y format and couldn't find it how.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.