fix: set time to zero when calculating remaining days

This commit is contained in:
Maël Gangloff
2025-01-04 01:32:24 +01:00
parent 2afc2e9577
commit f3f0625021
2 changed files with 4 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ export function TrackedDomainTable() {
const notices: ReactElement[] = []
setDataTable(data['hydra:member'].map((d: Domain) => {
const expirationDate = d.events.find(e => e.action === 'expiration' && !e.deleted)?.date
const expiresInDays = d.expiresInDays && d.expiresInDays > 0 ? -d.expiresInDays : undefined
const expiresInDays = d.expiresInDays && d.expiresInDays > 1 ? -d.expiresInDays : undefined
if (d.status.includes('redemption period')) {
if (!notices.includes(REDEMPTION_NOTICE)) notices.push(REDEMPTION_NOTICE)
@@ -138,12 +138,12 @@ export function TrackedDomainTable() {
</Tooltip>
}
{
d.expiresInDays && <Tooltip title={t`Estimated number of days until WHOIS removal`}>
d.expiresInDays ? <Tooltip title={t`Estimated number of days until WHOIS removal`}>
<Tag bordered={false}
color={d.expiresInDays <= 5 ? 'red' : d.expiresInDays <= 35 ? 'orange' : 'default'}>
{t`J ${expiresInDays}`}
</Tag>
</Tooltip>
</Tooltip> : undefined
}
</Flex>
}

View File

@@ -468,6 +468,7 @@ class Domain
#[Groups(['domain:item', 'domain:list'])]
public function getExpiresInDays(): ?int
{
return 0;
$now = new \DateTimeImmutable();
$lastStatus = $this->getDomainStatuses()->last();
$daysToExpiration = null;