Hi,
I am investigating to use the datepicker in a AngularJs environment.
The problem I am facing now is that the value of the datepicker I get is a String, not a Date. And I do not want to add code to parse, validate etc.
In my test, I select a date in the calendar. The value is writen to the model, but as the view shows, its a string, not a Date.
This is the (significant part of) the test-set:
The view (kendoui-view_datepicker.html)
<h1>Test of the datepicker</h1>
<input kendo-date-picker data-ng-model="data.testDate" k-options="datePickerConfig"/>
Model date: {{data.testDate}} analyses: {{analyseDate()}}
The script (kendoui-angular-app-datepicker.js):
angular.module('SampleApp', ['ngResource', 'ngRoute', 'kendo.directives']).config(function ($routeProvider)
{ $routeProvider.when('/', { templateUrl: 'kendoui-view_datepicker.html', controller: HomeCtrl }).otherwise({redirectTo: '/'}); });
function HomeCtrl($scope)
{
$scope.data = {
testDate: new Date()
};
$scope.datePickerConfig = {
format: "dd-MM-yyyy",
parseFormats: ["yyyy-MM-dd", "dd/MM/yyyy", "yyyy/MM/dd"],
footer: "Currently #: kendo.toString(data,'dd-MM-yyyy')#"
}
$scope.analyseDate = function () {
var tp = typeof $scope.data.testDate;
return $scope.data.testDate + " " + tp;
}
}
I attach these files plus a start-up file and the used kendo-angular.js
I am investigating to use the datepicker in a AngularJs environment.
The problem I am facing now is that the value of the datepicker I get is a String, not a Date. And I do not want to add code to parse, validate etc.
In my test, I select a date in the calendar. The value is writen to the model, but as the view shows, its a string, not a Date.
This is the (significant part of) the test-set:
The view (kendoui-view_datepicker.html)
<h1>Test of the datepicker</h1>
<input kendo-date-picker data-ng-model="data.testDate" k-options="datePickerConfig"/>
Model date: {{data.testDate}} analyses: {{analyseDate()}}
The script (kendoui-angular-app-datepicker.js):
angular.module('SampleApp', ['ngResource', 'ngRoute', 'kendo.directives']).config(function ($routeProvider)
{ $routeProvider.when('/', { templateUrl: 'kendoui-view_datepicker.html', controller: HomeCtrl }).otherwise({redirectTo: '/'}); });
function HomeCtrl($scope)
{
$scope.data = {
testDate: new Date()
};
$scope.datePickerConfig = {
format: "dd-MM-yyyy",
parseFormats: ["yyyy-MM-dd", "dd/MM/yyyy", "yyyy/MM/dd"],
footer: "Currently #: kendo.toString(data,'dd-MM-yyyy')#"
}
$scope.analyseDate = function () {
var tp = typeof $scope.data.testDate;
return $scope.data.testDate + " " + tp;
}
}
I attach these files plus a start-up file and the used kendo-angular.js