diff --git a/core/engine/src/builtins/temporal/zoneddatetime/mod.rs b/core/engine/src/builtins/temporal/zoneddatetime/mod.rs index f4d16cf5a7f..591d9686ef2 100644 --- a/core/engine/src/builtins/temporal/zoneddatetime/mod.rs +++ b/core/engine/src/builtins/temporal/zoneddatetime/mod.rs @@ -319,6 +319,7 @@ impl IntrinsicObject for ZonedDateTime { .static_method(Self::from, js_string!("from"), 1) .method(Self::add, js_string!("add"), 1) .method(Self::subtract, js_string!("subtract"), 1) + .method(Self::value_of, js_string!("valueOf"), 0) .build(); } @@ -838,6 +839,12 @@ impl ZonedDateTime { ) .map(Into::into) } + + pub(crate) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { + Err(JsNativeError::typ() + .with_message("valueOf not implemented for Temporal objects. See 'compare', 'equals', or `toString`") + .into()) + } } // -- ZonedDateTime Abstract Operations --