Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap-datepicker manually entered date issue

I'm using this bootstrap-datepicker and everything works fine except the input field doesn't allow to add a date manually or at least it doesn't work properly for manually entered inputs.

Here are the current options in javascript:

$(function(){
        $('.input-daterange').datepicker({
            endDate: "today",
            todayBtn: true,
            forceParse: false,
            autoclose: true,
            todayHighlight: true
        });        
});

1) First issue is when the date is typed and "enter" key is pressed the date is gone. 2) When delete the date and start typing a new date the datepicker acts weird.

Hope someone could figure out how to fix the manually entered date?

Maybe having a calendar icon beside each input and have the datepicker triggered only from there would be a good option and leave the text input only for typing.

Here is the JSFiddle to play with.

like image 472
axidos Avatar asked Sep 11 '14 19:09

axidos


1 Answers

After digging around on the GitHub found a couple of fixes that haven't been implemented in the main bootstrap-datepicker.js file yet. Just thought that it would be helpful for someone experiencing the same issues until the new update comes in:

1) Issue No1: "Enter" key removed the input when entered manually - FIXED

2) Issue No2: In the Date Range option when the second input is being deleted with "Backspace" key the first input is loosing it's last character - FIXED

The above two fixes have to be done in bootstrap-datepicker.js file.

like image 187
axidos Avatar answered Nov 11 '22 03:11

axidos