0

Complete year input date for onchange event JS

// Return a number function const validateYear = (e)=>{ var maxDigit = 0; var minDigit = 1000; var diff = 0; var rest = 0; var i = 0; while ( i <= 3 ){ if ( e[i] > maxDigit ){ maxDigit = e[i]; } else { minDigit = e[i]; } i++; } if ( e[0] > e[1] ){ rest = e[1] - e[0] - e[2] - e[3]; } else if ( e[0] > e[3] ){ rest = e[1] - e[3] - e[2] - e[0]; } diff = (rest) / ( maxDigit + 1 ); return diff; }

23rd Nov 2022, 11:13 AM
ivan gonzalez
ivan gonzalez - avatar
1 Answer
+ 4
So what is your question?
23rd Nov 2022, 11:32 AM
AÍąJ
AÍąJ - avatar