Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav committed Aug 14, 2024
1 parent cdff632 commit 23b709c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions frontend/public/src/components/EnrolledItemCard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global SETTINGS:false */
import React from "react"
import moment from "moment"
import {parseDateString, formatPrettyDateTimeAmPmTz, formatPrettyDate} from "../lib/util"
import {parseDateString, formatPrettyDateTimeAmPmTz, formatPrettyShortDate, formatPrettyMonthDate} from "../lib/util"
import { Formik, Form, Field } from "formik"
import {
Dropdown,
Expand Down Expand Up @@ -35,6 +35,7 @@ import GetCertificateButton from "./GetCertificateButton"
import {
isFinancialAssistanceAvailable,
isLinkableCourseRun,
getStartDate,
courseRunStatusMessage
} from "../lib/courseApi"
import { isSuccessResponse } from "../lib/util"
Expand Down Expand Up @@ -447,7 +448,7 @@ export class EnrolledItemCard extends React.Component<
const menuTitle = `Course options for ${enrollment.run.course.title}`

const courseRunStatusMessageText = courseRunStatusMessage(enrollment.run)

console.log(isLinkableCourseRun(enrollment.run, currentUser))
return (
<div className="enrolled-item container card" key={enrollment.run.id}>
<div className="row flex-grow-1 enrolled-item-info">
Expand Down Expand Up @@ -503,7 +504,9 @@ export class EnrolledItemCard extends React.Component<
rel="noopener noreferrer"
>
Go to Course
</a>) : null}
</a>) : <a className="btn btn-primary btn-gradient-red-to-blue disabled" rel="noopener noreferrer">
Starts {formatPrettyMonthDate(parseDateString(enrollment.run.start_date))}
</a>}
</div>
<Dropdown
isOpen={menuVisibility}
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/src/lib/courseApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
notNil,
parseDateString,
formatPrettyDateTimeAmPmTz,
emptyOrNil
emptyOrNil, formatPrettyDate, formatPrettyShortDate
} from "./util"

import { NODETYPE_OPERATOR, NODETYPE_COURSE, NODEOPER_ALL } from "../constants"
Expand Down
3 changes: 3 additions & 0 deletions frontend/public/src/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ export const formatPrettyDate = (momentDate: Moment) =>
export const formatPrettyShortDate = (momentDate: Moment) =>
momentDate.format("MMM D, YYYY")

export const formatPrettyMonthDate = (momentDate: Moment) =>
momentDate.format("MMMM D")

export const formatPrettyDateUtc = (momentDate: Moment) =>
momentDate.tz("UTC").format("MMMM D, YYYY")

Expand Down

0 comments on commit 23b709c

Please sign in to comment.