3

I've got a Kendo Datepicker which displays as dd/MM/yyyy, which is fair enough. However, I'm wanting to change it to MM/dd/yyyy but whenever I do (by changing format in the below), it either remains at dd/MM/yyyy or becomes blank:

<input name="saleDate" id="txt-saleDate" data-bind="kendoDatePicker: { value: saleDate, format: 'MM/dd/yyyy', enabled: $parent.isNewSales }" />

Tried changing the format to 'MM/dd/yyyy' (as above) and also 'yyyy/MM/dd' but none of these have worked. Also tried using parseFormats.

user25730
  • 517
  • 2
  • 6
  • 24
  • try using this M/d/yyyy instead of mm/dd/yyyy – Baahubali Dec 21 '16 at 00:23
  • Are you sure that `data-bind="kendoDatePicker: { }"` is the correct syntax? When using that format inside the regular javascript constructor everything works great. – Dekel Dec 21 '16 at 00:24
  • M/d/yyyy does nothing new - stays as dd/MM/yyyy. May have to try some different syntax as Dekel suggests. – user25730 Dec 21 '16 at 00:26
  • Are you using knockout? – Dekel Dec 21 '16 at 00:27
  • Yeah. Just noticed [link](http://demos.telerik.com/kendo-ui/datetimepicker/index) which has an example in which I can change the format. – user25730 Dec 21 '16 at 00:29
  • But this is **not** knockout. This is the original kendo lib. – Dekel Dec 21 '16 at 00:30
  • I don't know - I'm not the original developer. – user25730 Dec 21 '16 at 00:32
  • I know you are not. If you are using knockout - you should check the knockout library. – Dekel Dec 21 '16 at 00:34
  • i'm not really sure but hmm never seen kendo used that way, usually data-bind=" value: saleDate" the datepicker should be on role="datepicker". see here http://demos.telerik.com/kendo-ui/datepicker/mvvm, and as for the format in mvvm it would be data-format="MM/dd/yyyy" see here http://dojo.telerik.com/UxusA – himawan_r Dec 21 '16 at 01:38

2 Answers2

2

I had the same issue and format: "{0:yyyy-MM-dd}" code satisfied me. I hope this helps you.

eugene.sushilnikov
  • 1,795
  • 2
  • 12
  • 9
0
$("#txt-saleDate").kendoDatePicker({
    dateInput: true,
    format: "dd/MM/yyyy"
});
4b0
  • 21,981
  • 30
  • 95
  • 142
Okz
  • 1