Search code examples
asp.net-coreschedulerdatetimepickersyncfusion

syncfusion datetimepicker I want to set default time


hello I'm using the example on this page

syncfusion example

and my problum is that I want to set the default time like start time : 9:00:00 and end time : 9:30:00

also, client can set time freely...

could you help me T.T ...

and also I want to drag the popup...

I tried

        function OnPopupOpen(args) {

        ej.base.addClass([args.element], ['e-draggable']);

this code but It doesn't work..


Solution

  • I made it with this code

    var titleTextElement = args.element.querySelector('.e-title-text');
    
    var startElement = args.element.querySelector('#START_DATE');
    var endElement = args.element.querySelector('#END_DATE');
    
    if (titleTextElement.innerText === 'Edit Event') { 
    
        new ej.calendars.DateTimePicker({ value: new Date(startElement.value), format: "yyyy-MM-dd HH:mm:ss" }, startElement);
        new ej.calendars.DateTimePicker({ value: new Date(endElement.value), format: "yyyy-MM-dd HH:mm:ss" }, endElement);
    }
    else{ 
        var initialDate = new Date(startElement.value);
        initialDate.setHours(9, 0, 0);
    
        new ej.calendars.DateTimePicker({ value: initialDate, format: "yyyy-MM-dd HH:mm:ss" }, startElement);
    
        initialDate = new Date(endElement.value);
        initialDate.setHours(9, 30, 0);
    
        new ej.calendars.DateTimePicker({ value: initialDate, format: "yyyy-MM-dd HH:mm:ss" }, endElement);
    }