TheNone
TheNone

Reputation: 5802

Angular Material Date Picker Filter

I have formatted my angular material date picker like below:

$mdDateLocaleProvider.formatDate = function(date) {
        return moment(date).format('YYYY-MM-DD');
    };

But when I want to use date picker as filter, it's not working:

<md-datepicker ng-model="search.date""></md-datepicker>

with <input ng-model="search.date"> date filter working.

How could I make angular material date picker working with filter?

Edit : datepicker output is : Tue Jun 21 2016 00:00:00 GMT+0300 (EEST), but I want 2016-06-21

Upvotes: 1

Views: 2550

Answers (1)

LearnForever
LearnForever

Reputation: 175

You have 2 double quotes in there.

<md-datepicker ng-model="search.date""></md-datepicker>

Here is working code.

$mdDateLocaleProvider.formatDate = function(date) {
        return moment(date).format('YYYY-MM-DD');
    };
})

Upvotes: 1

Related Questions