Wrong error message text in Temporal.*.prototype.valueOf

13 views
Skip to first unread message

Cadence Ember

unread,
May 19, 2025, 2:13:57 AM5/19/25
to v8-...@googlegroups.com
Hi,

When any Temporal object has its valueOf function called, it intentionally throws a TypeError with a specific message. For example with Temporal.PlainDate:

"Do not use Temporal.PlainDate.prototype.valueOf; use Temporal.PlainData.prototype.compare for comparison."

However, there's a mistake in this message. It says Temporal.PlainDate.prototype.compare, but that doesn't exist. The correct function is actually Temporal.PlainDate.compare. This caused me some confusion.

Example:

Temporal.PlainDate.from("2025-05-19").compare -> undefined
Temporal.PlainDate.compare -> [Function: compare]

The message is generated by this code: https://github.com/v8/v8/blob/main/src/builtins/builtins-temporal.cc#L113

Can I fix this?
Reply all
Reply to author
Forward
0 new messages