Copy link to clipboard
Copied
Help please
if I need to calculate the gestational age in a certain date (any date)
how do I do please ?
I have 2 feilds
the first "DG" date of conception
the second "age" the date at which i want to calcule the gestational age in weeks and days
this my script (try67 helped me in this script) but this script is for the today date :
var dateFormat = "dd/mm/yyyy"; var startDateString = this.getField("DG").valueAsString; event.value = ""; if (startDateString!="") { var startDate = util.scand(dateFormat, startDateString); if (startDate!=null) { var now = new Date(); var dayInMs = 86400000; var diff = Math.round((now.getTime()-startDate.getTime())/dayInMs); var diffInWeeks = Math.floor(diff/7); var diffInDays = diff-(diffInWeeks*7); event.value = diffInWeeks + " SA " + diffInDays + " jours"; } }
please help me
Copy link to clipboard
Copied