diff --git a/go-app-ussd_popi_rapidpro.js b/go-app-ussd_popi_rapidpro.js index 9976066f..9f2bb51f 100644 --- a/go-app-ussd_popi_rapidpro.js +++ b/go-app-ussd_popi_rapidpro.js @@ -559,7 +559,7 @@ go.app = function() { self.add("state_active_prebirth_check", function(name){ var contact = self.im.user.answers.contact; - var edd = new moment(_.get(contact, "fields.edd", null)).format("DD-MM-YYYY"); + var edd = new moment(self.dateformat(_.get(contact, "fields.edd", null))).format("DD-MM-YYYY"); var prebirth = _.inRange(_.get(contact, "fields.prebirth_messaging"), 1, 7); if (!prebirth) { diff --git a/src/ussd_popi_rapidpro.js b/src/ussd_popi_rapidpro.js index cf671eab..75be8c14 100644 --- a/src/ussd_popi_rapidpro.js +++ b/src/ussd_popi_rapidpro.js @@ -399,7 +399,7 @@ go.app = function() { self.add("state_active_prebirth_check", function(name){ var contact = self.im.user.answers.contact; - var edd = new moment(_.get(contact, "fields.edd", null)).format("DD-MM-YYYY"); + var edd = new moment(self.dateformat(_.get(contact, "fields.edd", null))).format("DD-MM-YYYY"); var prebirth = _.inRange(_.get(contact, "fields.prebirth_messaging"), 1, 7); if (!prebirth) { diff --git a/test/ussd_popi_rapidpro.test.js b/test/ussd_popi_rapidpro.test.js index 050cf269..ac349e71 100644 --- a/test/ussd_popi_rapidpro.test.js +++ b/test/ussd_popi_rapidpro.test.js @@ -563,7 +563,7 @@ describe("ussd_popi_rapidpro app", function() { baby_dob1: "2021-03-10", baby_dob2: "2021-11-11", baby_dob3: "2022-03-07", - edd: "2022-06-06", + edd: "2022-06-06T00:00:00Z", prebirth_messaging: "1" }, })