mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-07 06:14:24 +00:00
5cbb419f24
Ref 343c265172
54 lines
1.3 KiB
HTML
54 lines
1.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>jQuery UI Datepicker - Select a Date Range</title>
|
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
|
<link rel="stylesheet" href="../demos.css">
|
|
<script src="../../external/requirejs/require.js"></script>
|
|
<script src="../bootstrap.js">
|
|
var dateFormat = "mm/dd/yy",
|
|
from = $( "#from" )
|
|
.datepicker({
|
|
defaultDate: "+1w",
|
|
changeMonth: true,
|
|
numberOfMonths: 3
|
|
})
|
|
.on( "change", function() {
|
|
to.datepicker( "option", "minDate", getDate( this ) );
|
|
}),
|
|
to = $( "#to" ).datepicker({
|
|
defaultDate: "+1w",
|
|
changeMonth: true,
|
|
numberOfMonths: 3
|
|
})
|
|
.on( "change", function() {
|
|
from.datepicker( "option", "maxDate", getDate( this ) );
|
|
});
|
|
|
|
function getDate( element ) {
|
|
var date;
|
|
try {
|
|
date = $.datepicker.parseDate( dateFormat, element.value );
|
|
} catch( error ) {
|
|
date = null;
|
|
}
|
|
|
|
return date;
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<label for="from">From</label>
|
|
<input type="text" id="from" name="from"/>
|
|
<label for="to">to</label>
|
|
<input type="text" id="to" name="to"/>
|
|
|
|
<div class="demo-description">
|
|
<p>Select the date range to search for.</p>
|
|
</div>
|
|
</body>
|
|
</html>
|