• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Days counting between two Days

Days counting between two Days 9 years 11 months ago #31194

  • Isengo
  • Isengo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 2
Hey Folks,
I know there is a post about it. But it won´t work for me somehow - www.rsjoomla.com/support/view-article/91...-calendar-dates.html

I changed all the var´s and ID´s as explained. But when I choose the two dates it always gives me back 0.
function calculateDate(date1, date2){
//our custom function with two parameters, each for a selected date
 
  diffc = date1.getTime() - date2.getTime();
  //getTime() function used to convert a date into milliseconds. This is needed in order to perform calculations.
 
  days = Math.round(Math.abs(diffc/(1000*60*60*24)));
  //this is the actual equation that calculates the number of days.
 
return days;
}
 
function rsfp_onSelectDate(date, type, args, calendar){
//RSForm!Pro specific calendar function.
//args = object, containing the date in the exact format needed for the above getTime() function.
//calendar = object, containing various properties of the calendar.
 
argsstr = String(args);
spldate = argsstr.split(",");
date1 = new Date(spldate[0],spldate[1]-1,spldate[2]);
//the selected date converted into proper format for calculations
 
date2 = '';
 
if(calendar.myid == 'cal5_0' && RSFormProCalendars[5]['datum1'].getSelectedDates() != '')
  date2 = new Date(RSFormProCalendars[5]['datum1'].getSelectedDates());
 
if(calendar.myid == 'cal5_1' && RSFormProCalendars[5]['datum0'].getSelectedDates() != '')
  date2 = new Date(RSFormProCalendars[5]['datum0'].getSelectedDates());
 
//the above if clauses, check from which of the two calendars the selection was made and assigns the ending date
//only when both dates are selected.
 
 
if(date2 != ''){
//the calculation will be done when the dates are selected.
  days = calculateDate(date1, date2);
 
  document.getElementById('anztage').value = days;
  //this will assign the days difference value to our textbox.
}
 
return true;
}


ID = 5 , anztage/datum0,datum1 etc.

Any Ideas?


Me Dumbshit - swapped datum1 with datum0 - Sorry. You can close.
Last Edit: 9 years 11 months ago by Isengo.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!