fix(datetime): minutes only filtered when max hour matches current hour (#24710)

Resolves #24702
This commit is contained in:
Sean Perkins
2022-02-04 11:40:02 -05:00
committed by GitHub
parent aab4d306f8
commit 231d6df622
2 changed files with 51 additions and 2 deletions

View File

@@ -223,7 +223,11 @@ export const generateTime = (
});
isPMAllowed = maxParts.hour >= 13;
}
if (maxParts.minute !== undefined) {
if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
// The available minutes should only be filtered when the hour is the same as the max hour.
// For example if the max hour is 10:30 and the current hour is 10:00,
// users should be able to select 00-30 minutes.
// If the current hour is 09:00, users should be able to select 00-60 minutes.
processedMinutes = processedMinutes.filter(minute => minute <= maxParts.minute!);
}