"Datepicker"
Bootstrap 4.1.1 Snippet by vivekbisht109

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" /> <form class="col-md-4 offset-md-4 mt-5"> <form class="mr-3 ml-3"> <input type="text" class="form-control custom_field daterange" value="Jan, 2020 - Dec, 2020"> </form> </div> <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script> <script> $('.daterange').daterangepicker({ "showDropdowns": true, "maxSpan": { "days": 7 }, ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] }, "alwaysShowCalendars": true, "startDate": "04/27/2022", "endDate": "05/03/2022" }, function(start, end, label) { console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); }); </script> <form class="col-md-4 offset-md-4 mt-5"> <form class="mr-3 ml-3"> <input type="text" name="birthday" class="form-control custom_field daterange" value="10/24/1984" /> </form> </div> <script> $(function() { $('input[name="birthday"]').daterangepicker({ singleDatePicker: true, showDropdowns: true, minYear: 1901, maxYear: parseInt(moment().format('YYYY'),10) }, function(start, end, label) { var years = moment().diff(start, 'years'); alert("You are " + years + " years old!"); }); }); </script>
.applyBtn { background-color: #630072; border: 1px solid #33013b; } .daterangepicker td.in-range { background-color: #f0cff5 !important; } .daterangepicker td.active, .daterangepicker td.active:hover { background-color: #630072 !important; } /* http://www.daterangepicker.com/ */

Related: See More


Questions / Comments: