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: invalid date formatting on course route #1233

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Dec 6, 2024

Description

Resolves "Invalid Date" messages on course about page in Learner Portal in Firefox (appears fine in Chrome). The error seems to be due to different browsers' parsing/handling of datetime strings.

image

Locally, there was a JS error triggers by react-intl's FormattedDate component:

Error: [@formatjs/intl Error FORMAT_ERROR] Error formatting date.
Locale: en
date value is not finite in DateTimeFormat.format()

The solution was to ensure the raw date string was passed to FormattedDate vs. passing the already-formatted date via dayjs(...).format(DATE_FORMAT).

This PR also switches to use getNormalizedStartDate within the deprecated CourseRunCard component to ensure today's date is used for display, where relevant (i.e., self-paced courses with time-to-complete).

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)
  • Ensure English strings are marked for translation. See documentation for more details.

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.85%. Comparing base (01c8a57) to head (6a32dce).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1233      +/-   ##
==========================================
- Coverage   88.88%   88.85%   -0.04%     
==========================================
  Files         401      401              
  Lines        8595     8595              
  Branches     2060     2060              
==========================================
- Hits         7640     7637       -3     
- Misses        913      916       +3     
  Partials       42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamstankiewicz adamstankiewicz merged commit d3920e9 into master Dec 6, 2024
5 of 6 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/fix-invalid-date-course-route branch December 6, 2024 17:43
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.

2 participants