material icon indicating copy to clipboard operation
material copied to clipboard

md-datepicker should have option to select year and month by default and date formatting.

Open shruti0207 opened this issue 10 years ago • 3 comments

Is there an option to open the datepicker directly to year/month instead of date view there doesn't appear to be an example of this in RC5, see uploaded image. And if user enters the date in number format (08052016) it gets formatted as (08/05/2016) and same entered date get selected on calendar.

Calendar View

calendra view

Date Format

date-format

shruti0207 avatar Aug 05 '16 08:08 shruti0207

It's not in 1.1-rc.5, but it's in master and it should be in 1.1 final. You can do:

<md-datepicker ng-model="myDate" md-current-view="year"></md-datepicker>

Regarding the date format, you'll have to override the parseDate and formatDate methods on the $mdDateLocaleProvider yourself.

crisbeto avatar Aug 05 '16 10:08 crisbeto

I try parseDate and formatDate methods on the $mdDateLocaleProvider but it format the date when date is selected from the calendar, if date enter using keyboard in number format (08052016) it not get formatted as (08/05/2016) IF make the change in mdDatelocalProvider than the date format change every where in application, just need to change the date format in some specific field only

shruti0207 avatar Aug 08 '16 07:08 shruti0207

check this: https://plnkr.co/edit/nJyHfu?p=preview

chavewain avatar Nov 30 '18 20:11 chavewain