Skip to content

Commit

Permalink
Fix dns record expiry date always being set to July (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eakam1007 authored Mar 27, 2023
1 parent 16e6316 commit b612baa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/dns-record.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function createDnsRecord(
data: Pick<DnsRecord, 'username' | 'type' | 'subdomain' | 'value'>
) {
// Set expiration date 6 months from now
const expiresAt = dayjs().set('month', 6).toDate();
const expiresAt = dayjs().add(6, 'month').toDate();
const status = DnsRecordStatus.pending;

return prisma.dnsRecord.create({ data: { ...data, expiresAt, status } });
Expand All @@ -78,7 +78,7 @@ export function updateDnsRecordById(
...data,
// If the record is changing to the `active` status, update expiry too
expiresAt:
data.status === DnsRecordStatus.active ? dayjs().set('month', 6).toDate() : undefined,
data.status === DnsRecordStatus.active ? dayjs().add(6, 'month').toDate() : undefined,
},
});
}
Expand All @@ -89,7 +89,8 @@ export function renewDnsRecordById(id: DnsRecord['id']) {
id,
},
data: {
expiresAt: dayjs().set('month', 6).toDate(),
// Set expiration date 6 months from now
expiresAt: dayjs().add(6, 'month').toDate(),
},
});
}
Expand Down

0 comments on commit b612baa

Please sign in to comment.