fix(datetime): datetime locale with h23 will respect max time range (#24610)

Resolves #24588
This commit is contained in:
Sean Perkins
2022-01-20 12:47:06 -05:00
committed by GitHub
parent f295134624
commit 5925e7608e
3 changed files with 96 additions and 78 deletions

View File

@@ -219,7 +219,7 @@ export const generateTime = (
if (maxParts.hour !== undefined) {
processedHours = processedHours.filter(hour => {
const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
return convertedHour <= maxParts.hour!;
return (use24Hour ? hour : convertedHour) <= maxParts.hour!;
});
isPMAllowed = maxParts.hour >= 13;
}