瀏覽代碼

fixed sleectedDate not updating

tags/1.0.0
Robin Thoni 8 年之前
父節點
當前提交
719a41923f
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. 3
    1
      app/controllers/home.controller.js

+ 3
- 1
app/controllers/home.controller.js 查看文件

@@ -49,7 +49,8 @@ angular.module('app')
49 49
             $scope.getMonday = function(d)
50 50
             {
51 51
                 d = new Date(d);
52
-                var day = d.getDay(), diff = d.getDate() - day + (day == 0 ? -6:1); // adjust when day is sunday
52
+                var day = d.getDay();
53
+                var diff = d.getDate() - day + (day == 0 ? -6:1);
53 54
                 d = new Date(d.setDate(diff));
54 55
                 d.setHours(0, 0, 0, 0);
55 56
                 return d;
@@ -167,6 +168,7 @@ angular.module('app')
167 168
             $scope.goToRelativeWeek = function(relativeWeek)
168 169
             {
169 170
                 $scope.selectedDate.setDate($scope.selectedDate.getDate() + (relativeWeek * 7));
171
+                $scope.selectedDate = new Date($scope.selectedDate);
170 172
                 $scope.loadWeeks();
171 173
             };
172 174
 

Loading…
取消
儲存