Hi,
Few questions, is there an option or way for the DateTimePicker to:
1) Use hours 1-24 instead of 0-23? I ask because my use case for this is time being tracked to the whole hour, rounded up. In this case, 1/1/2001 hour 24 would be 1/2/2001 hour 0.
2) Have functionality like Today, but also change the time to the current time in the same button?
3) Have the date and times be changeable in one dropdown similar to the EJ1 implementation?
Thanks in advance!
|
let dateTimeInstance: DateTimePicker = new DateTimePicker({
open(args){
if(args.popup.element.id != 'datetimepicker_timepopup'){
var btn = args.popup.element.getElementsByClassName('e-btn')[0];
btn.addEventListener('click',function(){
dateTimeInstance.value = new Date();
})
}
}
});
dateTimeInstance.appendTo('#datetimepicker');
|
Great, thanks for your response!
Deepak,
Thanks again for your suggestion. However, after making the change you suggested for my Query 2, the new Today button only works only when the selected day is not today. For example, if the value is of the same day but the hour is different, the Today button click event is never called.
|
|
|
let dateTimeInstance: DateTimePicker = new DateTimePicker({
timeFormat: 'HH:mm',
change(args) {
debugger;
console.log(args)
if (args.value.getHours() == 0) {
//You can do the required process here
}
},
open(args) {
if (
args.popup.element.querySelector(
'.e-datepicker.e-popup-wrapper .e-today.e-btn'
)
) {
args.popup.element
.querySelector('.e-datepicker.e-popup-wrapper .e-today.e-btn')
.addEventListener('mousedown', (e) => {
setTimeout(() => {
dateTimeInstance.value = new Date();
}, 100)
});
}
},
});
dateTimeInstance.appendTo('#datetimepicker'); |