var angular = require('angular');

angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => {
    const colorScheme = ['#2a9fd6'];

    let weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    for(let i = 0; i < 6 - (new Date()).getDay(); i++) {
        const back = weekDays.pop();
        weekDays.unshift(back);
    }

    $scope.uploadColors = colorScheme;
    $scope.uploadLabels = weekDays;
    $scope.uploadSeries = ['Uploads'];
    $scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]];
    $scope.uploadOptions = {
        title: {
            display: true,
            text: 'Historical Uploads'
        },
    };

    $scope.viewColors = colorScheme;
    $scope.viewLabels = weekDays;
    $scope.viewSeries = ['Views'];
    $scope.viewData = [[5, 11, 4, 3, 7, 9, 21]];
    $scope.viewOptions = {
        title: {
            display: true,
            text: 'Historical Views'
        }
    };
}]);
{
}
@@ -167,234 +167,303 @@
     
-let weekDays = %5B'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'%5D;%0A    for(let i = 0; i %3C 6 - (new Date()).getDay(); i++) %7B%0A        const back = weekDays.pop();%0A        weekDays.unshift(back);%0A    %7D
+// Calculate and format descending dates back one week%0A    const currentDate = new Date();%0A    const oneDay = 1000 * 60 * 60 * 24;%0A    let dates = Array.from(%7Blength: 7%7D, (date, i) =%3E new Date(currentDate - oneDay * (6 - i)));%0A    let labels = dates.map(date =%3E date.toISOString().substr(5, 5));
 %0A%0A  
@@ -517,39 +517,37 @@
 .uploadLabels = 
-weekDay
+label
 s;%0A    $scope.up
@@ -824,15 +824,13 @@
 s = 
-weekDay
+label
 s;%0A 

Fix date and label calculation