ashishgkwd / ngx-mat-daterange-picker

Date range picker component based of Angular Material Calendar component and configurable date presets. Packaged using ng-packagr.
https://multi-ngx-mat-daterange-picker-example.stackblitz.io
33 stars 34 forks source link

Disable toDate by fromDate selection #17

Open xzegga opened 5 years ago

xzegga commented 5 years ago

Is there a possibility to disable all dates before fromDate selection to avoid selecting dates before the first date selected?

playnox commented 5 years ago

+1 Same issue, how to make toDate calendar switch month and disable dates before selected fromDate ???

amitsadafule commented 5 years ago

+1 same issue

rubenCodeforges commented 5 years ago

@xzegga @playnox @amitsadafule Guys i guess this you can use the :

 fromMinMax?: Range;
 toMinMax?: Range;

for example you can set FromDate to start from whenever you want (min) but not more then today (max) and visa verse.

see the configs

jimlitton commented 5 years ago

I did a fork to work on a fix for a requirement on a project for toDate/fromDate enforcement. The priority has slipped somewhat so there isn't a timeline on PR . . . I'm a relatively new Angular developer too.

WernerCD commented 5 years ago

There are two possibilities... either, as @rubenCodeforges says - you can set a min and max in the presets to do hard limits...

Or...

as I am looking for - and I think this question is about? - given those "hard" limits... how do you say that when a user clicks on a date... the dates on the other calendar get disabled?

So, if I have a limit of "this month" for selectable dates... June 1st through June 31st.

If someone selects Jun 7th on the FROM portion... the dates on the TO portion get disabled 1st through the 6th...

OR

If you switch the numbers... when you click "submit" they swap accordingly. So if I select Jun 8th through June 5th, they appear on the selection as June5-June8.

I think this question is confusing as the first (default hard limits) are configurable... but the "dynamic" disabling based on choices doesn't seem available.