format for datepicker use mm/dd/yyyy instead of MM/dd/yyyy

1 Answer 504 Views
DatePicker
sai dheeraj
Top achievements
Rank 1
sai dheeraj asked on 12 Dec 2023, 04:33 AM

Hi,

can i use format = "mm/dd/yyyy" mm in short format i used like this in my project but it is not taking month correctly only if i use as below

format="MM/dd/yyyy"
it is working but as per our design styles it should be 

format="mm/dd/yyyy"

please let me know if i can use this format and achieve month working correctly i am referring to placeholders as per below

https://www.telerik.com/kendo-angular-ui/components/dateinputs/datepicker/placeholders/

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 13 Dec 2023, 05:25 PM

Hello Sai,

By default, the mm in Kendo UI DatePicker's format stands for minute and MM stands for month as seen in this Date Parsing article in our Github page.

In order to show mm/dd/yyyy in the placeholder of the DatePicker where mm stands for month, set the formatPlaceholder to a custom-format placeholder. For example:

<kendo-datepicker 
  format="MM/dd/yyyy" 
  [formatPlaceholder]="customFormatPlaceholder"
>
</kendo-datepicker>
public customFormatPlaceholder: DateInputCustomFormatPlaceholder = { 
  year: 'yyyy', 
  month: 'mm', 
  day: 'dd', 
  hour: 'hh', 
  minute: 'MM', 
  second: 'ss', 
  millisecond: 'SSS' 
}

Output:

  

Please take a look at this StackBlitz example where I have set a custom placeholder in the Kendo UI DatePicker.

Let me know if this helps or if I can further assist you.

Regards,
Hetali
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
DatePicker
Asked by
sai dheeraj
Top achievements
Rank 1
Answers by
Hetali
Telerik team
Share this question
or