Skip to content

API Reference


API Reference / parseExpiry

Function: parseExpiry()

parseExpiry(value): number | undefined

Defined in: src/auth/TokenResponse.ts:92

Parses a Dhan expiry timestamp.

Dhan returns IST timestamps, and the ECMAScript spec parses a date-time string with no timezone designator as local time. On a UTC server that reads an IST expiry as 5.5 hours later than it really is, so the token looks valid well after the API has started rejecting it. Timestamps without an explicit offset are therefore pinned to IST.

Parameters

value

string | undefined

Returns

number | undefined

Community project — not affiliated with Dhan. MIT License.