I am using kendoUI datepicker control in my angular 7 application. At the moment I am trying to bind json date returned by the api to the datepicker control. The code below does the job but shows only the month and year. It doesnt show the exact date. So I need to see the date selected when the datepicker control is selected. Is there a better an easier way to do that.
The dateformat what i get in json is /Date(1224043200000)/
UI
<kendo-datepicker *ngIf="EditMode"
[format]="'MMMM yyyy'" (valueChange)="dateFoundedChanged($event)" [(ngModel)]="FirmDetails.Firm.DATE_FOUNDED" [value]="dateFoundedDate">
</kendo-datepicker>
Component code
get dateFoundedDate(): Date {
var dateString = this.FirmDetails.Firm.DATE_FOUNDED;
var seconds = parseInt(dateString.replace(/\/Date\(([0-9]+)[^+]\//i, "$1"));
var date = new Date(seconds);
return date;
}
You are using date picker format as below:
try to add date inside the format as follow:
You don't need to add [format] in your code, datepicker will load the default time format.
Refer following links:
Example 1 Example 2