Proposal-temporal: `_repr_` should always return the same as `toString()`

Created on 3 Nov 2020  路  2Comments  路  Source: tc39/proposal-temporal

Repro:

Temporal.Instant.fromEpochMilliseconds(0).toString();
// => 1970-01-01T00:00:00Z
Temporal.Instant.fromEpochMilliseconds(0)._repr_
// => 1970-01-01T00:00:00+00:00

Not sure if this problem exists in other types, but should be checked.

Most helpful comment

It's not part of the proposal, it's a debugging aid that we add to the polyfill if you bundle it with a magic debug switch. The reason for it is so that a string representation shows up in browser devtools, instead of something like [Object Temporal.Instant] {}.

All 2 comments

What is _repr_?

It's not part of the proposal, it's a debugging aid that we add to the polyfill if you bundle it with a magic debug switch. The reason for it is so that a string representation shows up in browser devtools, instead of something like [Object Temporal.Instant] {}.

Was this page helpful?
0 / 5 - 0 ratings