Skip to content

fix: render issue date on certificate pages - #3390

Merged
ahtesham-quraish merged 3 commits into
mainfrom
ahtesham/issue-date-branch
Jun 2, 2026
Merged

fix: render issue date on certificate pages#3390
ahtesham-quraish merged 3 commits into
mainfrom
ahtesham/issue-date-branch

Conversation

@ahtesham-quraish

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://github.com/mitodl/hq/issues/10711#issuecomment-4481397774

Description (What does it do?)

  • Displayed the issue date on certificate pages where as validFrom date is removed because it was not coming in api response for multiple courses and programs

Screenshots (if appropriate):

image

How can this be tested?

Additional Context

Copilot AI review requested due to automatic review settings June 1, 2026 08:20
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates certificate rendering (both the on-screen certificate page and the generated PDF route) to display a certificate’s issue date from the API (issue_date) instead of relying on verifiable_credential_json.validFrom, which is not consistently present in responses.

Changes:

  • Replace usage of verifiable_credential_json.validFrom with issue_date when rendering certificate dates.
  • Update the PDF certificate route to render the issue date when present.
  • Update CertificatePage tests to assert against the issue date field.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
frontends/main/src/app/(site)/certificate/[certificateType]/[uuid]/pdf/route.tsx Switch PDF date rendering from validFrom to issueDate sourced from issue_date.
frontends/main/src/app-pages/CertificatePage/CertificatePage.tsx Switch UI date rendering from validFrom to issueDate sourced from issue_date.
frontends/main/src/app-pages/CertificatePage/CertificatePage.test.tsx Update assertions to check the rendered issue date instead of validFrom.

Comment on lines 40 to 42
await screen.findAllByText(
moment(certificate.verifiable_credential_json.validFrom).format(
"MMM D, YYYY",
),
moment(certificate.issue_date).format("MMM D, YYYY"),
)
Comment on lines 110 to 112
await screen.findAllByText(
moment(certificate.verifiable_credential_json.validFrom).format(
"MMM D, YYYY",
),
moment(certificate.issue_date).format("MMM D, YYYY"),
)
@ahtesham-quraish
ahtesham-quraish force-pushed the ahtesham/issue-date-branch branch from 861e0e8 to 9d03919 Compare June 1, 2026 08:40
@daniellefrappier18 daniellefrappier18 self-assigned this Jun 1, 2026
const { displayType } = getCertificateInfo()
const signatories = certificate.certificate_page.signatory_items
const validFrom = certificate?.verifiable_credential_json?.validFrom
const issueDate = certificate?.issue_date

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there is no certificate.issue_date are we okay with this being blank?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO there won't be any case where the issue date will be blank because this PR tells us that issue date will be there.
mitodl/mitxonline#3587

@daniellefrappier18 daniellefrappier18 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good I was able to verify the test case. I did just have one question you should take a look at before merging.

Image

@ahtesham-quraish
ahtesham-quraish force-pushed the ahtesham/issue-date-branch branch from 7ff2f9b to b842a0b Compare June 2, 2026 14:13
@ahtesham-quraish
ahtesham-quraish merged commit 99a2dbe into main Jun 2, 2026
13 checks passed
@ahtesham-quraish
ahtesham-quraish deleted the ahtesham/issue-date-branch branch June 2, 2026 14:35
@odlbot odlbot mentioned this pull request Jun 2, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants