kendo-dateinput AM/PM (locale)

1 Answer 158 Views
DateInput Localization
Ali
Top achievements
Rank 1
Iron
Ali asked on 12 Mar 2022, 07:52 PM
Hi! How could I show AM/PM?
https://stackblitz.com/edit/angular-vaxrrp?file=app/app.component.ts

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 15 Mar 2022, 06:55 PM

Hi Ali,

In order to show the string AM/PM based on the time in the Kendo UI DateInput, use the following ternary operation:

<kendo-dateinput 
  format="hh:mm '{{ampm}}'" 
  [value]="value"
>
</kendo-dateinput>

public value: Date = new Date();
public ampm = this.value.getHours() > 11? "PM" : "AM";

In this updated StackBlitz example, I have added AM/PM string in the DateInput format.

I hope this helps.

Regards,
Hetali
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DateInput Localization
Asked by
Ali
Top achievements
Rank 1
Iron
Answers by
Hetali
Telerik team
Share this question
or