Skip to content

Instantly share code, notes, and snippets.

@yszk0123
Last active March 31, 2016 03:40
Show Gist options
  • Save yszk0123/c07107a1138534519cb9 to your computer and use it in GitHub Desktop.
Save yszk0123/c07107a1138534519cb9 to your computer and use it in GitHub Desktop.
Pikaday Example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Pikaday Example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment-with-locales.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.4.0/pikaday.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.4.0/css/pikaday.min.css">
</head>
<body>
<input type="text" id="datepicker" value="2016">
<script>
moment.locale('ja');
var picker = new Pikaday({
i18n: {
previousMonth: 'Previous Month',
nextMonth: 'Next Month',
months: moment.months(),
weekdays: moment.weekdays(),
weekdaysShort: moment.weekdaysShort()
},
minDate: moment().add(3, 'day').toDate(),
maxDate: moment().add(50, 'day').toDate(),
defaultDate: moment().add(5, 'day').toDate(),
setDefaultDate: true,
showMonthAfterYear: true,
field: document.getElementById('datepicker'),
format: 'YYYY MMMM D',
onSelect: function() {
/* something */
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment