Web/JS
[Javascript] DatePicker 지정된 요일 비활성화 하기
영보로그
2021. 4. 8. 17:25
반응형
DatePicker 특정요일 색 및 선택금지 시키기
* 조건 ( 일요일 = 0 , 토요일 = 6 )
- 월요일과 수요일을 제외한 요일은 선택 안되게 할 것
if {
jInput.datetimepicker({
changeMonth: true,
changeYear: true,
controlType: 'select',
timeFormat: 'HH:mm',
dateFormat: 'yy-mm-dd',
yearRange: '1930:2024',
dayNames: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
//minDate: new Date(2018, 5 - 1, 14),
//maxDate: new Date(2018, 8 - 1, 24)
minDate: new Date(2020, 4 - 1, 1),
maxDate: new Date(2023, 8 - 1, 31),
beforeShowDay: disableAllTheseDays
});
}
function disableAllTheseDays2(date) {
var day = date.getDay();
return [(day != 0 && day != 1 && day != 2 && day != 4 && day != 6)];
// 0=일, 1=월, 2=화, 4=목, 6=토 => 안나오게 할 것
}
실행 결과
반응형