<commit_before>'use strict';

angular.module('digApp')
.directive('dateFilter', function($filter) {
    return {
        restrict: 'E',
        scope: {
            aggregationName: '=',
            field: '@',
            indexVM: '=indexvm',
            ejs: '=',
            filters: '=',
            filterStates: '='
        },
        templateUrl: 'components/date-filter/date-filter.partial.html',
        link: function($scope) {
            if($scope.filterStates[$scope.field]) {
                if($scope.filterStates[$scope.field].beginDate) {
                    $scope.filterStates[$scope.field].beginDate = new Date($scope.filterStates[$scope.field].beginDate);
                }
                if($scope.filterStates[$scope.field].endDate) {
                    $scope.filterStates[$scope.field].endDate = new Date($scope.filterStates[$scope.field].endDate);
                }
            } else {
                $scope.filterStates[$scope.field] = {
                    beginDate: null,
                    endDate: null
                };
            }
            $scope.dateFormat = 'MM/dd/yyyy';

            $scope.dateToEjsString = function(date) {
                return $filter('date')(date, 'yyyy-MM-dd');
            };
        }
    };
});<commit_msg>Fixing date filter issue for rerunning a saved query.<commit_after>'use strict';

angular.module('digApp')
.directive('dateFilter', function($filter) {
    return {
        restrict: 'E',
        scope: {
            aggregationName: '=',
            field: '@',
            indexVM: '=indexvm',
            ejs: '=',
            filters: '=',
            filterStates: '='
        },
        templateUrl: 'components/date-filter/date-filter.partial.html',
        controller: function($scope) {
            $scope.dateToEjsString = function(date) {
                return $filter('date')(date, 'yyyy-MM-dd');
            };
            $scope.dateFormat = 'MM/dd/yyyy';
        },
        link: function($scope) {

            if($scope.filterStates[$scope.field]) {
                if($scope.filterStates[$scope.field].beginDate) {
                    $scope.filterStates[$scope.field].beginDate = new Date($scope.filterStates[$scope.field].beginDate);
                }
                if($scope.filterStates[$scope.field].endDate) {
                    $scope.filterStates[$scope.field].endDate = new Date($scope.filterStates[$scope.field].endDate);
                }
            } else {
                $scope.filterStates[$scope.field] = {
                    beginDate: null,
                    endDate: null
                };
            }
        }
    };
});
{'fraction_non_alphanumeric': 0.14705882352941177, 'fraction_numerical': 0.0, 'mean_word_length': 1.570736434108527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6341490', 'n_tokens_mistral': 732, 'n_tokens_neox': 704, 'n_words': 94}