Skip to content

Commit dfd1f00

Browse files
author
Nathan Reyes
committed
Add non-matching minute values
1 parent 6279ba2 commit dfd1f00

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/components/TimePicker.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,23 @@ export default {
122122
minuteOptions() {
123123
const options = [];
124124
let m = 0;
125+
let added = false;
125126
while (m <= 59) {
126127
options.push({
127128
value: m,
128129
label: pad(m, 2),
129130
});
131+
added = added || m === this.minutes;
130132
m += this.minuteIncrement;
133+
// Add disabled option if interval has skipped it
134+
if (!added && m > this.minutes) {
135+
added = true;
136+
options.push({
137+
value: this.minutes,
138+
label: pad(this.minutes, 2),
139+
disabled: true,
140+
});
141+
}
131142
}
132143
return options;
133144
},

src/components/TimeSelect.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
v-for="option in options"
66
:key="option.value"
77
:value="option.value"
8+
:disabled="option.disabled"
89
>{{ option.label }}</option
910
>
1011
</select>

0 commit comments

Comments
 (0)