Skip to content

Conversation

@elliott-with-the-longest-name-on-github
Copy link
Contributor

Basically, before this change, if you serialized a builtin but invalid date:

const stringified = devalue.stringify(new Date('invalid'));

console.log(stringified); // [["Date", ""]]

const date = devalue.parse(stringified, {
	Date: (value) => new Date(value)
});

You'd get an error that you'd provided invalid input -- because we'd feed the default-replaced value into the custom reviver, which expects a different format. This is uniquely the case when overriding builtin revivers.

After this change, this won't throw an error -- it will just work.

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2025

🦋 Changeset detected

Latest commit: 1ab38f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
devalue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Rich-Harris Rich-Harris merged commit 5c26c0d into main Oct 21, 2025
3 checks passed
@Rich-Harris Rich-Harris deleted the elliott/idk-what-to-call-this branch October 21, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants