7

I have an api which return the date in this format "014-08-26T15:10:45.402Z" i am using angular kendo ui .The problem i am facing is the date is not getting bound to the kendo date picker.Could someone help me out .

         <input kendo-date-picker ng-model="emp.datestart" k-format="MM/dd/yyyy" />
4

2 回答 2

18

为了让 Kendo DatePicker 使用字符串日期值模型,您需要:

1) 使用k-ng-model代替 ng-model。

2) 告诉小部件日期将被解析的确切格式。

<input kendo-date-picker k-ng-model="emp.datestart" k-options="datePickerOptions" />

然后在您的 AngularJS 控制器中,您将指定日期解析格式,例如:

$scope.datePickerOptions = {
    parseFormats: ["yyyy-MM-ddTHH:mm:ss"]
};
于 2015-03-13T18:45:27.887 回答
2

你可以使用这样的东西

<h4>Select date:</h4>
        <input 
         kendo-date-time-picker
         k-options="monthSelectorOptions"             
         data-k-ng-model="dateObject"
         data-ng-model="dateString.startDate" 
         style="width: 100%;" />

var startDate = new Date();

      $scope.monthSelectorOptions = {
        value: startDate,
        format: "dd/MM/yyyy h:mm tt",
        parseFormats: ['ddd MMM dd yyyy'],
        animation: {
            close: {
                effects: "fadeOut zoom:out",
                duration: 300
            },
            open: {
                effects: "fadeIn zoom:in",
                duration: 300
            }
        },
        culture: "de-DE",
      };

这是剑道道场的完整解决方案

于 2016-09-19T09:10:54.187 回答