Forums

Counting days from Date_Range_Picker

SPABO 31 Oct, 2013
Hi Bob,
Happy with the Date_Range_Picker, using your script (and FAQ)

But how do I get the totals days from this script?
<?php
JHTML::_('behavior.mootools');
$picker_array = array(
  'Picker.js',
  'Picker.Attach.js',
  'Picker.Date.js',
  'Picker.Date.Range.js',
  'Locale.nl-NL.DatePicker.js'
);
$doc =& JFactory::getDocument();
foreach ( $picker_array as $v ) {
  $doc->addScript(JURI::base().'components/com_chronoforms/js/datepicker_moo/'.$v);
}
$doc->addStyleSheet(JURI::base().'components/com_chronoforms/js/datepicker_moo/datepicker.css');
$doc->addStyleDeclaration("
.datepicker tr, .datepicker td {
  border:none;
}
");
?>
var dp, date_range;
window.addEvent('domready', function() {
  date_range = $('date_range');
  dp = new Picker.Date.Range(date_range, {
    pickerClass: 'datepicker',
    columns: 2,
    minDate: new Date()
  });
});


Any thoughts on this?
GreyHead 01 Nov, 2013
Hi SPABO,

You can add a function to the Picker's OnSelect event that will do a calculation:
  dp = new Picker.Date.Range(date_range, {
    pickerClass: 'datepicker',
    columns: 2,
    minDate: new Date(),
    onSelect: function(date) {
      //some calculate function here
    }    
  });

The datepicker documents are here

Bob
SPABO 01 Nov, 2013
Beat me ....sorry, but it does not ring a bell or whatever......
SPABO 02 Nov, 2013
Bob,
Struggling what you mean by

You can add a function to the Picker's OnSelect event


What/where can we find a Picker's OnSelect event?

Next to this:
I cannot find the code for the startdate and enddate, so..how should i be able to calculate??
GreyHead 05 Nov, 2013
Hi SPABO,

the code would go where I put //some calculate function here in my earlier post.

I'm not sure how to get the date values without going back to the DatePicker documents and building an example.

Bob
This topic is locked and no more replies can be posted.