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

markDisabled does not trigger invalid state #3182

Open
rafaelucena opened this issue May 8, 2019 · 8 comments
Open

markDisabled does not trigger invalid state #3182

rafaelucena opened this issue May 8, 2019 · 8 comments

Comments

@rafaelucena
Copy link

rafaelucena commented May 8, 2019

Bug description:

Using markDisabled, we set the date on the calendar to not be clickable, but it does not prevent the user to type the date by hand.
But, when using minDate or maxDate, everything works as expected.

The state returned when setting a date out of the range is invalid, as using, for example, day 31 of February.

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-4mylnm

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 7

ng-bootstrap: 4.1.2

@peterblazejewicz
Copy link
Contributor

Only the isValid date and within min/max range conditions are tested. The markDisabled is for navigation purposes only (as per docs).
See this PR for upcoming changes to plug your logic from markDisabled into validation:
#3126

@rafaelucena
Copy link
Author

rafaelucena commented May 9, 2019

Well, even if for navigation only... I wouldn't think that there is much use in disabling one date to have the user type it anyway. Which then implies the usability of the input is confusing.

Someone might just use that to, for example, prevent someone from making appointments during national holidays. If the user would type it, instead of clicking, then it would simply bypass the rule.

Thank you for the link though. :)

@rafaelucena
Copy link
Author

@benouat, I would like to ask for a revision of this situation.

Can this be considered a bug?

@benouat
Copy link
Member

benouat commented Aug 12, 2019

@rafaelucena I agree that something is not right here. I am still not convinced that we should flag it as bug...

A bug is a faulty behaviour of an existing feature. Here the feature to properly disabled some dates (independently of the current displayed month, and not as only visually, for current month, which markDisabled is doing) is not there at all.

Let me discuss it internally before moving on.

@rafaelucena
Copy link
Author

@benouat, I understand.

Though I would like you to consider this also from the perspective of the usage of it.
Considering that the date might be disabled for whatever reason, it shouldn't make sense that setting that date by hand would be considered valid.

That would then force the developer to create a second validation internally to check if the date is disabled.

But, still, please let me know how the discussion went. Thank you :)

@danielczestki
Copy link

danielczestki commented Dec 30, 2019

@rafaelucena Mayby You could fix it by your own in just four easy steps:

  1. fork
  2. commit
  3. push
  4. merge request

;)

@danielczestki
Copy link

The markDisabled is for navigation purposes only (as per docs).
#3126

Then this should not be called markDisabled. Intuition tells you that this method do something different

@maxokorokov
Copy link
Member

maxokorokov commented Jan 15, 2021

Also see potentially related #3126, #3215, #1325

I haven't noticed this issue before, but I see no difference between say minDate used for both navigation and validation and markDisabled. I think it should be used for both, otherwise what's the point of marking dates as disabled ?

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

No branches or pull requests

5 participants