Nerian/bootstrap-datepicker-rails

Datepicker startDate / endDate is not working

Deimos620 opened this issue · 6 comments

I am using recent version of bootstrap-datepicker-rails (https://github.com/eternicode/bootstrap-datepicker version 1.6.4). I am trying to set startdate / enddate , not working.
Here is my code.
var startDate = "1987-07-01";
var endDate = "1991-10-06";
$(".datepicker").datepicker({
format: 'yyyy-mm-dd',
startDate: startDate,
endDate: endDate
});

But this is not working for me, always keep starting from current date.
I've googled and tried several solutions , they aren't working for me.
Would you like to provide solution to help me?

What's is the HTML fro that component? Is there any errors in the console?

https://bootstrap-datepicker.readthedocs.io/en/stable/options.html#format

I don't have any error in console.
Here is html code. I've used Rails erb / helper.
<%= f.text_field :birthday, class: 'form-control datepicker' ``%>
It is compiled to :
<input class="form-control datepicker" type="text" name="profile[birthday]" id="profile_birthday">

Mmm, I don't why would this fail. It seems correct to me.

Try using the format 'mm/dd/yyyy' and change the data accordingly. Let's see if the datepicker is getting the data at all.

Unfortunately, It doesn't work for me.
I changed the format 'mm/dd/yyyy'. Then, the picked date format is changed correctly , but startdate / enddate is not working , too.
I see , bootstrap-datepicker-rails is using https://github.com/uxsolutions/bootstrap-datepicker for bootstrap datepicker javascript library. What I can't understand is its demo is not working too.
Please visit here:
https://uxsolutions.github.io/bootstrap-datepicker

Indeed, the demo is not working. Perhaps the version 1.7, which is what is being used in that demo, is broken.

Personally I am using https://github.com/zpaulovics/datetimepicker-rails in my new projects. It integrates with simpleform quite nicely.

Thanks. I will move to it. Closing issue.