diff --git a/app/routes/record-vaccinations.js b/app/routes/record-vaccinations.js index 5c2642e1..4769fab1 100644 --- a/app/routes/record-vaccinations.js +++ b/app/routes/record-vaccinations.js @@ -635,6 +635,10 @@ module.exports = router => { const data = req.session.data const pregnancyDueDate = dateFromYearMonthDay(data.pregnancyDueDate?.year, data.pregnancyDueDate?.month, data.pregnancyDueDate?.day) + if (!pregnancyDueDate) { + return res.render('record-vaccinations/rsv/not-yet-28-weeks-pregnant-warning') + } + // Vaccination date is today const vaccinationDate = new Date() @@ -656,6 +660,10 @@ module.exports = router => { const data = req.session.data const pregnancyDueDate = dateFromYearMonthDay(data.pregnancyDueDate?.year, data.pregnancyDueDate?.month, data.pregnancyDueDate?.day) + if (!pregnancyDueDate) { + return res.render('record-vaccinations/pertussis/not-yet-16-weeks-pregnant-warning') + } + // Vaccination date is today const vaccinationDate = new Date() diff --git a/app/views/record-vaccinations/pertussis/not-yet-16-weeks-pregnant-warning.html b/app/views/record-vaccinations/pertussis/not-yet-16-weeks-pregnant-warning.html index a2f1968d..4e02ec42 100644 --- a/app/views/record-vaccinations/pertussis/not-yet-16-weeks-pregnant-warning.html +++ b/app/views/record-vaccinations/pertussis/not-yet-16-weeks-pregnant-warning.html @@ -19,19 +19,18 @@ {% endif %} {% set panelHtml %} - {% set randomWeeks = (range(1, 15) | random) %}

{{ displayName }} is {% if fullWeeksPregnant is defined and fullWeeksPregnant is not none %} {{ fullWeeksPregnant | plural("week") }} {% else %} - {{ randomWeeks }} week{{ 's' if randomWeeks > 1 }} + 13 weeks {% endif %} {% if remainderDaysPregnant is defined and remainderDaysPregnant > 0 %} and {{ remainderDaysPregnant | plural("day") }}{% endif %} pregnant.

The pertussis vaccine is recommended between 16 and 32 weeks of pregnancy.

-

UKHSA guidance on pertussis vaccination of pregnant women (opens in new tab).

+

Check before going ahead or refer to a prescriber for a patient specific direction (PSD).

{{ button({ "text": "Continue anyway", @@ -49,4 +48,3 @@ {% endblock %} - diff --git a/app/views/record-vaccinations/rsv/not-yet-28-weeks-pregnant-warning.html b/app/views/record-vaccinations/rsv/not-yet-28-weeks-pregnant-warning.html index ddd77b5b..fbb55670 100644 --- a/app/views/record-vaccinations/rsv/not-yet-28-weeks-pregnant-warning.html +++ b/app/views/record-vaccinations/rsv/not-yet-28-weeks-pregnant-warning.html @@ -19,20 +19,19 @@ {% endif %} {% set panelHtml %} - {% set randomWeeks = (range(1, 27) | random) %}

{{ displayName }} is {% if fullWeeksPregnant is defined and fullWeeksPregnant is not none %} {{ fullWeeksPregnant | plural("week") }} {% else %} - {{ randomWeeks }} week{{ 's' if randomWeeks > 1 }} + 13 weeks {% endif %} {% if remainderDaysPregnant is defined and remainderDaysPregnant > 0 %} and {{ remainderDaysPregnant | plural("day") }}{% endif %} pregnant.

The RSV vaccine is not routinely recommended before 28 weeks of pregnancy.

-

UKHSA guidance on RSV vaccination of pregnant women (opens in new tab).

+

Check before going ahead or refer to a prescriber for a patient specific direction (PSD).

{{ button({ "text": "Continue anyway", @@ -50,4 +49,3 @@ {% endblock %} -