diff --git a/app/assets/v2/js/pages/bounty_details.js b/app/assets/v2/js/pages/bounty_details.js index f39baa43cd7..757ae05f60b 100644 --- a/app/assets/v2/js/pages/bounty_details.js +++ b/app/assets/v2/js/pages/bounty_details.js @@ -332,6 +332,7 @@ var callbacks = { $('.progress').css('width', expiringInPercentage + '%'); var response = timeDifference(now, expires_date).split(' '); + const isInfinite = expires_date - new Date().setFullYear(new Date().getFullYear() + 1) > 1; if (expires_date < new Date()) { label = 'expired'; @@ -344,6 +345,8 @@ var callbacks = { } } else if (result['status'] === 'done' || result['status'] === 'cancelled') { $('#timer').hide(); + } else if (isInfinite) { + response = '∞'; } else { response.shift(); response = response.join(' '); diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index fe14144edf5..131e18f7dd7 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -1072,6 +1072,7 @@ function renderBountyRowsFromResults(results, renderForExplorer) { const dateNow = new Date(); const dateExpires = new Date(result['expires_date']); const isExpired = dateExpires < dateNow && !result['is_open']; + const isInfinite = dateExpires - new Date().setFullYear(new Date().getFullYear() + 1) > 1; const projectType = ucwords(result['project_type']) + ' • '; result['action'] = result['url']; @@ -1104,10 +1105,17 @@ function renderBountyRowsFromResults(results, renderForExplorer) { result['p'] += ('Expired ' + timeAgo + ' ago'); } else { const openedWhen = timeDifference(dateNow, new Date(result['web3_created']), true); - const timeLeft = timeDifference(dateNow, dateExpires); - const expiredExpires = dateNow < dateExpires ? 'Expires' : 'Expired'; - result['p'] += ('Opened ' + openedWhen + ' ago, ' + expiredExpires + ' ' + timeLeft); + if (isInfinite) { + const expiredExpires = 'Never expires'; + + result['p'] += ('Opened ' + openedWhen + ' ago, ' + expiredExpires); + } else { + const timeLeft = timeDifference(dateNow, dateExpires); + const expiredExpires = dateNow < dateExpires ? 'Expires' : 'Expired'; + + result['p'] += ('Opened ' + openedWhen + ' ago, ' + expiredExpires + ' ' + timeLeft); + } } if (renderForExplorer) {