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

fix expiry date calculation #534

Merged
merged 1 commit into from May 22, 2019

Conversation

Projects
None yet
2 participants
@gustafn
Copy link
Contributor

commented Apr 26, 2019

At least in current FireFox (66.0.3) the date calculation is broken
and leads for 26th April 2019 + 365 days to Wed Jun 06 2091 (72 years in the future).

See the following date calculation approaches with results:

var exdate = new Date();
exdate.setTime(exdate.getTime() + ((expiryDays || 365) * 24 * 60 * 60 * 1000));
console.log('exdate1 ' + exdate);

var exdate2 = new Date();
exdate2.setHours(exdate2.getHours() + ((expiryDays || 365) * 24));
console.log('exdate2 ' + exdate2);

var exdate3 = new Date();
exdate3.setDate(exdate3.getDate() + (expiryDays || 365));
console.log('exdate3 ' + exdate3);

exdate1 Sat Apr 25 2020 13:24:07 GMT+0200 (Central European Summer Time)
exdate2 Sat Apr 25 2020 13:24:07 GMT+0200 (Central European Summer Time)
exdate3 Wed Jun 06 2091 13:24:07 GMT+0200 (Central European Summer Time)

fix expiry date calculation
At least in current FireFox (66.0.3) the date calculation is broken
and leads for 26th April 2019 + 365 days to Wed Jun 06 2091 (72 years in the future).

See the following date calculation approaches with results:

var exdate = new Date();
exdate.setTime(exdate.getTime() + ((expiryDays || 365) * 24 * 60 * 60 * 1000));
console.log('exdate1 ' + exdate);

var exdate2 = new Date();
exdate2.setHours(exdate2.getHours() + ((expiryDays || 365) * 24));
console.log('exdate2 ' + exdate2);

var exdate3 = new Date();
exdate3.setDate(exdate3.getDate() + (expiryDays || 365));
console.log('exdate3 ' + exdate3);

exdate1 Sat Apr 25 2020 13:24:07 GMT+0200 (Central European Summer Time)
exdate2 Sat Apr 25 2020 13:24:07 GMT+0200 (Central European Summer Time)
exdate3 Wed Jun 06 2091 13:24:07 GMT+0200 (Central European Summer Time)

vguerra pushed a commit to openacs/cookie-consent that referenced this pull request Apr 27, 2019

add support for expiryDays
update upstream version number
for expiry days to work correctly, one needs probably the following fix
osano/cookieconsent#534
@L0key

L0key approved these changes May 22, 2019

@L0key L0key merged commit c0faa1d into osano:master May 22, 2019

@gustafn

This comment has been minimized.

Copy link
Contributor Author

commented May 22, 2019

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.