I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
Har fundet frem til følgende løsning som fungerer perfekt:
function scanboxformatdate(obj) { strDate=obj.value; var strDay; var strMonth; var strYear; var temp; temp=strDate; strDate=scanboxsecureincReplace(strDate,'/','-'); strDate=scanboxsecureincReplace(strDate,'.','-'); if (strDate.length > 0) { var strDateArray = strDate.split('-'); if (strDateArray.length!=3) { if(strDate.length>5){ strDay = strDate.substr(0, 2); strMonth = strDate.substr(2, 2); strYear = strDate.substr(4); } else{ alert('Datoen er ugyldig. \n\nBrug datoformatet dd-mm-åååå'); obj.select(); obj.focus(); return false; } } else { strDay = strDateArray[0]; strMonth = strDateArray[1]; strYear = strDateArray[2]; } if (strYear.length==2) { if (strYear < 70) { strYear = '20' + strYear; } else { strYear = '19' + strYear; } } strYear = parseInt(strYear); if (strDay.length < 2) { strDay='0' + strDay; } if (strMonth.length < 2) { strMonth='0' + strMonth; } if (strYear.length == 1) { strYear='0' + strYear; } if (strYear.length < 4) { strYear='20' + strYear; } temp = strDay + '-' + strMonth + '-' + strYear; } else { } if (scanboxsecureincCheckDato(temp)) { obj.value = temp; } else { alert('Datoen er ugyldig. \n\nBrug datoformatet dd-mm-åååå'); obj.value = strDate; obj.focus(); obj.select(); return false; } return true; }
function scanboxsecureincCheckDato(cdato) { if (cdato != '') { if (cdato.length > 5) { if (scanboxsecureincchkdate(cdato)) { return true; } else { return false; } } } else { return true; } }
function scanboxsecureincchkdate(objName) { var strDatestyle = "EU"; var strDate; var strDay; var strMonth; var strYear; var intday; var intMonth; var intYear; var booFound = false; var strSeparatorArray = new Array("-"," ","/","."); var intElementNr; var err = 0; strDate = objName; for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) { if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) { strDateArray = strDate.split(strSeparatorArray[intElementNr]); if (strDateArray.length != 3) { err = 1;return false; } else { strDay = strDateArray[0]; strMonth = strDateArray[1]; strYear = strDateArray[2]; } booFound = true; } } if (booFound == false) { if (strDate.length>5) { strDay = strDate.substr(0, 2); strMonth = strDate.substr(2, 2); strYear = strDate.substr(4); } } if (strYear.length == 2) { if (strYear < 70) { strYear = '20' + strYear; } else { strYear = '19' + strYear; } } if (strDatestyle == "US") { strTemp = strDay; strDay = strMonth; strMonth = strTemp; } intday = parseInt(strDay, 10); if (strYear>=2100 || strYear < 1850) { err = 30; return false; } if (isNaN(intday)) { err = 2; return false; } intMonth = parseInt(strMonth, 10); if (isNaN(intMonth)) { err = 3; return false; } intYear = parseInt(strYear, 10); if (isNaN(intYear)) { err = 4; return false; } if (intMonth>12 || intMonth<1) { err = 5;return false; } if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) { err = 6; return false; } if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) { err = 7; return false; } if (intMonth == 2) { if (intday < 1) { err = 8; return false; } if (scanboxsecureincLeapYear(intYear) == true) { if (intday > 29) { err = 9; return false; } } else { if (intday > 28) { err = 10;return false; } } } return true; }
function scanboxsecureincLeapYear(intYear) { if (intYear % 100 == 0) { if (intYear % 400 == 0) { return true; } } else { if ((intYear % 4) == 0) { return true; } } return false; }
function scanboxsecureincReplace(tekst,soeg,indsaet) { var string = tekst; var stringArray = string.split(soeg); var a=stringArray[0]; for (var i=1; i < stringArray.length; i++) { a += indsaet + (stringArray[i]); } return a; }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.