Chrome 本地存储没有正确存储日期

Chrome local storage is not storing dates correctly

在Chrome的本地存储中设置包含日期的数据时,除了消失的日期外,所有数据都被正确检索,但我真的不知道我做错了什么。

await browser.storage.local.remove("ghunt");
var payload = {"ghunt": {
                "cookies": "dummydata",
                "date": new Date(),
                "step": "login"
            }};
console.log("Raw payload => ", payload);
console.log("Putting the payload in local storage...")
await browser.storage.local.set(payload)
console.log("Retrieving data from local storage...")
var storage = await browser.storage.local.get("ghunt");
console.log("Retrieved data => ", storage);

完全相同的代码/命令在 Firefox 上完美运行。

PS : 我正在使用 Mozilla 的 WebExtension-Polyfill 来提供跨浏览器支持

Firefox output screenshot
Chrome output screenshot

MDN StorageArea.set()(强调我的):

It's generally not possible to store other types, such as Function, Date, RegExp, Set, Map, ArrayBuffer, and so on. Some of these unsupported types will restore as an empty object, and some cause set() to throw an error. The exact behavior here is browser-specific.

存储new Date().getTime(),是一个整数,不是new Date()