Get date value in type string (.TS) when I selected on calendar

Can I get a date value on 9 Sep 2022. when I selected on 9 sep 2022, I am using angular CLI


1 Reply

BS Buvana Sathasivam Syncfusion Team September 15, 2022 07:01 AM UTC

Hi Tanabat,


Greetings from Syncfusion support.


We have validated the reported query so that you can get the selected date by using the Calendars change event. Please see the code and sample below for your reference. 

app.component.html

<ejs-calendar

        [isMultiSelection]="multiSelection"

        (change)="onValueChange($event)"

      ></ejs-calendar>

 <span id="selected">Selected Value: </span>


app.component.ts

 public multiSelectionboolean = true;

  onValueChange(argsany): void {

    (<HTMLInputElement>document.getElementById('selected')).textContent =

      'Selected Value: ' + args.value.toGMTString().slice(516);

  }


Sample: https://stackblitz.com/edit/angular-omnj6k?file=app.component.ts,app.component.html


Demo: https://ej2.syncfusion.com/angular/demos/#/bootstrap5/calendar/multi-select


API Link: https://ej2.syncfusion.com/angular/documentation/api/calendar/#change


Regards,

Buvana S


Loader.
Up arrow icon