Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

single and predefined ranges did not work togther #69

Open
karim20160300 opened this issue Oct 27, 2021 · 1 comment
Open

single and predefined ranges did not work togther #69

karim20160300 opened this issue Oct 27, 2021 · 1 comment

Comments

@karim20160300
Copy link

$(".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');

  
}

});

@Yashir68
Copy link

Hi Karim, have you got the issue solved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants