starter.directive('schedule', [ function () { return { restrict: "E", scope: { data: "=source", }, templateUrl: 'templates/template-schedule.html', controller: function ($scope, Schedule) { if ($scope.data.start_date != null) { var datetitle = ""; $scope.isOver = false; if ($scope.data.end_date != null && new Date() > new Date($scope.data.end_date)) $scope.isOver = true; // var currentDateTime = new Date(); // var executeddTime = new Date(Date.parse($scope.data.execute_dd)); // if (($scope.data.end_date != null && new Date(Date.parse($scope.data.end_date)) < currentDateTime) && currentDateTime > executeddTime || // ($scope.data.repeat_type == 0 && $scope.data.start_date != null && new Date(Date.parse($scope.data.start_date)) < currentDateTime)) { // $scope.isOver = true; // } else { // $scope.isOver = false; // } // // if ($scope.data.execute_dd != null) { // var execute_temp = new Date(Date.parse($scope.data.execute_dd)); // var minutes_str = execute_temp.getMinutes().toString(); // var hours_str = execute_temp.getHours().toString(); // if (parseInt(minutes_str) < 10) { // minutes_str = "0" + minutes_str; // } // if (parseInt(hours_str) < 10) { // hours_str = "0" + hours_str; // } // if (currentDateTime.getFullYear() == executeddTime.getFullYear() && currentDateTime.getMonth() == executeddTime.getMonth() && // currentDateTime.getDate() == executeddTime.getDate()) { // datetitle = '今天' + " " + hours_str + ":" + minutes_str; // } else { // var year_str = ""; // if (currentDateTime.getFullYear() != executeddTime.getFullYear()) { // year_str = executeddTime.getFullYear() + "年"; // } // var Week = ['日', '一', '二', '三', '四', '五', '六']; // datetitle = year_str + (execute_temp.getMonth() + 1) + "月" + execute_temp.getDate() + "日 " + " 周" + Week[execute_temp.getDay()] + " " + hours_str + ":" + minutes_str; // } // } // $scope.execute_dd_title = datetitle; $scope.repeat_req_title = Schedule.getRepeatFreqTitle($scope.data.repeat_type, $scope.data.freq); } } } } ]);