If getStartDateText gets a course with no runs, output empty string #2703
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Closes mitodl/hq#7473
Description (What does it do?)
As noted in the issue, when the frontend hit a course that had no course runs in it, it called
getStartDateText
, which then dutifully sorted nothing and moment was left to operate on an undefined. Now, if there's no course runs, this should just return an empty string.How can this be tested?
Create a course with a live page and everything, but no course runs. The catalog Courses tab should work as you would expect. The course should show up but it should not say anything for start date.
Additional Context
Not sure if we want something else here besides empty string. I think generally we were expecting there to always be at least one course run in the list. (The course that tripped this up had a B2B run, and we don't want users getting into those, so we filter those out..)