Skip to content

Commit e6495c1

Browse files
committed
fix(revenuecat): fall back to Date.now() when request_date is malformed
A malformed request_date would parse to NaN, making every entitlement and subscription compare false and silently zero active counts. Fall back to Date.now() when the parsed value is not finite.
1 parent d926e0a commit e6495c1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/sim/tools/revenuecat/get_customer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export const revenuecatGetCustomerTool: ToolConfig<GetCustomerParams, CustomerRe
4545
const subscriberRaw = extractSubscriber(data)
4646
const subscriber = shapeSubscriber(subscriberRaw)
4747
const requestDate = (data?.value?.request_date ?? data?.request_date) as string | undefined
48-
const now = requestDate ? new Date(requestDate).getTime() : Date.now()
48+
const parsed = requestDate ? new Date(requestDate).getTime() : Number.NaN
49+
const now = Number.isFinite(parsed) ? parsed : Date.now()
4950

5051
const isActiveByDates = (
5152
expires: string | null | undefined,

0 commit comments

Comments
 (0)