We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Now button is missing in DateTimePicker

Dear all, 

In asp.net mvc js1, the datetimepicker had a "now" button that was filling the current day and time .e.g. 01/01/2019 14:13

Is this option available in JS2 ? I can not find it, just the "Today" button, but it put 12:00 as an hour always, no matter if is 19:32

That option was very nice in my case as an "Start now" the task, and "End now" the task..

Thank you.

1 Reply

SI Silambarasan I Syncfusion Team March 14, 2019 04:45 AM

Hi Guillermo, 
 
Thank you for contacting Syncfusion support. 
 
We have looked into the reported query and your requirement (“Need to update the current date with current time value as like in EJ1 DateTimePicker”) can be achievable as a work around solution. In the that, we have updated the current date and time value in DateTimePicker input when clicking the “Today” button. Please refer the below code example. 
 
 
@Html.EJS().DateTimePicker("datetimepicker").Width("250px").Open("onOpen").Render() 
 
<script> 
    function onOpen(args) { 
        this.footer.querySelector('.e-today').addEventListener('click', function () { 
            var dateTimeInstance = document.getElementById("datetimepicker").ej2_instances[0]; 
            dateTimeInstance.value = new Date(new Date().toLocaleString()); 
        }); 
    } 
</script> 
 
 
 
 
 
To know more about DateTimePicker, please refer the below UG documentation link.
https://ej2.syncfusion.com/aspnetmvc/documentation/datetimepicker/getting-started-mvc/ 
 
Could you please check the above solution and get back to us if you require further assistance? 
 
Regards, 
Silambarasan 


Loader.
Live Chat Icon For mobile
Up arrow icon