$(document).ready(function () { //add .digits(); $.fn.digits = function () { return this.each(function () { $(this).text($(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")); }); }; //Modal for Notification $('#btn-close-notif').click(function () { $('#modal-notif').css("display", "none"); $('.dimmer').css("display", "none"); }); $('#register-btn').attr("disabled", true); $('#iagree').change(function () { if ($("#iagree").is(':checked')) { $('#register-btn').attr("disabled", false); } else { $('#register-btn').attr("disabled", true); } }); }); function numberWithCommas(number) { var parts = number.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); } function ConvertTimeto12Hrs(time) { // Check correct time format and split into components time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time]; if (time.length > 1) { // If time format correct time = time.slice(1); // Remove full string match value time[5] = +time[0] < 12 ? ' AM' : ' PM'; // Set AM/PM time[0] = +time[0] % 12 || 12; // Adjust hours } return time.join(''); // return adjusted time or original string } /* function tConvert(time) { // Check correct time format and split into components time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time]; if (time.length > 1) { // If time format correct time = time.slice(1); // Remove full string match value time[5] = +time[0] < 12 ? 'AM' : 'PM'; // Set AM/PM time[0] = +time[0] % 12 || 12; // Adjust hours } return time.join(''); // return adjusted time or original string } */ function ConvertToDate(value) { var pattern = /Date\(([^)]+)\)/; var results = pattern.exec(value); var dt = new Date(parseFloat(results[1])); return (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear(); } function ConvertToTime(value) { var pattern = /Date\(([^)]+)\)/; var results = pattern.exec(value); var dt = new Date(parseFloat(results[1])); var myDate = new Date(dt); var hours = myDate.getHours(); //returns 0-23 var minutes = myDate.getMinutes(); //returns 0-59 var seconds = myDate.getSeconds(); //returns 0-59 if (hours < 10) hoursString = "0" + hours; else hoursString = hours; if (minutes < 10) minutesString = "0" + minutes; else minutesString = minutes; if (seconds < 10) secondsString = "0" + seconds; else secondsString = seconds; return (hoursString + ":" + minutesString); } function confirmfirst() { if (confirm("Are you sure you want to continue?")) { return true; } else { return false; } }; function confirmdelete() { if (confirm("Are you sure you want to delete?")) { return true; } else { return false; } };