更新护照有效期验证

hotfix/paypal-note
Jimmy Liow 2 years ago
parent 5ac5c9d223
commit 3fb6b3cd0c

@ -1040,7 +1040,6 @@ ready(el => {
const airportSelect = el('airport_or_railway_station'); const airportSelect = el('airport_or_railway_station');
arriveAtCitySelect.on('change', () => { arriveAtCitySelect.on('change', () => {
const selectedCity = arriveAtCitySelect.options[arriveAtCitySelect.selectedIndex].value; const selectedCity = arriveAtCitySelect.options[arriveAtCitySelect.selectedIndex].value;
console.info('selectedCity: ' + selectedCity);
const airportList = cityAirportMap.get(selectedCity) const airportList = cityAirportMap.get(selectedCity)
airportSelect.options.length = 0; airportSelect.options.length = 0;
airportList.forEach(element => { airportList.forEach(element => {
@ -1111,19 +1110,17 @@ ready(el => {
error_refusal.show(); error_refusal.show();
} }
const today = new Date(); const arrivalDate = new Date(arrivalDateVal);
today.setHours(0, 0, 0, 0); const departureDate = new Date(departureDateVal);
const expiryDate = new Date(expiryDateVal); const expiryDate = new Date(expiryDateVal);
const diffExpiryDate = calcDiffInDays(today, expiryDate); const diffExpiryDate = calcDiffInDays(arrivalDate, expiryDate);
console.log(diffExpiryDate); console.log(diffExpiryDate);
if (isNaN(diffExpiryDate) || diffExpiryDate <= 180) { if (isNaN(diffExpiryDate) || diffExpiryDate <= 90) {
console.log('Your passport must be valid for more than 3 months at the time of entry into China.'); console.log('Your passport must be valid for more than 3 months at the time of entry into China.');
validateSuccess = false; validateSuccess = false;
error_3months.show(); error_3months.show();
} }
const arrivalDate = new Date(arrivalDateVal);
const departureDate = new Date(departureDateVal);
const diffInDays = calcDiffInDays(arrivalDate, departureDate); const diffInDays = calcDiffInDays(arrivalDate, departureDate);
console.log(diffInDays); console.log(diffInDays);
if (isNaN(diffInDays) || diffInDays > 6) { if (isNaN(diffInDays) || diffInDays > 6) {
@ -1147,13 +1144,13 @@ ready(el => {
qualify_144hours.show(); qualify_144hours.show();
} }
if (diffInDays > 0 && diffInDays <= 3) { if (diffInDays > 0 && diffInDays <= 3 && indexOf72 !== -1 && validateSuccess) {
qualify_72hours.show(); qualify_72hours.show();
} else { } else {
qualify_72hours.hide(); qualify_72hours.hide();
} }
if (diffInDays > 3 && diffInDays <= 6) { if (diffInDays > 3 && diffInDays <= 6 && indexOf144 !== -1 && validateSuccess) {
qualify_144hours.show(); qualify_144hours.show();
} else { } else {
qualify_144hours.hide(); qualify_144hours.hide();

Loading…
Cancel
Save