From e7d852f7dbe51b40e275fd18103f547851f94989 Mon Sep 17 00:00:00 2001 From: alaa-yahia Date: Wed, 23 Oct 2024 13:23:09 +0300 Subject: [PATCH 1/2] fix: events scheduled for today's date not showing today --- .../Stages/Stage/StageDetail/hooks/helpers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js index 74ae039f19..aaa2781d78 100644 --- a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js +++ b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js @@ -25,10 +25,14 @@ const getEventStatus = (event: ApiEnrollmentEvent) => { } if (event.status === statusTypes.SCHEDULE) { - if (!event.scheduledAt || !daysUntilDueDate) { + if (!event.scheduledAt) { return { status: statusTypes.SCHEDULE, options: undefined }; } + if (daysUntilDueDate === 0) { + return { status: statusTypes.SCHEDULE, options: 'today' }; + } + if (daysUntilDueDate < 14) { return { status: statusTypes.SCHEDULE, options: dueDateFromNow }; } From 5e0589141d2ed7f7537afdb548392c3e54343cb5 Mon Sep 17 00:00:00 2001 From: alaa-yahia Date: Fri, 25 Oct 2024 01:24:45 +0300 Subject: [PATCH 2/2] fix: add missing localization for 'Today' --- .../Stages/Stage/StageDetail/hooks/helpers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js index aaa2781d78..9d7f31f63f 100644 --- a/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js +++ b/src/core_modules/capture-core/components/WidgetStagesAndEvents/Stages/Stage/StageDetail/hooks/helpers.js @@ -1,6 +1,7 @@ // @flow import React from 'react'; import moment from 'moment'; +import i18n from '@dhis2/d2-i18n'; import { statusTypes, translatedStatusTypes } from 'capture-core/events/statusTypes'; import { convertMomentToDateFormatString } from '../../../../../../utils/converters/date'; import { getSubValues } from '../../getEventDataWithSubValue'; @@ -30,7 +31,7 @@ const getEventStatus = (event: ApiEnrollmentEvent) => { } if (daysUntilDueDate === 0) { - return { status: statusTypes.SCHEDULE, options: 'today' }; + return { status: statusTypes.SCHEDULE, options: i18n.t('Today') }; } if (daysUntilDueDate < 14) {