Hi,
To create a cookie in Javascript with specific expiry date, you have to set the exact expiration weekday, day, month, year and time. You have to match the following formatting:
document.cookie = "abc=12345; expires=Thu, 15 Aug 2019 12:00:00 GMT; path=/";
Both weekday and month have to be set in shorten format. To create this type of cookie, the whole date has to be correct. The weekday has to match the stated date.