Page 3 of 5

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 4:10 pm
by joecocs
after several hours of research with the console, I don't see a problem.

On the other hand by delving a little I found in the nudebug results errors every time I navigate in the forms and that this queries the database

In nudebug results i've this :
===USER==========

globeadmin

===PDO MESSAGE===

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE 1' at line 2

===SQL===========

SELECT
WHERE 1

===BACK TRACE====

/volume1/web/ISEA/nuform.php - line 350 (nuRunQuery)

/volume1/web/ISEA/nuform.php - line 331 (nuBrowseTotals)

/volume1/web/ISEA/nuapi.php - line 42 (nuGetFormObject)
Can it have a consequence?

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 4:29 pm
by kev1n
Did you translate the months names to French? Could use set the language to English for globeadmin, log in again and see if the onchange event is triggered?

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 4:51 pm
by joecocs
I'm sorry but nothing more, I still have the error of illegal caracters.

on the other hand after having browsed several forums,

you are sure on the syntax of the onchange code,

notably the quotes “ “ ?

Code: Select all

dureeprojets(“Date_Debut_Projets“,“Date_Fin_Projets“);

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 5:01 pm
by kev1n
Now I see the error. Replace your double quotes ( “ ) with ( " ) or with single quotes ( ' )

Code: Select all

dureeprojets("Date_Debut_Projets","Date_Fin_Projets");

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 5:08 pm
by joecocs
YESSSSSSSSSS !

Thank's

How do we make this symbol (")

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 5:11 pm
by joecocs
YESSSSSSSSSS !

Thank's

How do we make this symbol (")

on the other hand the result is not saved in the fields ??? :?:

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 5:13 pm
by kev1n
No idea, because I'm not using a frech keyboard. But you can use single quotes as well ( ' )

You need to add a .change();

Code: Select all

 $('#Duree_Projets').val(subtractDateFields(f1,f2)).change();

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 5:43 pm
by joecocs
for my understanding, what the element corresponds to: 2e3 in the code :

Code: Select all

return Math.round(timeDiff / (2e3 * 3600 * 365.25));

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 6:40 pm
by kev1n
It's called scientific notation. 2e3 is the same as 2 x 10^3, which is 2000

Re: How to subtract dates to calculate nights

Posted: Mon Feb 24, 2020 6:50 pm
by joecocs
Yes I know the notation

but it is to calculate what.

the calculation of 'diffTime is in milliseconds,
3600 for the hours and
365.25 for the year
but 2e3?