Fix dates not being serialized properly in Chromium.
This commit is contained in:
parent
62f2188070
commit
bf8712dbf6
|
@ -37,7 +37,8 @@ export function serializeQueue(queue: Queue.Item[]): Record<string, any> {
|
||||||
|
|
||||||
for (const item of queue) {
|
for (const item of queue) {
|
||||||
const key = `qi${item.id}`;
|
const key = `qi${item.id}`;
|
||||||
serialized[key] = item;
|
serialized[key] = {...item};
|
||||||
|
serialized[key].added = item.added.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return serialized;
|
return serialized;
|
||||||
|
|
|
@ -47,9 +47,14 @@ export class Settings {
|
||||||
};
|
};
|
||||||
this.queue.push(item);
|
this.queue.push(item);
|
||||||
|
|
||||||
const sync: Record<string, Queue.Item> = {};
|
await browser.storage.sync.set({
|
||||||
sync[`qi${id}`] = item;
|
[`qi${id}`]: {
|
||||||
await browser.storage.sync.set(sync);
|
added: item.added.toISOString(),
|
||||||
|
id,
|
||||||
|
text,
|
||||||
|
url,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public newQueueItemId(): number {
|
public newQueueItemId(): number {
|
||||||
|
|
|
@ -32,7 +32,7 @@ Generated by [AVA](https://avajs.dev).
|
||||||
|
|
||||||
{
|
{
|
||||||
qi1: {
|
qi1: {
|
||||||
added: Date 2022-03-02 16:00:00 UTC {},
|
added: '2022-03-02T16:00:00.000Z',
|
||||||
id: 1,
|
id: 1,
|
||||||
text: 'Sample',
|
text: 'Sample',
|
||||||
url: 'https://example.org',
|
url: 'https://example.org',
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue