Skip to content

Commit 1994201

Browse files
committed
Fix trial license key to expire instead of being permanent
The trial license key was incorrectly placed with permanent licenses (gpl-v3, internal-use-in-handsontable), causing it to never expire. Moved it to a separate branch with expiration logic that checks against a hardcoded trial expiry date (May 19, 2026), ensuring it behaves as a time-limited trial license.
1 parent 755686a commit 1994201

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎src/helpers/licenseKeyValidator.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,23 @@ export function checkLicenseKeyValidity(licenseKey: string): LicenseKeyValidityS
5454
vars: {},
5555
}
5656

57-
if (licenseKey === 'gpl-v3' || licenseKey === 'internal-use-in-handsontable' || licenseKey === 'hftrial-0168e-1f2b7-47158-70b05-0842f') {
57+
if (licenseKey === 'gpl-v3' || licenseKey === 'internal-use-in-handsontable') {
5858
messageDescriptor.template = LicenseKeyValidityState.VALID
5959

60+
} else if (licenseKey === 'hftrial-0168e-1f2b7-47158-70b05-0842f') {
61+
const [day, month, year] = (process.env.HT_RELEASE_DATE || '').split('/')
62+
const releaseDays = Math.floor(new Date(`${month}/${day}/${year}`).getTime() / 8.64e7)
63+
const trialExpiryDate = new Date('05/19/2026')
64+
const trialExpiryDays = Math.floor(trialExpiryDate.getTime() / 8.64e7)
65+
66+
messageDescriptor.vars.keyValidityDate = formatDate(trialExpiryDate)
67+
68+
if (releaseDays > trialExpiryDays) {
69+
messageDescriptor.template = LicenseKeyValidityState.EXPIRED
70+
} else {
71+
messageDescriptor.template = LicenseKeyValidityState.VALID
72+
}
73+
6074
} else if (typeof licenseKey === 'string' && checkKeySchema(licenseKey)) {
6175
const [day, month, year] = (process.env.HT_RELEASE_DATE || '').split('/')
6276
const releaseDays = Math.floor(new Date(`${month}/${day}/${year}`).getTime() / 8.64e7)

0 commit comments

Comments
 (0)