@@ -34,6 +34,7 @@ import {
3434 op_preview_entries ,
3535} from "ext:core/ops" ;
3636import * as ops from "ext:core/ops" ;
37+ import { URLPrototype } from "ext:deno_web/00_url.js" ;
3738const {
3839 AggregateError,
3940 AggregateErrorPrototype,
@@ -71,6 +72,7 @@ const {
7172 DatePrototype,
7273 DatePrototypeGetTime,
7374 DatePrototypeToISOString,
75+ DatePrototypeToString,
7476 Error,
7577 ErrorCaptureStackTrace,
7678 ErrorPrototype,
@@ -847,14 +849,16 @@ function formatRaw(ctx, value, recurseTimes, typedArray, proxyDetails) {
847849 ( proxyDetails === null && isDate ( value ) ) ||
848850 ( proxyDetails !== null && isDate ( proxyDetails [ 0 ] ) )
849851 ) {
850- const date = proxyDetails ?. [ 0 ] ?? value ;
851- if ( NumberIsNaN ( DatePrototypeGetTime ( date ) ) ) {
852- return ctx . stylize ( "Invalid Date" , "date" ) ;
853- } else {
854- base = DatePrototypeToISOString ( date ) ;
855- if ( keys . length === 0 && protoProps === undefined ) {
856- return ctx . stylize ( base , "date" ) ;
857- }
852+ value = proxyDetails ?. [ 0 ] ?? value ;
853+ base = NumberIsNaN ( DatePrototypeGetTime ( value ) )
854+ ? DatePrototypeToString ( value )
855+ : DatePrototypeToISOString ( value ) ;
856+ const prefix = getPrefix ( constructor , tag , "Date" ) ;
857+ if ( prefix !== "Date " ) {
858+ base = `${ prefix } ${ base } ` ;
859+ }
860+ if ( keys . length === 0 && protoProps === undefined ) {
861+ return ctx . stylize ( base , "date" ) ;
858862 }
859863 } else if (
860864 proxyDetails === null &&
@@ -969,6 +973,14 @@ function formatRaw(ctx, value, recurseTimes, typedArray, proxyDetails) {
969973 if ( keys . length === 0 && protoProps === undefined ) {
970974 return base ;
971975 }
976+ } else if (
977+ ObjectPrototypeIsPrototypeOf ( URLPrototype , value ) &&
978+ ! ( recurseTimes > ctx . depth && ctx . depth !== null )
979+ ) {
980+ base = value . href ;
981+ if ( keys . length === 0 && protoProps === undefined ) {
982+ return base ;
983+ }
972984 } else {
973985 if ( keys . length === 0 && protoProps === undefined ) {
974986 // TODO(wafuwafu13): Implement
0 commit comments