bootstrap-datepicker manually entered date issue

axidos picture axidos · Sep 11, 2014 · Viewed 8k times · Source

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.

Answer

axidos picture axidos · Sep 12, 2014

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.