Which fix removes the bug?
const copy = JSON.parse(JSON.stringify(event)); console.log(copy.date.getTime());
- Revive the date explicitly
- Use Object.assign instead
- Spread the object first
- Call toJSON() before
JSON has no date type, so the round trip turns the Date into a string with no getTime method.
Play Problem Solving ▸