fix(datetime): ionChange is no longer called for out of range dates (#23940)

resolves #23939
This commit is contained in:
Liam DeBeasi
2021-09-16 10:44:20 -04:00
committed by GitHub
parent 23994e211a
commit ea39c6e5b3
2 changed files with 20 additions and 3 deletions

View File

@ -1091,6 +1091,17 @@ export class Datetime implements ComponentInterface {
const activeElement = this.el!.shadowRoot!.elementFromPoint(x, y)!;
const value = parseInt(activeElement.getAttribute('data-value')!, 10);
/**
* When scrolling to a month that is out of
* bounds, the hour/minute column values may
* be updated, triggering a scroll callback.
* Check to make sure there is a valid
* hour/minute element so we do not emit NaN.
*/
if (Number.isNaN(value)) {
return;
}
if (colType === 'hour') {
this.setWorkingParts({
...this.workingParts,