Hello All,
I am running into some problems when using the Kendo-UI date picker in my angular application. Any help would be greatly appreciated.
Thanks in Advance,
Drew
When using the angular-kendo directive for the date picker along with a date format a date object put into the model. The desired behavior is to store a string in the model as formatted by the options.
Angular-Kendo 0.5.2 2013-07-26
AngularJS v1.0.5
jQuery jQuery v1.9.1
<input type="text" name="publicationDate" ng-model="preview.publicationDate" kendo-date-picker="dateOptions" k-options="dateOptions" />
$scope.dateOptions = { format: "yyyy-MM-dd" };
Date object stored in model: Tue Sep 17 2013 00:00:00 GMT-0400 (EDT)
Desired string to be stored in model: 2013-09-17
Questions
In Kendo UI 2014 Q2 (2014.2.625), this is fixed by using k-ng-model instead of ng-model.
I think what is going on is that when you are binding through ng-model, kendo is returning the value of
.value()
In your controller, I believe you can do this:
$scope.$watch('preview.publicationDate'), function (val) {
if (val) {
$scope.preview.publicatonDate = kendo.toString(val, "yyyy-MM-dd");
}
});
This code helps to change the kendo-date-time-picker to the desired format
<input kendo-date-time-picker
k-options="monthSelectorOptions"
k-format="'dd/MM/yyyy hh:mm tt'" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With