Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support expires values larger than the maximum date #11

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

akh9804
Copy link
Contributor

@akh9804 akh9804 commented Sep 30, 2022

Expires should work even when it is above the maximum date

@theodorejb
Copy link
Owner

What is the use case for this? Can you show a code example where it would be useful?

@akh9804
Copy link
Contributor Author

akh9804 commented Sep 30, 2022

Yes. I wanted to set expires as long as I can. So, I set it as a very large number.

Cookies.set('name', 'value', { expires: 100000000000 });

I expected cookies wouldn't expire almost forever but it did in short time.

It'd be very useful when you want cookies not to expire for a long time.

@theodorejb
Copy link
Owner

Why not set expires to a less insanely large number? E.g. even if you just set it to 100_000 that would be enough for the cookie to not expire for hundreds of years.

@akh9804
Copy link
Contributor Author

akh9804 commented Sep 30, 2022

You're right. But I didn't know until I looked into source code that the error was due to the large value I put in. I think this one is necessary to prevent this situation.

@theodorejb theodorejb changed the title Add support for expires above the maximum date Support expires values larger than the maximum date Apr 19, 2024
Copy link
Owner

@theodorejb theodorejb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@theodorejb theodorejb merged commit 5a74fc1 into theodorejb:master Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants