Home > Software design >  How can I use datetimepicker in Laravel 8?
How can I use datetimepicker in Laravel 8?

Time:03-30

How can I use a datetimepicker knowing that I use bootstrap4 and most of the solutions I found on the internet didn't work well and input type="datetime" feature is no longer supported by most browsers

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" >
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.26.0/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
       

 <input id="id" name="datetime" type="text"   value="">

<script>
$(function () {
             $('.datetimepicker').datetimepicker();
         });
  
      
</script>

CodePudding user response:

instead of deprecated datetime you can use

<input type="datetime-local">

more details you can find on https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local

CodePudding user response:

if you'r looking for better datepicker than basic . I will suggest you to use flatpikr , you can do much more using that like you can pick date between range, format date ,enable or disable certain date, enable or disable given range of date and it has better ui than basic calendar . check out it's examples.

  • Related