rahul.m
rahul.m

Reputation: 5854

How to use datepicker as daterangepicker?

I want to use datepicker with predefined values and custom date select same as in daterangepicker

what i have try

 $('#id_date').datepicker({
  autoclose: true,
   ranges: {
        'Today': [moment(), moment()],
        'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
        'Last 7 Days': [moment().subtract(6, 'days'), moment()],
        'Last 30 Days': [moment().subtract(29, 'days'), moment()],
        'This Month': [moment().startOf('month'), moment().endOf('month')],
        'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
      },
});

i have use datepicker plugin this one

Upvotes: 0

Views: 3062

Answers (1)

Jay
Jay

Reputation: 723

jquery datepicker is only for single date piker not for daterange piker try to use daterangepicker plugin for this will work for both single date picker and daterangepicker.

Upvotes: 1

Related Questions