Skip to content
Snippets Groups Projects
Commit 4437f1fd authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: use ceil on diffDays

parent 710c2a74
No related branches found
No related tags found
3 merge requests!103Support,!102Dev,!98Features/us213 recoil
...@@ -23,8 +23,8 @@ const ChallengeViewingDate: React.FC<ChallengeViewingDateProps> = ({ ...@@ -23,8 +23,8 @@ const ChallengeViewingDate: React.FC<ChallengeViewingDateProps> = ({
null null
) )
const diffDays = const diffDays =
firstDateWithData && firstDateWithData && firstDateWithData.diffNow(['days']).toObject().days
firstDateWithData.diffNow(['days', 'hours']).toObject().days const diffDaysCeil = Math.ceil(diffDays || 0)
useEffect(() => { useEffect(() => {
if (challenge) { if (challenge) {
...@@ -44,14 +44,11 @@ const ChallengeViewingDate: React.FC<ChallengeViewingDateProps> = ({ ...@@ -44,14 +44,11 @@ const ChallengeViewingDate: React.FC<ChallengeViewingDateProps> = ({
/* eslint-disable @typescript-eslint/camelcase */ /* eslint-disable @typescript-eslint/camelcase */
return ( return (
<React.Fragment> <React.Fragment>
{firstDateWithData && {firstDateWithData && firstDateWithData > DateTime.local() ? (
firstDateWithData > DateTime.local() &&
diffDays &&
diffDays > 0 ? (
<div className="view-start-date"> <div className="view-start-date">
{t('CHALLENGE.VIEW_START', { {t('CHALLENGE.VIEW_START', {
diffDays, diffDaysCeil,
smart_count: diffDays, smart_count: diffDaysCeil,
})} })}
</div> </div>
) : ( ) : (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment