Home > tough-cookie > Cookie > TTL
Computes the TTL relative to now (milliseconds).
Signature:
TTL(now?: number): number;
Parameter |
Type |
Description |
---|---|---|
now |
number |
(Optional) passing an explicit value is mostly used for testing purposes since this defaults to the |
number
-
Infinity
is returned for cookies without an explicit expiry -
0
is returned if the cookie is expired. -
Otherwise a time-to-live in milliseconds is returned.