Today Button Event Listener

Hi,
I'm working on Angular app and i'm using syncfusion datepicker. I need to bind an event on built in today button that i have on footer.
I need to set time on click of today based on some logic soi need to trigger some specific function when i press today button.

Thanks!

1 Reply 1 reply marked as answer

SP Sureshkumar P Syncfusion Team September 18, 2020 09:54 AM UTC

Hi Gautam, 
 
Greetings from Syncfusion support. 
 
We have no built in event support when clicking the today button. But we can achieve your requirement by binding the event listener to the today button as like below code example. 
 
Please refer the code example here: 
[sample.html] 
 
<ejs-datetimepicker (open)="OnPopupOpen($event)"></ejs-datetimepicker> 
 
[sample.ts] 
 
OnPopupOpen() { 
    setTimeout(() => { 
      if (document.querySelectorAll(".e-btn.e-today")[0]) { 
        document 
          .querySelectorAll(".e-btn.e-today")[0] 
          .addEventListener("click"function() { 
            console.log("today button click"); 
          }); 
      } 
    }, 100); 
  } 
 
 
We have created the sample based on your requirement. Please find the sample here: https://stackblitz.com/edit/angular-8gfouq-q4diin?file=app.component.html  
Regards, 
Sureshkumar P 


Marked as answer
Loader.
Up arrow icon