@rollin
To set up Moment.js in a Vuetify project, you can follow these steps:
1
|
npm install moment vue-moment |
1 2 3 4 5 |
import Vue from 'vue' import moment from 'moment' import VueMoment from 'vue-moment' Vue.use(VueMoment, { moment }) |
You can now use Moment.js in your Vue components by importing it and using it as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<template> <div> <p>{{ formatedDate }}</p> </div> </template> <script> import moment from 'moment' export default { data() { return { date: '2022-01-01T12:00:00Z' } }, computed: { formatedDate() { return moment(this.date).format('MMMM Do YYYY, h:mm:ss a') } } } </script> |
Now, Moment.js is set up in your Vuetify project and you can use it for date formatting, parsing, and manipulating in your Vue components.