Closed Bug 1840326 Opened 3 years ago Closed 1 year ago

Add better representation for Temporal objects

Categories

(DevTools :: Object Inspector, enhancement)

enhancement

Tracking

(firefox137 fixed)

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

When building with ac_add_options --with-temporal-api, Temporal are enabled (see https://tc39.es/proposal-temporal/docs/).

Logging objects like Temporal.Now.instant() or Temporal.Now.timeZone() does show the right type in the console output (resp Temporal.Instant { } and Temporal.TimeZone { }), but there's nothing that give you a quick idea of the actual value.

For each type of Temporal object, we should think of a value that would ease the understanding of what those instances hold, like we do for Date instances

See Also: → 1839676

Now that Temporal is in nightly, it'd be helpful to increase the priority of this task.

We discussed this topic at the Temporal champions meeting this morning and our recommendation is that devtools console output should be similar to the output for Date: first the type name e.g. Temporal.Instant, then the results of calling toString on the object.

Current:
Temporal.ZonedDateTime { }

Desired:
Temporal.ZonedDateTime 2025-02-06T16:10:22.76-08:00[America/Los_Angeles]

Flags: needinfo?(andrebargull)

I'll take care of this

Flags: needinfo?(andrebargull)
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Attached image Temporal objects

Here's how it looks like with current patch.
Temporal.Duration is a bit different, but I guess it's still nice to see the serialized value

Very nice. Looks great. Thanks for the quick turnaround.

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f9a352ad6c3f [devtools] Add specific previewers for temporal objets. r=devtools-reviewers,ochameau
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
See Also: → 1935431
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: