Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Date Range Picker -> Single Date Picker: How to set a Date

I'm experimenting with Boootstrap Date Range Picker

Whats the best way to set Date into a Single Date Picker via Javascript?

Single Date Picker initialization code

$(#date).daterangepicker({
    locale: {
          format: 'DD/MM/YYYY',
    },
    singleDatePicker: true,
    showDropdowns: true
});

I tried with below code:

$("date").data('daterangepicker').setStartDate(data.startDate);

This way, I'm getting below output, which is not really acceptable!!! enter image description here

Hope someone come up with a nice solution.

Cheers!!

like image 366
Navas Basheer Avatar asked Dec 07 '25 15:12

Navas Basheer


1 Answers

Try

$("date").data('daterangepicker').setStartDate(data.startDate);
$("date").data('daterangepicker').setEndDate(data.startDate);

That is the only way I can find so far.

like image 120
Roy Chan Avatar answered Dec 10 '25 17:12

Roy Chan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!