daterangepicker icon indicating copy to clipboard operation
daterangepicker copied to clipboard

single and predefined ranges did not work togther

Open karim20160300 opened this issue 3 years ago • 1 comments

$(".daterangepicker-field").daterangepicker({ forceUpdate: false, orientation: 'left',

periods: ['month', 'quarter', 'year'],
ranges: {
    'Last 30 days': [moment().subtract(29, 'days'), moment()],
    'Last 90 days': [moment().subtract(89, 'days'), moment()],
    'Last Year': [moment().subtract(1, 'year').add(1,'day'), moment()],
    // 'All Time': 'all-time' // [minDate, maxDate]
    // 'Custom Range': 'custom'
    },
    single: true,
callback: function(startDate, endDate, period){
  var title = startDate.format('YYYY-MM-DD') + ' / ' + endDate.format('YYYY-MM-DD');
  $(this).val(title);
  document.getElementById('date_from').value = startDate.format('YYYY-MM-DD');
  document.getElementById('date_to').value = endDate.format('YYYY-MM-DD');

  
}

});

karim20160300 avatar Oct 27 '21 11:10 karim20160300

Hi Karim, have you got the issue solved

Yashir68 avatar Aug 19 '22 03:08 Yashir68