bootstrap-datepicker icon indicating copy to clipboard operation
bootstrap-datepicker copied to clipboard

Can't disable past dates

Open AnthonyIsBlacking opened this issue 5 years ago • 5 comments

Expected behaviour

Disabling all dates prior to today so the client can't choose them

Actual behaviour

Have tried different methods I found on the internet, whether it was using startDate/minDate and different solutions but none of them worked for me, the person is able to choose any date prior to the actual date (ex: 31st Deceber of 2019) stackoverflow1

Datepicker version used

I don't know how to check this, I picked someone's project on a website and I'm building on it

Example code

HTML input <input id="startDate" placeholder="Pick Date" type="date" name="pickup_date" required/>

JS datepicker code `// Home Page 0ne Date Picker JS

    var date = new Date();
    var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
    $('#startDate').datepicker({
        uiLibrary: 'bootstrap4',
        iconsLibrary: 'fontawesome',
        minDate: today,

});`

I've tried different solutions on StackOverflow but none of them worked, a lot of people pointed to this simple solution (https://www.itsolutionstuff.com/post/how-to-disable-previouse-date-bootstrap-datepicker) but it didn't work either, what am I missing here?

AnthonyIsBlacking avatar Jan 19 '21 11:01 AnthonyIsBlacking

the JS is appearing de-formatted for some reason but adding a paragraph made it appear organized and into different lines instead of all appearing in one line of code

AnthonyIsBlacking avatar Jan 19 '21 11:01 AnthonyIsBlacking

Hi, Are you sure you're using this library? by the look of your snippet, it does not, none of the options are supported one.

Azaret avatar Jan 19 '21 17:01 Azaret

Hi, Are you sure you're using this library? by the look of your snippet, it does not, none of the options are supported one.

What do you mean? I don't know, I came across this question (https://github.com/uxsolutions/bootstrap-datepicker/issues/329) and sought out for help because you were behind this feature on bootstrap xD I don't know what to do, how can I check where this is from?

AnthonyIsBlacking avatar Jan 19 '21 20:01 AnthonyIsBlacking

Can someone help me?

By your docs (https://bootstrap-datepicker.readthedocs.io/en/stable/) it has the same commands as I'm trying to execute on JavaScript, I don't understand

AnthonyIsBlacking avatar Jan 25 '21 14:01 AnthonyIsBlacking

maybe because you are using minDate instead of startDate

suryapratap avatar Jun 05 '23 18:06 suryapratap