CalendarDay: Method toCalendarDay
validates against Date
instead of CalendarDay
(IgxDatePicker disabledDates
not working)
#14938
Labels
Description
Attribute
disabledDates
ofigx-date-picker
doesn't work.Steps to reproduce
You may see the issue in this stackblitz example, steps:
disabledDates
configuration, however only 1 works.The stackblitz example I made, only illustrates the bug, not the use case. In my particular case, I ran into that issue because I have an application that shares information between IFRAMES.
Result
The
date
value received attoCalendarDate
is NOT an instance ofDate
, so the date value is never wrapped.Expected result
Maybe use
myDateVar.constructor.name
.Instead of validating dates against
Date
, validate it againstCalendarDay
(If already is an instance ofCalendarDay
, then do nothing, or else... do the wrapping).Cause
I've debugged this a lot, and the root cause is this line at your
CalendarDay
date wrapper:The issue is well documented when trying to use instanceof on multiple realms
I know this issue is particularly not commonly going to happen. However, I decided to post it... because, I consider a coding paradigm mistake to make validations against "what things not are", instead of "what they should be". There's plenty articles in the web as recommendations for the later statement, here's one from owasp, the general concept is to "use positive data validation".
Attachments
The text was updated successfully, but these errors were encountered: