Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Blok tanggal sebelum hari ini
Biar input type date tidak membolehkan select hari sebelum hari ini (kemarin dan kebelakangnya) itu gimana ya ?
2 Jawaban:
Coba ini gan:
var pilihHari = '2012-11-03';
if( (new Date().getTime() > new Date(pilihHari).getTime()))
{
//Tidak Boleh Select
} else {
//Boleh Select
}
source: [link]https://stackoverflow.com/questions/11170054/compare-dates-with-javascript [/link] https://stackoverflow.com/questions/338463/how-do-i-do-a-date-comparison-in-javascript https://www.c-sharpcorner.com/UploadFile/8911c4/how-to-compare-two-dates-using-javascript/
pake datepicker jquery? coba pake ini
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#datepicker" ).datepicker(
{minDate: new Date(),}
);
} );
</script>
</head>
<body>
<form id="form" method="post">
<input type="text" name="tgl" id="datepicker">
</form>
</body>
</html>