Magento 2 Datepicker Frontend Guide

Below is a code on how to use datepicker in Magento 2. Copy the code below into your .phtml file and you’re done.

<divclass="field-control ">
<input class="control-text" name="datepicker" id="datepicker" type="text">
</div>

<script type="text/javascript">
require(["jquery", "mage/calendar"], function($){
$('#datepicker').datepicker({
prevText: '&#x3c;&#x3c', prevStatus: '',
prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '',
nextText: 'Vor&#x3e;', nextStatus: '',
nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '',
monthNames: ['January','February','March','April','May','June',
'July','August','September','October','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec'],
dayNames: ['Sunday ','Monday','Tuesday ','Wednesday','Thursday','Friday','Saturday'],
dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
dayNamesMin: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
showMonthAfterYear: false,
dateFormat:'d/m/yy'
});
});
</script>