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

How to use the filter? #154

Open
gooqiao opened this issue Sep 25, 2018 · 2 comments
Open

How to use the filter? #154

gooqiao opened this issue Sep 25, 2018 · 2 comments

Comments

@gooqiao
Copy link

gooqiao commented Sep 25, 2018

<div >
  {'2016-05-03' | customDateFilter("YYYY-MM-DD")}
</div>

customDateFilter is a filter,When I do, he does not work.

Is there any other way?

@Shinigami92
Copy link

The only way I know is to rewrite it to something like this:

import customDateFilter from './customDateFilter'
// ...
<div >
  { customDateFilter('2016-05-03', 'YYYY-MM-DD') }
</div>

or with moment.js

import moment from 'moment'
// ...
const date // maybe can be undefined?!
<div >
  { date ? moment(date).format('YYYY-MM-DD') : '' }
</div>

@guohuihot
Copy link

this.$options.filters.customDateFilter('2016-05-03)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants