inTimeHHMM = inTime.split(":");
outTimeHHMM = outTime.split(":");
var today = new Date();
var dateInTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), inTimeHHMM[0], inTimeHHMM[1], 0);
var dateOutTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), outTimeHHMM[0], outTimeHHMM[1], 0);
if(dateInTime<=dateOutTime){
}else{
dateOutTime.setDate(dateOutTime.getDate() + 1);
}
var diff =(dateOutTime.getTime() - dateInTime.getTime()) / 1000;
diff /= 60;
workingMinutes = Math.abs(Math.round(diff));
Sunday, 11 June 2017
Javascript - In time and out time difference
Monday, 10 April 2017
Daterangepicker set min time
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
var currDate = new Date().addHours(5); // 5 is the hours
$('#fromDate').daterangepicker({
minDate: currDate,
timePicker: true,
singleDatePicker: true,
timePickerIncrement: 1,
format: 'DD/MM/YYYY hh:mm A'
});
Thursday, 23 February 2017
jQuery validation - IP address
/*
ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
*/
$.validator.addMethod('ipChecking', function(value) {
//var ip = "^(?:(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)\.){3}" +"(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)$";
validIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
ipCheckFlag = true;
ipLists = value.split(',');
for(ip=0; ip<ipLists.length; ip++){
if(!ipLists[ip].trim().match(validIpAddressRegex)){
ipCheckFlag = false;
}
}
return ipCheckFlag;
});
Subscribe to:
Comments (Atom)
Git merge branch to another branch
$ git checkout develop $ git pull $ git checkout test-branch $ git merge develop $ git push
-
Netlify Porter Railway Render fly.io clever-cloud.com vercel
-
Social Recap TheNextWeb.com Wired.com Tech2.com Gizmodo.com TheVerge.com DigitalTrends.com Mashable.com TechRadar.com Technorati.com
-
/* ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$...