<commit_before>//By <NAME> - <EMAIL>
//https://github.com/rajeshwarpatlolla

(function () {
    'use strict';

    angular.module('ionic-datepicker')
        .directive('ionicDatepicker', IonicDatepicker);

    IonicDatepicker.$inject = ['$ionicPopup', '$ionicModal', 'IonicDatepickerService'];

    function IonicDatepicker($ionicPopup, $ionicModal, IonicDatepickerService) {
        return {
            restrict: 'AE',
            replace: true,
            scope: {
                inputObj: "=inputObj"
            },
            link: function (scope, element, attrs) {
                
                if(typeOf scope.inputObj.inputDate === 'string'){
                    scope.inputObj.inputDate = new Date(scope.inputObj.inputDate);
                }
                
                scope.currentMonth = '';
                scope.currentYear = '';
                scope.disabledDates = [];

                //Setting the title, today, close and set strings for the date picker
                scope.titleLabel = scope.inputObj.titleLabel ? (scope.inputObj.titleLabel) : 'Select Date';
                scope.todayLabel = scope.inputObj.todayLabel ? (scope.inputObj.todayLabel) : 'Today';
                scope.closeLabel = scope.inputObj.closeLabel ? (scope.inputObj.closeLabel) : 'Close';
                scope.setLabel = scope.inputObj.setLabel ? (scope.inputObj.setLabel) : 'Set';
                scope.showTodayButton = scope.inputObj.showTodayButton ? (scope.inputObj.showTodayButton) : 'true';
                scope.errorMsgLabel = scope.inputObj.errorMsgLabel ? (scope.inputObj.errorMsgLabel) : 'Please select a date.';
                scope.setButtonType = scope.inputObj.setButtonType ? (scope.inputObj.setButtonType) : 'button-stable cal-button';
                scope.todayButtonType = scope.inputObj.todayButtonType ? (scope.inputObj.todayButtonType) : 'button-stable cal-button';
                scope.closeButtonType = scope.inputObj.closeButtonType ? (scope.inputObj.closeButtonType) : 'button-stabl cal-buttone';
                scope.templateType = scope.inputObj.templateType ? (scope.inputObj.templateType) : 'popup';
                scope.modalHeaderColor = scope.inputObj.modalHeaderColor ? (scope.inputObj.modalHeaderColor) : 'bar-stable';
                scope.modalFooterColor = scope.inputObj.modalFooterColor ? (scope.inputObj.modalFooterColor) : 'bar-stable';
                scope.showClear = scope.inputObj.showClear ? (scope.inputObj.showClear) : false;
                scope.clearLabel = scope.inputObj.clearLabel ? (scope.inputObj.clearLabel) : 'Clear';
                scope.clearButtonType = scope.inputObj.clearButtonType ? (scope.inputObj.clearButtonType) : 'button-stable cal-button';
                scope.dateFormat = scope.inputObj.dateFormat ? (scope.inputObj.dateFormat) : 'dd-MM-yyyy';
                scope.closeOnSelect = scope.inputObj.closeOnSelect ? (scope.inputObj.closeOnSelect) : false;

                scope.enableDatesFrom = {
                    epoch: 0,
                    isSet: false
                };
                scope.enableDatesTo = {
                    epoch: 0,
                    isSet: false
                };

                // creating buttons
                var buttons = [];
                buttons.push({
                    text: scope.closeLabel,
                    type: scope.closeButtonType,
                    onTap: function (e) {
                        scope.inputObj.callback(undefined);
                    }
                });

                if (scope.showClear) {
                    buttons.push({
                        text: scope.clearLabel,
                        type: scope.clearButtonType,
                        onTap: function (e) {
                            dateCleared();
                        }
                    });
                };

                if (scope.showTodayButton == 'true') {
                    buttons.push({
                        text: scope.todayLabel,
                        type: scope.todayButtonType,
                        onTap: function (e) {
                            todaySelected();
                            //e.preventDefault();
                        }
                    });
                }

                if (!scope.closeOnSelect) {
                    buttons.push({
                        text: scope.setLabel,
                        type: scope.setButtonType,
                        onTap: function () {
                            dateSelected();
                        }
                    });
                }
                //Setting the from and to dates - Function used to enable/disable prv/future dates
                var setToFrom = function () {
                    scope.prevMonthDisable = false;
                    scope.nextMonthDisable = false;
                    if (scope.inputObj.from) {
                        scope.enableDatesFrom.isSet = true;
                        scope.enableDatesFrom.epoch = scope.inputObj.from.getTime();
                        if (scope.enableDatesFrom.epoch > scope.currentMonthFirstDayEpoch) {
                            scope.prevMonthDisable = true;
                    }
                    }

                    if (scope.inputObj.to) {
                        scope.enableDatesTo.isSet = true;
                        scope.enableDatesTo.epoch = scope.inputObj.to.getTime();
                        if (scope.enableDatesTo.epoch < scope.currentMonthLastDayEpoch) {
                            scope.nextMonthDisable = true;
                        }
                    }
                };

                setToFrom();

                //Setting the input date for the date picker
                if (scope.inputObj.inputDate) {
                    scope.ipDate = new Date(scope.inputObj.inputDate.getFullYear(), scope.inputObj.inputDate.getMonth(), scope.inputObj.inputDate.getDate());
                } else {
                    scope.ipDate = new Date();
                }
                scope.selectedDateFull = scope.ipDate;

                //Setting the months list. This is useful, if the component needs to use some other language.
                scope.monthsList = [];
                if (scope.inputObj.monthList && scope.inputObj.monthList.length === 12) {
                    scope.monthsList = scope.inputObj.monthList;
                } else {
                    scope.monthsList = IonicDatepickerService.monthsList;
                }
                if (scope.inputObj.weekDaysList && scope.inputObj.weekDaysList.length === 7) {
                    scope.weekNames = scope.inputObj.weekDaysList;
                } else {
                    scope.weekNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
                }
                scope.yearsList = IonicDatepickerService.getYearsList(scope.inputObj.from, scope.inputObj.to);

                //Setting whether to show Monday as the first day of the week or not.
                if (scope.inputObj.mondayFirst) {
                    scope.mondayFirst = true;
                } else {
                    scope.mondayFirst = false;
                }

                //Setting the disabled dates list.
                if (scope.inputObj.disabledDates && scope.inputObj.disabledDates.length === 0) {
                    scope.disabledDates = [];
                } else {
                    angular.forEach(scope.inputObj.disabledDates, function (val, key) {
                        val.setHours(0);
                        val.setMinutes(0);
                        val.setSeconds(0);
                        val.setMilliseconds(0);

                        scope.disabledDates.push(val.getTime());
                    });
                }

                var currentDate = angular.copy(scope.ipDate);
                currentDate.setHours(0);
                currentDate.setMinutes(0);
                currentDate.setSeconds(0);
                currentDate.setMilliseconds(0);

                scope.selctedDateString = currentDate.toString();
                scope.today = {};

                if (scope.mondayFirst === true) {
                    var lastWeekDay = scope.weekNames.shift();
                    scope.weekNames.push(lastWeekDay);
                }

                var tempTodayObj = new Date();
                var tempToday = new Date(tempTodayObj.getFullYear(), tempTodayObj.getMonth(), tempTodayObj.getDate());
<commit_msg>resolve not selected day when pass inputDate<commit_after>//By <NAME> - <EMAIL>
//https://github.com/rajeshwarpatlolla

(function () {
    'use strict';

    angular.module('ionic-datepicker')
        .directive('ionicDatepicker', IonicDatepicker);

    IonicDatepicker.$inject = ['$ionicPopup', '$ionicModal', 'IonicDatepickerService'];

    function IonicDatepicker($ionicPopup, $ionicModal, IonicDatepickerService) {
        return {
            restrict: 'AE',
            replace: true,
            scope: {
                inputObj: "=inputObj"
            },
            link: function (scope, element, attrs) {
                
                if(typeOf scope.inputObj.inputDate === 'string'){
                    scope.inputObj.inputDate = new Date(scope.inputObj.inputDate);
                }
                
                scope.currentMonth = '';
                scope.currentYear = '';
                scope.disabledDates = [];

                //Setting the title, today, close and set strings for the date picker
                scope.titleLabel = scope.inputObj.titleLabel ? (scope.inputObj.titleLabel) : 'Select Date';
                scope.todayLabel = scope.inputObj.todayLabel ? (scope.inputObj.todayLabel) : 'Today';
                scope.closeLabel = scope.inputObj.closeLabel ? (scope.inputObj.closeLabel) : 'Close';
                scope.setLabel = scope.inputObj.setLabel ? (scope.inputObj.setLabel) : 'Set';
                scope.showTodayButton = scope.inputObj.showTodayButton ? (scope.inputObj.showTodayButton) : 'true';
                scope.errorMsgLabel = scope.inputObj.errorMsgLabel ? (scope.inputObj.errorMsgLabel) : 'Please select a date.';
                scope.setButtonType = scope.inputObj.setButtonType ? (scope.inputObj.setButtonType) : 'button-stable cal-button';
                scope.todayButtonType = scope.inputObj.todayButtonType ? (scope.inputObj.todayButtonType) : 'button-stable cal-button';
                scope.closeButtonType = scope.inputObj.closeButtonType ? (scope.inputObj.closeButtonType) : 'button-stabl cal-buttone';
                scope.templateType = scope.inputObj.templateType ? (scope.inputObj.templateType) : 'popup';
                scope.modalHeaderColor = scope.inputObj.modalHeaderColor ? (scope.inputObj.modalHeaderColor) : 'bar-stable';
                scope.modalFooterColor = scope.inputObj.modalFooterColor ? (scope.inputObj.modalFooterColor) : 'bar-stable';
                scope.showClear = scope.inputObj.showClear ? (scope.inputObj.showClear) : false;
                scope.clearLabel = scope.inputObj.clearLabel ? (scope.inputObj.clearLabel) : 'Clear';
                scope.clearButtonType = scope.inputObj.clearButtonType ? (scope.inputObj.clearButtonType) : 'button-stable cal-button';
                scope.dateFormat = scope.inputObj.dateFormat ? (scope.inputObj.dateFormat) : 'dd-MM-yyyy';
                scope.closeOnSelect = scope.inputObj.closeOnSelect ? (scope.inputObj.closeOnSelect) : false;

                scope.enableDatesFrom = {
                    epoch: 0,
                    isSet: false
                };
                scope.enableDatesTo = {
                    epoch: 0,
                    isSet: false
                };

                // creating buttons
                var buttons = [];
                buttons.push({
                    text: scope.closeLabel,
                    type: scope.closeButtonType,
                    onTap: function (e) {
                        scope.inputObj.callback(undefined);
                    }
                });

                if (scope.showClear) {
                    buttons.push({
                        text: scope.clearLabel,
                        type: scope.clearButtonType,
                        onTap: function (e) {
                            dateCleared();
                        }
                    });
                };

                if (scope.showTodayButton == 'true') {
                    buttons.push({
                        text: scope.todayLabel,
                        type: scope.todayButtonType,
                        onTap: function (e) {
                            todaySelected();
                            //e.preventDefault();
                        }
                    });
                }

                if (!scope.closeOnSelect) {
                    buttons.push({
                        text: scope.setLabel,
                        type: scope.setButtonType,
                        onTap: function () {
                            dateSelected();
                        }
                    });
                }
                //Setting the from and to dates - Function used to enable/disable prv/future dates
                var setToFrom = function () {
                    scope.prevMonthDisable = false;
                    scope.nextMonthDisable = false;
                    if (scope.inputObj.from) {
                        scope.enableDatesFrom.isSet = true;
                        scope.enableDatesFrom.epoch = scope.inputObj.from.getTime();
                        if (scope.enableDatesFrom.epoch > scope.currentMonthFirstDayEpoch) {
                            scope.prevMonthDisable = true;
                    }
                    }

                    if (scope.inputObj.to) {
                        scope.enableDatesTo.isSet = true;
                        scope.enableDatesTo.epoch = scope.inputObj.to.getTime();
                        if (scope.enableDatesTo.epoch < scope.currentMonthLastDayEpoch) {
                            scope.nextMonthDisable = true;
                        }
                    }
                };

                setToFrom();

                //Setting the input date for the date picker
                if (scope.inputObj.inputDate) {
                    scope.ipDate = new Date(scope.inputObj.inputDate.getFullYear(), scope.inputObj.inputDate.getMonth(), scope.inputObj.inputDate.getDate());
                } else {
                    scope.ipDate = new Date();
                }
                scope.selectedDateFull = scope.ipDate;

                //Setting the months list. This is useful, if the component needs to use some other language.
                scope.monthsList = [];
                if (scope.inputObj.monthList && scope.inputObj.monthList.length === 12) {
                    scope.monthsList = scope.inputObj.monthList;
                } else {
                    scope.monthsList = IonicDatepickerService.monthsList;
                }
                if (scope.inputObj.weekDaysList && scope.inputObj.weekDaysList.length === 7) {
                    scope.weekNames = scope.inputObj.weekDaysList;
                } else {
                    scope.weekNames = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
                }
                scope.yearsList = IonicDatepickerService.getYearsList(scope.inputObj.from, scope.inputObj.to);

                //Setting whether to show Monday as the first day of the week or not.
                if (scope.inputObj.mondayFirst) {
                    scope.mondayFirst = true;
                } else {
                    scope.mondayFirst = false;
                }

                //Setting the disabled dates list.
                if (scope.inputObj.disabledDates && scope.inputObj.disabledDates.length === 0) {
                    scope.disabledDates = [];
                } else {
                    angular.forEach(scope.inputObj.disabledDates, function (val, key) {
                        val.setHours(0);
                        val.setMinutes(0);
                        val.setSeconds(0);
                        val.setMilliseconds(0);

                        scope.disabledDates.push(val.getTime());
                    });
                }

                var currentDate = angular.copy(scope.ipDate);
                currentDate.setHours(0);
                currentDate.setMinutes(0);
                currentDate.setSeconds(0);
                currentDate.setMilliseconds(0);

                scope.selctedDateString = currentDate.toString();
                scope.selctedDateStringCopy = angular.copy(scope.selctedDateString);
                scope.today = {};

                if (scope.mondayFirst === true) {
                    var lastWeekDay = scope.weekNames.shift();
                    scope.weekNames.push(lastWeekDay);
                }

                var tempTodayObj = new Date();
                var tempToday = new Date(tempTodayObj.getFullYear(), tempTodayObj.getMonth(), tempTodayObj.getDate());

{'fraction_non_alphanumeric': 0.09908482928546286, 'fraction_numerical': 0.0016426141030153702, 'mean_word_length': 1.3471017485887375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '6698933', 'n_tokens_mistral': 4420, 'n_tokens_neox': 4042, 'n_words': 728}