Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap datepicker pop-up not shown the highlighted current date

I am using Bootstrap datepicker by using Bootstrap-datepicker API. When I click the button the calendar/datepicker pop-up shown but it didn't mark the current date as Blue font as shown in API examples.

I am using the below code:

   <body>
   <div class="input-group date col-md-5" id="datepicker" data-date-format="dd-mm-yyyy">
        <input class="form-control" size="56" type="text" value="" readonly>
        <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
   </div>

    <script src="js/bootstrap-datepicker.js"></script>

    <script type="text/javascript">
        $('#datepicker').datepicker();
    </script>
    </body>

The calendar/datepicker pop-up shown but the current date is not highlighted as blue as shown in API Examples and also the mouse cursor is not pointer.

Please help me regarding this issue

like image 501
Adeel Asghar Avatar asked Feb 09 '14 16:02

Adeel Asghar


People also ask

How can I get current date in datepicker?

To set current date in control to which jQuery UI datepicker bind, use setDate() method. Pass date object which needs to be set as an argument to setDate() method. If you want to set it to current date then you can pass 'today' as argument.

How do I know if my datepicker is loaded?

You can check to see if the datepicker script has loaded using: if ($. fn. datepicker) { // ... }

How do I change the default date format in bootstrap datepicker?

In order to set the date format, we only need to add format of one argument and then we will add our required format, which is shown in the following example: Example 1: In this example, we are going to use dd-mm-yyyy format.


2 Answers

If you are using this : https://github.com/eternicode/bootstrap-datepicker you have to give options when you initiate calendar, such as

   $('#sandbox-container input').datepicker({ 
               todayHighlight: true
   });
like image 63
Gokhan Demirhan Avatar answered Sep 18 '22 18:09

Gokhan Demirhan


$('#datepicker').datepicker({
    format: 'dd-mm-yyyy',
    todayHighlight: true
});

Here is the JSFiddle

like image 32
RaviRokkam Avatar answered Sep 19 '22 18:09

RaviRokkam