<commit_before>(function() {
    
    "use strict";
    
    angular.module('common.dateRange', [])
    
    .directive('dateRange', ['$window', function ($window) {
        return {
            restrict: 'A',
            scope: {
                options: '=',
                onChange: '&'
            },
            template: "<i class='icon-calendar'></i> <span></span> <b class='caret'></b>",
            link: function (scope, element) {
                $(element).daterangepicker(scope.options, function(start, end){
                    $(element).find('span').html(start.format('M/D/YYYY') + ' - ' + end.format('M/D/YYYY'));
    
                    scope.$apply(function () {
                        scope.onChange({ start: start, end: end });
                    });
                });
                    
                $(element).find('span').html($window.moment(scope.options.startDate).format('M/D/YYYY') + ' - ' + $window.moment(scope.options.endDate).format('M/D/YYYY'));
            }
        };
    }]);

})();<commit_msg>changed $apply to $timeout in daterange<commit_after>(function() {
    
    "use strict";
    
    angular.module('common.dateRange', [])
    
    .directive('dateRange', ['$window', '$timeout', function ($window, $timeout) {
        return {
            restrict: 'A',
            scope: {
                options: '=',
                onChange: '&'
            },
            template: "<i class='icon-calendar'></i> <span></span> <b class='caret'></b>",
            link: function (scope, element) {
                $(element).daterangepicker(scope.options, function(start, end){
                    $(element).find('span').html(start.format('M/D/YYYY') + ' - ' + end.format('M/D/YYYY'));
    
                    $timeout(function() {
                        scope.onChange({ start: start, end: end });
                    });
                });
                    
                $(element).find('span').html($window.moment(scope.options.startDate).format('M/D/YYYY') + ' - ' + $window.moment(scope.options.endDate).format('M/D/YYYY'));
            }
        };
    }]);

})();
{'fraction_non_alphanumeric': 0.1913493182886695, 'fraction_numerical': 0.0, 'mean_word_length': 1.5825242718446602, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6671248', 'n_tokens_mistral': 615, 'n_tokens_neox': 600, 'n_words': 81}