Skip to content

Commit 1bbe2b2

Browse files
committed
check expiration time directly
1 parent 69e4ba6 commit 1bbe2b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/plus/gk/checkin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SubscriptionPlanId } from '../../constants.subscription';
22
import type { Organization } from './account/organization';
33
import type { Subscription } from './account/subscription';
4-
import { getSubscriptionPlan, getSubscriptionPlanPriority, isSubscriptionExpired } from './account/subscription';
4+
import { getSubscriptionPlan, getSubscriptionPlanPriority, getTimeRemaining } from './account/subscription';
55

66
export type GKLicenses = Partial<Record<GKLicenseType, GKLicense>>;
77

@@ -192,10 +192,12 @@ export function getSubscriptionFromCheckIn(
192192
);
193193
}
194194

195+
const remainingTime = getTimeRemaining(actual.expiresOn);
195196
if (
196197
effective == null ||
197198
(getSubscriptionPlanPriority(actual.id) >= getSubscriptionPlanPriority(effective.id) &&
198-
!isSubscriptionExpired(actual))
199+
remainingTime != null &&
200+
remainingTime > 0)
199201
) {
200202
effective = { ...actual };
201203
}

0 commit comments

Comments
 (0)