From 2cd994977b02318b66de132e6dc5c9b9e4b14715 Mon Sep 17 00:00:00 2001 From: pranav nachnekar Date: Fri, 30 Aug 2019 10:49:43 +0530 Subject: [PATCH] Better date validation --- erpnext/www/book-appointment/1.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/www/book-appointment/1.js b/erpnext/www/book-appointment/1.js index d05c2535c1..9f6c487241 100644 --- a/erpnext/www/book-appointment/1.js +++ b/erpnext/www/book-appointment/1.js @@ -1,4 +1,5 @@ +{% include 'erpnext/public/js/date_polyfill.js' %} let holidays = []; {% if holidays %} holidays = {{holidays}} @@ -9,6 +10,16 @@ function next() { if(holidays.includes(date)){ frappe.throw("That day is a holiday") } + if(date === ""){ + frappe.throw("Please select a date") + } let tz = document.getElementsByName('appointment-timezone')[0].value; window.location = `/book-appointment/2?date=${date}&tz=${tz}`; +} + +function ondatechange(){ + let date = document.getElementById('appointment-date') + if(holidays.includes(date.value)){ + frappe.throw("That day is a holiday") + } } \ No newline at end of file