Skip to content

Commit 5a8f7df

Browse files
authored
fix(material/timepicker): do not allow intervals less than a second (#33354)
Passing in a small value for the `interval` parameter in `generateOptions` can cause the page to freeze up.
1 parent 1a869b3 commit 5a8f7df

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/material/timepicker/util.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ export function generateOptions<D>(
8989
max: D,
9090
interval: number,
9191
): MatTimepickerOption<D>[] {
92+
// Avoid generating intervals less than a second, because it can freeze up the browser.
93+
interval = Math.max(interval, 1);
9294
const options: MatTimepickerOption<D>[] = [];
9395
let current = adapter.compareTime(min, max) < 1 ? min : max;
9496

0 commit comments

Comments
 (0)