Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ES6 import for consistency #84

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ $ npm install vue-moment
...and require the plugin like so:

```js
Vue.use(require('vue-moment'));
import VueMoment from 'vue-moment'

Vue.use(VueMoment)
```

## Usage
Expand Down Expand Up @@ -149,7 +151,7 @@ For more information about `moment#subtract`, check out <http://momentjs.com/doc
Convert the date to a certain timezone

```html
<span>{{ date | moment('timezone', 'America/Los_Angeles', 'LLLL ss')}}</span>
<span>{{ date | moment('timezone', 'America/Los_Angeles', 'LLLL ss') }}</span>
```

**To use this filter you will need to pass `moment-timezone` through to the plugin**
Expand Down Expand Up @@ -224,14 +226,15 @@ For manipulating a duration by either subtraction or addition, first use the rel
You can also pass a custom Moment object through with the plugin options. This technique is especially useful for overcoming the browserify locale bug demonstrated in the docs <http://momentjs.com/docs/#/use-it/browserify/>

```js
const moment = require('moment')
require('moment/locale/es')
import moment from 'moment'
import 'moment/locale/es'
import VueMoment from 'vue-moment'

Vue.use(require('vue-moment'), {
moment
Vue.use(VueMoment, {
moment,
})

console.log(Vue.moment().locale()) //es
console.log(Vue.moment().locale()) // es
```

## this.$moment
Expand All @@ -241,4 +244,3 @@ console.log(Vue.moment().locale()) //es
This allows you to call [the static methods momentjs provides](https://momentjs.com/docs/#/i18n/listing-months-weekdays/).

If you're using i18n, it allows you to change the locale globally by calling `this.$moment.locale(myNewLocale)`