diff --git a/app/webpacker/components/MyCompetitions/UpcomingCompetitionTable.jsx b/app/webpacker/components/MyCompetitions/UpcomingCompetitionTable.jsx index 9fc8811eb5..0a9e2047c3 100644 --- a/app/webpacker/components/MyCompetitions/UpcomingCompetitionTable.jsx +++ b/app/webpacker/components/MyCompetitions/UpcomingCompetitionTable.jsx @@ -23,11 +23,18 @@ const competingStatusIcon = (competingStatus) => { }; const registrationStatusIconText = (competition) => { + const toRelativeOptions = { + // don't be more precise than "days" (i.e. no hours/minutes/seconds) + unit: ["years", "quarters", "months", "weeks", "days"], + // round up, e.g. in 8 hours -> pads to 1 day 8 hours -> rounds to "in 1 day" + padding: 24 * 60 * 60 * 1000, + }; + if (competition.registration_status === 'not_yet_opened') { - return I18n.t('competitions.index.tooltips.registration.opens_in', { duration: DateTime.fromISO(competition.registration_open).toRelative() }); + return I18n.t('competitions.index.tooltips.registration.opens_in', { duration: DateTime.fromISO(competition.registration_open).toRelative(toRelativeOptions) }); } if (competition.registration_status === 'past') { - return I18n.t('competitions.index.tooltips.registration.closed', { days: DateTime.fromISO(competition.start_date).toRelative() }); + return I18n.t('competitions.index.tooltips.registration.closed', { days: DateTime.fromISO(competition.start_date).toRelative(toRelativeOptions) }); } if (competition.registration_status === 'full') { return I18n.t('competitions.index.tooltips.registration.full');