arrondis
[auf_rh_dae.git] / project / media / js / dae.js
CommitLineData
f87fe1a1
OL
1/* string to float */
2function clean_float(value){
86f1e48d 3 if (isNaN(value) || value == undefined)
f87fe1a1
OL
4 output = 0;
5 else
6 output = parseFloat(value);
7 output = Math.round(output*100)/100;
d1ca1d61 8 return parseInt(output);
f87fe1a1 9}
72db8238
OL
10
11/* stocker le texte par défaut à afficher */
12var note_duree_indeterminee = "";
13
14function contrat_mois() {
15 if (note_duree_indeterminee == "")
16 note_duree_indeterminee = $("#note-duree").html();
17 var debut = $("#id_date_debut, #id_contrat_date_debut").val();
18 var fin = $("#id_date_fin, #id_contrat_date_fin").val();
19 if (debut == "" || fin == "")
20 note = note_duree_indeterminee;
21 else {
22 var d1 = new Date(debut);
23 var d2 = new Date(fin);
24 var duree = Math.round((d2-d1) / (1000*60*60*24) / (365/12));
25 note = duree + " mois";
26 }
27 $("#note-duree").html(note);
28}
29