material icon indicating copy to clipboard operation
material copied to clipboard

datepicker: filter only affects validation in month mode

Open AndriSig opened this issue 8 years ago • 6 comments

Bug, enhancement request, or proposal:

Bug or enhancement i suppose.

CodePen and steps to reproduce the issue:

CodePen Demo which demonstrates the issue:

Detailed Reproduction Steps:

  1. Make a datepicker
  2. Set it to month mode
  3. Try to filter it.

What is the expected behavior?

Filtered months become disabled

What is the current behavior?

Filtered months just register as error states when selected

What is the use-case or motivation for changing an existing behavior?

You have a sparse dataset of dates you want your users to select from.

Them needing to use trial and error to figure out which months are selectable by trying every one makes this feature useless for any case where not every single month is selectable.

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: I've tried it on 1.5.11 and the one you guys are running on your demos.
  • AngularJS Material: 1.1.^6
  • OS: Any i'd guess
  • Browsers: At least chrome

Is there anything else we should know? Stack Traces, Screenshots, etc.

AndriSig avatar Nov 26 '18 17:11 AndriSig

This use case makes a lot of sense and this is clearly a behavior that we should support. It looks like the year view (month mode) doesn't currently account for md-date-filter at all.

Splaktar avatar Nov 27 '18 04:11 Splaktar

I updated the CodePen to remove some unused datepicker elements.

PR https://github.com/angular/material/pull/11526 opened to add this functionality.

Splaktar avatar Nov 27 '18 05:11 Splaktar

Oh yea sorry for the crap codepen, i was grumpy after a long day.

Glad you're implementing this, it will be nice to be able to remove my jquery hack to apply this.

AndriSig avatar Nov 27 '18 10:11 AndriSig

This fix has created another issue where at the "year" current view, months that start on days that don't pass validation are not clickable. For example, in the Datepicker demo where only weekends are selectable (https://material.angularjs.org/latest/demo/datepicker) if you go back to the "year" view, only months that start with a weekend are selectable.

weekends

schliffer avatar Apr 05 '19 22:04 schliffer

yes i am also facing same issue @schliffer how did you fixed it. PLease share

texperts avatar Jun 06 '19 19:06 texperts

@texperts it's being tracked in https://github.com/angular/material/issues/11703.

Splaktar avatar Jun 22 '19 07:06 Splaktar