Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [DHIS2-16801] events scheduled for today's date not showing today #3856

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading