Emit a deprecation warning when serializing an invalid Date - #3731
Open
charmander with Copilot wants to merge 1 commit into
Open
Emit a deprecation warning when serializing an invalid Date#3731charmander with Copilot wants to merge 1 commit into
charmander with Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Fix serialization of new Date(undefined) as Invalid date
Throw an error when serializing an invalid Date instead of sending garbage to Postgres
Aug 7, 2026
This comment was marked as off-topic.
This comment was marked as off-topic.
Copilot stopped work on behalf of
charmander due to an error
August 7, 2026 03:24
Co-authored-by: charmander <1889843+charmander@users.noreply.github.com>
charmander
force-pushed
the
copilot/fix-serialize-invalid-date
branch
from
August 7, 2026 04:03
20b8068 to
7781972
Compare
charmander
marked this pull request as ready for review
August 7, 2026 04:09
charmander
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
new Date(undefined)(or any invalidDate) is silently serialized to"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN", a string Postgres cannot meaningfully parse, leading to confusing downstream errors instead of a clear signal at the source.Changes
packages/pg/lib/utils.js:prepareValuenow emits autil.deprecate-based process warning (codePG_INVALID_DATE) when serializing an invalidDate, without changing the current serialized output, for backwards compatibility. The warning explains that this will become an error in the next major version ofpg.packages/pg/test/unit/utils-tests.js: added a unit test assertingprepareValueemits thePG_INVALID_DATEwarning and still serializes the invalid date to the existing (garbage) string.