- CommsLog.git
- docs
- Pikaday
- examples
- pick-whole-week.html
This file ( 2kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title>Pikaday - pickWholeWeek example</title>
<meta name="author" content="Lei Zhao">
<link rel="stylesheet" href="../css/pikaday.css">
<link rel="stylesheet" href="../css/site.css">
</head>
<body>
<a href="https://github.com/Pikaday/Pikaday"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
<h1>Pikaday - pickWholeWeek example</h1>
<p class="large">A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS.</p>
<label for="datepicker">Date:</label>
<br>
<input type="text" id="datepicker">
<h2>What is this?</h2>
<p>Since version 1.0 Pikaday is a stable and battle tested date-picker. Feel free to use it however you like but please report any bugs or feature requests to the <a href="https://github.com/Pikaday/Pikaday/issues">GitHub issue tracker</a>, thanks!</p>
<p class="small">Copyright © 2014 <a href="https://dbushell.com/">David Bushell</a> | BSD & MIT license | Example by <a href="https://github.com/leizhao4">Lei Zhao</a></p>
<script src="../pikaday.js"></script>
<script>
var field = document.getElementById('datepicker');
var picker = new Pikaday({
field: field,
pickWholeWeek: true,
onSelect: function (date) {
var sundayDate = date.getDate() - date.getDay();
var sunday = new Date(date.setDate(sundayDate));
var saturday = new Date(date.setDate(sundayDate + 6));
field.value = sunday.toLocaleDateString() + ' - ' + saturday.toLocaleDateString();
}
});
</script>
</body>
</html>