From d76a0472e18ec8de4ab4aa9ba9d268d6c832a460 Mon Sep 17 00:00:00 2001 From: Mudiwa Matanda Date: Mon, 28 Oct 2024 09:34:12 +0200 Subject: [PATCH] updated isBetween function to work better --- src/ussd_clinic_rapidpro.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ussd_clinic_rapidpro.js b/src/ussd_clinic_rapidpro.js index 4142c938..2518bd88 100644 --- a/src/ussd_clinic_rapidpro.js +++ b/src/ussd_clinic_rapidpro.js @@ -650,7 +650,7 @@ go.app = function() { "Enter the day that baby was born as a number. For example if baby was born on 12th May, type in 12" ].join("\n")); } - if (!date.isBetween(current_date.clone().add(-2, "years")) && (!date.isSame(current_date, date)) ) { + if (!date.isBetween(current_date.clone().add(-2, "years"), current_date.add(1, "days")) ) { return $( "Unfortunately MomConnect doesn't send messages to children older " + "than 2 years. Please try again by entering the day the baby was " +