Skip to content

Commit

Permalink
Add options parameter to Date.to_locale_time_string
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-hansen committed Dec 27, 2024
1 parent 24f20ae commit 33edc25
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions crates/js-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# `js-sys` Change Log

--------------------------------------------------------------------------------
## Unreleased

### Changed

* Added `options` parameter to `Date.to_local_time_string`
[#4384](https://github.com/rustwasm/wasm-bindgen/pull/4384)

## 0.2.1

Expand Down
2 changes: 1 addition & 1 deletion crates/js-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3390,7 +3390,7 @@ extern "C" {
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString)
#[wasm_bindgen(method, js_name = toLocaleTimeString)]
pub fn to_locale_time_string(this: &Date, locale: &str) -> JsString;
pub fn to_locale_time_string(this: &Date, locale: &str, options: &JsValue) -> JsString;

/// The `toString()` method returns a string representing
/// the specified Date object.
Expand Down
2 changes: 1 addition & 1 deletion crates/js-sys/tests/wasm/Date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ fn to_locale_string() {
fn to_locale_time_string() {
let date = Date::new(&"August 19, 1975 23:15:30".into());
assert_eq!(
JsValue::from(date.to_locale_time_string("en-US")),
JsValue::from(date.to_locale_time_string("en-US", &JsValue::undefined())),
"11:15:30 PM",
);
}
Expand Down

0 comments on commit 33edc25

Please sign in to comment.