Skip to content

Commit

Permalink
fix: [DHIS2-16801] events scheduled for today's date not showing today (
Browse files Browse the repository at this point in the history
#3856)

* fix: events scheduled for today's date not showing today
  • Loading branch information
alaa-yahia authored Nov 25, 2024
1 parent f68d1cc commit d63e124
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -25,10 +26,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: i18n.t('Today') };
}

if (daysUntilDueDate < 14) {
return { status: statusTypes.SCHEDULE, options: dueDateFromNow };
}
Expand Down

0 comments on commit d63e124

Please sign in to comment.