var setCurAge = function(val) { var birthyear = val.substring(0,4); var now = new Date(); var curYear = now.getFullYear(); $('#cur_age').val(curYear - birthyear); } var taxedChanged = function(val) { var taxed = parseInt(val); var untaxed = parseInt($('#currentBalanceUntaxed').val()); var free = parseInt($('#currentBalanceTaxfree').val()); $('#currentBalanceTaxed').val(taxed); $('#currentBalance').val(taxed + untaxed + free); } var untaxedChanged = function(val) { var taxed = parseInt($('#currentBalanceTaxed').val()); var untaxed = parseInt(val); var free = parseInt($('#currentBalanceTaxfree').val()); $('#currentBalanceUntaxed').val(untaxed); $('#currentBalance').val(taxed + untaxed + free); } var freeChanged = function(val) { var taxed = parseInt($('#currentBalanceTaxed').val()); var untaxed = parseInt($('#currentBalanceUntaxed').val()); var free = parseInt(val); $('#currentBalanceTaxfree').val(free); $('#currentBalance').val(taxed + untaxed + free); } var ComponentsDateTimePickers = function () { var handleDatePickers = function () { if (jQuery().datepicker) { $('.date-picker').datepicker({ rtl: App.isRTL(), orientation: "left", autoclose: true }); //$('body').removeClass("modal-open"); // fix bug when inline picker is used in modal } /* Workaround to restrict daterange past date select: http://stackoverflow.com/questions/11933173/how-to-restrict-the-selectable-date-ranges-in-bootstrap-datepicker */ // Workaround to fix datepicker position on window scroll $( document ).scroll(function(){ $('#form_modal2 .date-picker').datepicker('place'); //#modal is the id of the modal }); } return { //main function to initiate the module init: function () { handleDatePickers(); } }; }(); if (App.isAngularJsApp() === false) { jQuery(document).ready(function() { ComponentsDateTimePickers.init(); }); }