mirror of
https://github.com/docmost/docmost.git
synced 2026-08-28 01:07:08 +08:00
fix: license display
This commit is contained in:
@@ -34,6 +34,7 @@ export default function LicenseDetails() {
|
|||||||
<Table.Td>
|
<Table.Td>
|
||||||
{license.licenseType === "business" ? "Business" : "Enterprise"}{" "}
|
{license.licenseType === "business" ? "Business" : "Enterprise"}{" "}
|
||||||
{license.trial && <Badge color="green">Trial</Badge>}
|
{license.trial && <Badge color="green">Trial</Badge>}
|
||||||
|
{license.lifetime && <Badge color="blue">Lifetime</Badge>}
|
||||||
</Table.Td>
|
</Table.Td>
|
||||||
</Table.Tr>
|
</Table.Tr>
|
||||||
|
|
||||||
@@ -59,7 +60,14 @@ export default function LicenseDetails() {
|
|||||||
<Table.Tr>
|
<Table.Tr>
|
||||||
<Table.Th>Expires at</Table.Th>
|
<Table.Th>Expires at</Table.Th>
|
||||||
<Table.Td>
|
<Table.Td>
|
||||||
{formatLocalized(license.expiresAt, "dd MMMM, yyyy", "PPP", locale)}
|
{license.lifetime
|
||||||
|
? "Never"
|
||||||
|
: formatLocalized(
|
||||||
|
license.expiresAt,
|
||||||
|
"dd MMMM, yyyy",
|
||||||
|
"PPP",
|
||||||
|
locale,
|
||||||
|
)}
|
||||||
</Table.Td>
|
</Table.Td>
|
||||||
</Table.Tr>
|
</Table.Tr>
|
||||||
<Table.Tr>
|
<Table.Tr>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ import { differenceInDays, isAfter } from "date-fns";
|
|||||||
export const GRACE_PERIOD_DAYS = 10;
|
export const GRACE_PERIOD_DAYS = 10;
|
||||||
|
|
||||||
export function isLicenseExpired(license: ILicenseInfo): boolean {
|
export function isLicenseExpired(license: ILicenseInfo): boolean {
|
||||||
|
if (license.lifetime) return false;
|
||||||
return isAfter(new Date(), license.expiresAt);
|
return isAfter(new Date(), license.expiresAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function daysToExpire(license: ILicenseInfo): number {
|
export function daysToExpire(license: ILicenseInfo): number {
|
||||||
|
if (license.lifetime) return Infinity;
|
||||||
const days = differenceInDays(license.expiresAt, new Date());
|
const days = differenceInDays(license.expiresAt, new Date());
|
||||||
return days > 0 ? days : 0;
|
return days > 0 ? days : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface ILicenseInfo {
|
|||||||
seatCount: number;
|
seatCount: number;
|
||||||
licenseType: LicenseType;
|
licenseType: LicenseType;
|
||||||
issuedAt: Date;
|
issuedAt: Date;
|
||||||
expiresAt: Date;
|
expiresAt: Date | null;
|
||||||
trial: boolean;
|
trial: boolean;
|
||||||
|
lifetime: boolean;
|
||||||
}
|
}
|
||||||
+1
-1
Submodule apps/server/src/ee updated: 844f2003cd...f6344cbb12
Reference in New Issue
Block a user