Как отключить предыдущие даты во встроенном HTML-календаре - PullRequest
0 голосов
/ 27 мая 2019

Я использовал html, встроенный в календарь, для пользователей, чтобы выбрать дату, на которую они хотели бы забронировать, поскольку теперь пользователи могут бронировать на прошлые даты, что невозможно.Поэтому мне нужно знать, как отключить предыдущие даты в HTML, встроенный в календарь

Java Script

var today = new Date();
var date = today.getDate();
var month = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();




if(date<10)
{
date='0'+date // gets the date
} 

if(month<10)
{
month='0'+month // gets the month 
} 

today = yyyy+'-'+month+'-'+date; // 



document.getElementById("CurrentDate").setAttribute("Today", today);

HTML

<table> 
<tr>
<td>Date of booking:</td>
<td><input id="CurrentDate" type="date" name="bookingday" Today="" 
size="20"  > </td>  <!-- passes over the javacript variables to disable 
bookings on previous dates-->
</tr> 

<script src="calendar.js"></script>


<td colspan="2"><input type="submit" value="Hire Car!"/></td> <!--Submit 
button send user choice to databse  -->
<tr>


<td colspan="2"><input type="reset" value="Clear"/></td> <!-- Reset 
button 
lets user reset what they entered  -->
</tr>
</table>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...