E
E
eugene1592021-06-10 22:44:24
JavaScript
eugene159, 2021-06-10 22:44:24

Why does the browser show the wrong cookie expiration time (made cookies through the js-cookie library)?

Through js-cookie I set a cookie which expires after 1 day. Here is the code:
Cookies.set('asd', true, {expires: 1})

Next, I went to the Google Chrome developer console, there in Application, on the left I selected Cookies. Clicked on the site's domain and found the cookie I set (named asd). And in his Expiries / Max-Age it is written:
2021-06-11T17:41:35.000Z

As I understand it, the date comes first in the year-month-day format. Then the letter T and the time in the format hour:minute:second. Then a dot and some value.
If so, then the time is set incorrectly. I have 20 hours on my watch. And in cookies 17.

I thought that cookies depend on the server time. And the time is set incorrectly on the server. I wrote this code in php:

<?php
$date = date('m/d/Y H:i:s', time());
echo $date;

He brought out the time that I have on the clock. No 3 hours late. And in cookies late.

Why is this happening?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question