mirror of https://github.com/sveltejs/svelte
fix: ensure $state.snapshot correctly clones Date objects (#12564)
parent
7b2279d84c
commit
d73c5b8434
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure $state.snapshot correctly clones Date objects
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `true\ntrue\ntrue\ntrue`
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
<script>
|
||||
let test = $state({
|
||||
a: new Date()
|
||||
});
|
||||
let test2 = $state.snapshot(test);
|
||||
|
||||
let test3 = {
|
||||
a: new Date()
|
||||
}
|
||||
let test4 = structuredClone(test3);
|
||||
</script>
|
||||
|
||||
{test.a instanceof Date}
|
||||
{test2.a instanceof Date}
|
||||
{test3.a instanceof Date}
|
||||
{test4.a instanceof Date}
|
Loading…
Reference in new issue