mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-25 03:30:36 +03:00
fix: disabledtime for ampm (#664)
This commit is contained in:
@@ -307,7 +307,7 @@ exports[`TimeRange render: correct classes of the columns 1`] = `
|
|||||||
data-type="ampm"
|
data-type="ampm"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
class="mx-time-item disabled"
|
class="mx-time-item"
|
||||||
data-index="0"
|
data-index="0"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,16 @@ export default {
|
|||||||
this.isDisabledTime(value.setSeconds(59, 999))
|
this.isDisabledTime(value.setSeconds(59, 999))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
isDisabledAMPM(date) {
|
||||||
|
const value = new Date(date);
|
||||||
|
const minHour = value.getHours() < 12 ? 0 : 12;
|
||||||
|
const maxHour = minHour + 11;
|
||||||
|
return (
|
||||||
|
this.isDisabledTime(value) &&
|
||||||
|
this.isDisabledTime(value.setHours(minHour, 0, 0, 0)) &&
|
||||||
|
this.isDisabledTime(value.setHours(maxHour, 59, 59, 999))
|
||||||
|
);
|
||||||
|
},
|
||||||
isDisabled(date, type) {
|
isDisabled(date, type) {
|
||||||
if (type === 'hour') {
|
if (type === 'hour') {
|
||||||
return this.isDisabledHour(date);
|
return this.isDisabledHour(date);
|
||||||
@@ -187,6 +197,9 @@ export default {
|
|||||||
if (type === 'minute') {
|
if (type === 'minute') {
|
||||||
return this.isDisabledMinute(date);
|
return this.isDisabledMinute(date);
|
||||||
}
|
}
|
||||||
|
if (type === 'ampm') {
|
||||||
|
return this.isDisabledAMPM(date);
|
||||||
|
}
|
||||||
return this.isDisabledTime(date);
|
return this.isDisabledTime(date);
|
||||||
},
|
},
|
||||||
handleSelect(value, type) {
|
handleSelect(value, type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user