TOPIC:

Calder calculate days 2 weeks 1 day ago #276435

  • Topic Author
  • EEK
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 14
  • Thanks: 0
Hi I have two calenderers a from and until so you would select the day in the from calendar and the day in the Until Calendar is there a way were it will automatically fill in the amount of days in an text field? something like from 05/07/2022 until 10/07/2022 will then be Total days away 5 and can it exclude weekends?

Thanks

Please Log in or Create an account to join the conversation.

Last edit: Post by EEK.

Calder calculate days 2 weeks 1 day ago #276436

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2967
  • Karma: 2
  • Thanks: 150
Hi,

yes, we can do it,

it exclude weekends?

do you mean to exclude weekends in the calculations or do it unselected?

Let me know!

if you have more questions, feel free to ask!


Regards,
Mirko

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.

Calder calculate days 2 weeks 1 day ago #276437

  • Topic Author
  • EEK
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 14
  • Thanks: 0
Yes exclude weekend in the calculations

Please Log in or Create an account to join the conversation.

Calder calculate days 2 weeks 1 day ago #276438

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2967
  • Karma: 2
  • Thanks: 150
Hi,

oke, I'm on that, when I finish this I will back to you

if you have more questions, feel free to ask!


Regards,
Mirko

Please Log in or Create an account to join the conversation.

Calder calculate days 2 weeks 1 day ago #276439

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2967
  • Karma: 2
  • Thanks: 150
Hi,

which format do you use for the calendar?

regards,
Mirko

Please Log in or Create an account to join the conversation.

Calder calculate days 2 weeks 1 day ago #276440

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2967
  • Karma: 2
  • Thanks: 150
hi,


I create one example for you, please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

File Attachment:

File Name: mypck_0015...8-04.zip
File Size:7 KB


You can find code in the init script of the FORM

the code is :
function ff_calcdaysbetween_init()
{

setInterval('calcdays()',500);

} // ff_QuickForm300860205_init


function calcdays(){
var one_day=1000*60*60*24;
var days='';
var weekendDays = 0;
sdate=ff_getElementByName('start').value;
edate=ff_getElementByName('end').value;

start=new Date(ff_getElementByName('start').value);
end=new Date(ff_getElementByName('end').value);

while (start<= end) {
  var dayy = start.getDay();
  if (dayy == 0) {
    weekendDays++;
  }
 start= new Date(+start+ one_day);
}

var rez=weekendDays*2;
sdate = new Date(Number(sdate.split("-")[2]), Number(sdate.split("-")[0])-1, sdate.split("-")[1],0,0,0,0).getTime();
edate = new Date(Number(edate.split("-")[2]), Number(edate.split("-")[0])-1, edate.split("-")[1],0,0,0,0).getTime();

if(edate<sdate){ff_getElementByName('amount_days').value="end date before start date";}

else{
  days=edate-sdate;
 
  day=days/one_day;
  
  ff_getElementByName('amount_days').value=day-rez;

}

}

If you get to stuck, let me know!

Regards,
Mirko
Attachments:

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!