TEMA:

Calder calculate days 7 meses 3 semanas antes #276435

  • Autor del tema
  • EEK
  • Fuera de línea
  • Navegador Iniciado
  • Navegador Iniciado
  • Registered
  • Mensajes: 14
  • Gracias recibidas: 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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by EEK.

Calder calculate days 7 meses 3 semanas antes #276436

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Navegador Platino
  • Navegador Platino
  • Registered
  • Mensajes: 3262
  • Gracias recibidas: 163
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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by Mirec.

Calder calculate days 7 meses 3 semanas antes #276437

  • Autor del tema
  • EEK
  • Fuera de línea
  • Navegador Iniciado
  • Navegador Iniciado
  • Registered
  • Mensajes: 14
  • Gracias recibidas: 0
Yes exclude weekend in the calculations

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Calder calculate days 7 meses 3 semanas antes #276438

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Navegador Platino
  • Navegador Platino
  • Registered
  • Mensajes: 3262
  • Gracias recibidas: 163
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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Calder calculate days 7 meses 3 semanas antes #276439

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Navegador Platino
  • Navegador Platino
  • Registered
  • Mensajes: 3262
  • Gracias recibidas: 163
Hi,

which format do you use for the calendar?

regards,
Mirko

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Calder calculate days 7 meses 3 semanas antes #276440

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Navegador Platino
  • Navegador Platino
  • Registered
  • Mensajes: 3262
  • Gracias recibidas: 163
hi,


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

Archivo Adjunto:

Nombre del Archivo: mypck_0015...8-04.zip
Tamaño del Archivo: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
Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
  • 2
Moderadores: ForumSupport
Tiempo de carga de la página: 0.064 segundos

Live Support Chat Opened!

Join our Discord chat here and enter the Crosstec channels to receive live support and talk directly to the team!