Fix dates not being serialized properly in Chromium.

This commit is contained in:
Bauke 2022-03-20 19:21:52 +01:00
parent 62f2188070
commit bf8712dbf6
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
4 changed files with 11 additions and 5 deletions

View File

@ -37,7 +37,8 @@ export function serializeQueue(queue: Queue.Item[]): Record<string, any> {
for (const item of queue) {
const key = `qi${item.id}`;
serialized[key] = item;
serialized[key] = {...item};
serialized[key].added = item.added.toISOString();
}
return serialized;

View File

@ -47,9 +47,14 @@ export class Settings {
};
this.queue.push(item);
const sync: Record<string, Queue.Item> = {};
sync[`qi${id}`] = item;
await browser.storage.sync.set(sync);
await browser.storage.sync.set({
[`qi${id}`]: {
added: item.added.toISOString(),
id,
text,
url,
},
});
}
public newQueueItemId(): number {

View File

@ -32,7 +32,7 @@ Generated by [AVA](https://avajs.dev).
{
qi1: {
added: Date 2022-03-02 16:00:00 UTC {},
added: '2022-03-02T16:00:00.000Z',
id: 1,
text: 'Sample',
url: 'https://example.org',