fix: license display

This commit is contained in:
Philipinho
2026-08-26 20:02:01 +01:00
parent 579e22a45e
commit 29869478e6
4 changed files with 14 additions and 3 deletions
@@ -34,6 +34,7 @@ export default function LicenseDetails() {
<Table.Td>
{license.licenseType === "business" ? "Business" : "Enterprise"}{" "}
{license.trial && <Badge color="green">Trial</Badge>}
{license.lifetime && <Badge color="blue">Lifetime</Badge>}
</Table.Td>
</Table.Tr>
@@ -59,7 +60,14 @@ export default function LicenseDetails() {
<Table.Tr>
<Table.Th>Expires at</Table.Th>
<Table.Td>
{formatLocalized(license.expiresAt, "dd MMMM, yyyy", "PPP", locale)}
{license.lifetime
? "Never"
: formatLocalized(
license.expiresAt,
"dd MMMM, yyyy",
"PPP",
locale,
)}
</Table.Td>
</Table.Tr>
<Table.Tr>
@@ -4,10 +4,12 @@ import { differenceInDays, isAfter } from "date-fns";
export const GRACE_PERIOD_DAYS = 10;
export function isLicenseExpired(license: ILicenseInfo): boolean {
if (license.lifetime) return false;
return isAfter(new Date(), license.expiresAt);
}
export function daysToExpire(license: ILicenseInfo): number {
if (license.lifetime) return Infinity;
const days = differenceInDays(license.expiresAt, new Date());
return days > 0 ? days : 0;
}
@@ -6,6 +6,7 @@ export interface ILicenseInfo {
seatCount: number;
licenseType: LicenseType;
issuedAt: Date;
expiresAt: Date;
expiresAt: Date | null;
trial: boolean;
lifetime: boolean;
}