-
Window Start
+
+
+
+
+ Start
+
+
+
+
+ End
+
-
-
@@ -96,10 +161,13 @@
Window End
const form = document.querySelector("form");
const notEligiblePanel = document.getElementById("not-eligible");
- const outputPanel = document.getElementById("output");
+ const screeningWindowPanel = document.getElementById("screening-window");
- const windowStartBox = document.getElementById("window_start");
- const windowEndBox = document.getElementById("window_end");
+ const windowStartDate = document.getElementById("window_start_date");
+ const windowStartDays = document.getElementById("window_start_days");
+
+ const windowEndDate = document.getElementById("window_end_date");
+ const windowEndDays = document.getElementById("window_end_days");
function getIntValue(id) {
return parseInt(document.getElementById(id).value, 10);
@@ -143,7 +211,7 @@
Window End
function updateOutput() {
notEligiblePanel.style.display = 'none';
- outputPanel.style.display = 'none';
+ screeningWindowPanel.style.display = 'none';
if(form.checkValidity()) {
const gestationalAgeWeeks = getIntValue("gestational_age_weeks");
@@ -156,7 +224,7 @@
Window End
const gestationalAge = (gestationalAgeWeeks * 7) + gestationalAgeDays;
if(isEligible(gestationalAge, birthWeight)) {
- outputPanel.style.display = 'block';
+ screeningWindowPanel.style.display = 'block';
const { start, end } = calculateWindow(gestationalAge, dateOfBirth);
@@ -167,9 +235,11 @@
Window End
const endDate = end.toLocaleString(luxon.DateTime.DATE_SHORT);
const endDaysFromBirth = end.diff(dateOfBirth, 'days').days;
+ windowStartDate.innerHTML = startDate;
+ windowStartDays.innerHTML = `${startDaysFromBirth} days from birth`;
- windowStartBox.innerHTML = `${startDate} (${startDaysFromBirth} days from birth)`;
- windowEndBox.innerHTML = `${endDate} (${endDaysFromBirth} days from birth)`;
+ windowEndDate.innerHTML = endDate;
+ windowEndDays.innerHTML = `${endDaysFromBirth} days from birth`;
} else {
notEligiblePanel.style.display = 'block';
}