Skip to content

Commit

Permalink
feat: surface time in the enroll-by date column
Browse files Browse the repository at this point in the history
  • Loading branch information
brobro10000 committed Sep 18, 2024
1 parent 6c82806 commit ec55218
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import PropTypes from 'prop-types';
import {
Icon, IconButtonWithTooltip, Stack,
} from '@openedx/paragon';
import { Icon, IconButtonWithTooltip, Stack } from '@openedx/paragon';
import { Warning } from '@openedx/paragon/icons';
import { defineMessages, useIntl } from '@edx/frontend-platform/i18n';
import { ENROLL_BY_DATE_DAYS_THRESHOLD, formatDate } from './data';
import { DATETIME_FORMAT, ENROLL_BY_DATE_DAYS_THRESHOLD, formatDate } from './data';
import { isTodayWithinDateThreshold } from '../../utils';

const messages = defineMessages({
Expand Down Expand Up @@ -33,7 +31,7 @@ const ExpiringIconButtonWithTooltip = () => {
const AssignmentEnrollByDateCell = ({ row }) => {
const { original: { earliestPossibleExpiration: { date } } } = row;

const formattedEnrollByDate = formatDate(date);
const formattedEnrollByDate = formatDate(date, DATETIME_FORMAT);
const isAssignmentExpiringSoon = isTodayWithinDateThreshold({
days: ENROLL_BY_DATE_DAYS_THRESHOLD,
date,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import React from 'react';
import {
Stack,
Icon,
IconButtonWithTooltip,
} from '@openedx/paragon';
import { Icon, IconButtonWithTooltip, Stack } from '@openedx/paragon';
import { InfoOutline } from '@openedx/paragon/icons';
import { defineMessages, useIntl } from '@edx/frontend-platform/i18n';

Expand All @@ -15,7 +11,7 @@ const messages = defineMessages({
},
headerTooltipContent: {
id: 'lcm.budget.detail.page.assignments.table.columns.enroll-by-date.header.tooltip-content',
defaultMessage: 'Failure to enroll by midnight of enrollment deadline date will release funds back into the budget',
defaultMessage: 'Failure to enroll by the enrollment deadline date will release funds back into the budget',
description: 'On hover tool tip message for the enroll-by date column',
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/learner-credit-management/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const NO_BALANCE_REMAINING_DOLLAR_THRESHOLD = 100;

export const DATE_FORMAT = 'MMMM DD, YYYY';

export const SHORT_MONTH_DATE_FORMAT = 'MMM DD, YYYY';
export const SHORT_MONTH_DATE_FORMAT = 'MMM D, YYYY';
export const DATETIME_FORMAT = 'MMM D, YYYY h:mma';

export const EXEC_ED_OFFER_TYPE = 'learner_credit';
Expand Down
4 changes: 2 additions & 2 deletions src/components/learner-credit-management/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ export const orderBudgets = (intl, budgets) => {
* @param {string} date Date string.
* @returns Formatted date string.
*/
export function formatDate(date) {
return dayjs(date).format('MMM D, YYYY');
export function formatDate(date, format = 'MMM D, YYYY') {
return dayjs(date).format(format);
}

// Exec ed and open courses cards should display either the enrollment deadline
Expand Down

0 comments on commit ec55218

Please sign in to comment.