stevermeister / ngx-cookie-service

Angular (4.2+ ...12) service for cookies. Originally based on the `ng2-cookies` library.

Home Page:https://www.npmjs.com/package/ngx-cookie-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get expiry date

Soolan opened this issue · comments

Is your feature request related to a problem? Please describe

Using:
set( name: string, value: string, options?: { expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'None' | 'Strict'}): void;

you can set the expiry date for a cookie.

But I can't find any function to read the expiry date associated with a cookie.

Describe the solution you'd like

na

Describe alternatives you've considered

na

Additional context

No response

Hello 👋 @Soolan
Thank you for raising an issue. We will investigate into the issue and get back to you as soon as possible. Please make sure you have given us as much context as possible.
Feel free to raise a PR if you can fix the issue

@Soolan What would be usecase for this?

@pavankjadda a few days ago I was facing a challenge where I was asked to refresh a cookie expiry time based on another timestamp variable.

Turned out that other timestamp object would be redundant IF we would be able to read the expiry time from the cookie itself.
Just a thought.

@Soolan Unfortunately the browser do not expose cookie expiration date. They only return cookie value.