Skip to content

Commit

Permalink
Add ZonedDateTime.prototype.valueOf
Browse files Browse the repository at this point in the history
  • Loading branch information
nekevss committed Dec 11, 2024
1 parent 2ab0732 commit e2942df
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/engine/src/builtins/temporal/zoneddatetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -838,6 +839,12 @@ impl ZonedDateTime {
)
.map(Into::into)
}

pub(crate) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
Err(JsNativeError::typ()
.with_message("valueOf not implemented for Temporal objects. See 'compare', 'equals', or `toString`")
.into())
}
}

// -- ZonedDateTime Abstract Operations --
Expand Down

0 comments on commit e2942df

Please sign in to comment.