Skip to content

Commit b7d2777

Browse files
authored
Merge pull request #776 from YakovL/fix-setCookie
fix setCookie (fails when options.expires is not set or is not a Date)
2 parents 2867ffc + 9e43fe8 commit b7d2777

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

6-data-storage/01-cookie/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function setCookie(name, value, options = {}) {
311311
...options
312312
};
313313

314-
if (options.expires.toUTCString) {
314+
if (options.expires instanceof Date) {
315315
options.expires = options.expires.toUTCString();
316316
}
317317

6-data-storage/01-cookie/cookie.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function setCookie(name, value, options = {}) {
1313
...options
1414
};
1515

16-
if (options.expires.toUTCString) {
16+
if (options.expires instanceof Date) {
1717
options.expires = options.expires.toUTCString();
1818
}
1919

0 commit comments

Comments
 (0)