From 61067015419989e4232172df2fa6678825b071f7 Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:51:32 +0300 Subject: [PATCH 1/9] Extract necessary imports to a single block --- core/engine/src/builtins/date/mod.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/core/engine/src/builtins/date/mod.rs b/core/engine/src/builtins/date/mod.rs index 0c82b5b570f..f4e68140632 100644 --- a/core/engine/src/builtins/date/mod.rs +++ b/core/engine/src/builtins/date/mod.rs @@ -32,6 +32,11 @@ use crate::{ use boa_gc::{Finalize, Trace}; use boa_macros::js_str; +#[cfg(feature = "intl")] +use crate::builtins::intl::date_time_format::{ + FormatDefaults, FormatType, format_date_time_locale, +}; + pub(crate) mod utils; #[cfg(test)] @@ -1657,9 +1662,6 @@ impl Date { ) -> JsResult { #[cfg(feature = "intl")] { - use crate::builtins::intl::date_time_format::{ - FormatDefaults, FormatType, format_date_time_locale, - }; // 1. Let dateObject be the this value. // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). // 3. Let x be dateObject.[[DateValue]]. @@ -1711,9 +1713,6 @@ impl Date { ) -> JsResult { #[cfg(feature = "intl")] { - use crate::builtins::intl::date_time_format::{ - FormatDefaults, FormatType, format_date_time_locale, - }; // 1. Let dateObject be the this value. // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). // 3. Let x be dateObject.[[DateValue]]. @@ -1766,9 +1765,6 @@ impl Date { ) -> JsResult { #[cfg(feature = "intl")] { - use crate::builtins::intl::date_time_format::{ - FormatDefaults, FormatType, format_date_time_locale, - }; // 1. Let dateObject be the this value. // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). // 3. Let x be dateObject.[[DateValue]]. From bb1796da151ffcd4204072250ce72354de3fc99a Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:54:29 +0300 Subject: [PATCH 2/9] Rename `dateObject` variable to `x` as in spec --- core/engine/src/builtins/date/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/engine/src/builtins/date/mod.rs b/core/engine/src/builtins/date/mod.rs index f4e68140632..a1396040180 100644 --- a/core/engine/src/builtins/date/mod.rs +++ b/core/engine/src/builtins/date/mod.rs @@ -1665,13 +1665,13 @@ impl Date { // 1. Let dateObject be the this value. // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). // 3. Let x be dateObject.[[DateValue]]. - let t = this + let x = this .as_object() .and_then(|obj| obj.downcast_ref::().as_deref().copied()) .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? .0; // 4. If x is NaN, return "Invalid Date". - if t.is_nan() { + if x.is_nan() { return Ok(JsValue::new(js_string!("Invalid Date"))); } // 5. Let dateFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, date, date). @@ -1683,7 +1683,7 @@ impl Date { options, FormatType::Date, FormatDefaults::Date, - t, + x, context, ) } @@ -1716,13 +1716,13 @@ impl Date { // 1. Let dateObject be the this value. // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). // 3. Let x be dateObject.[[DateValue]]. - let t = this + let x = this .as_object() .and_then(|obj| obj.downcast_ref::().as_deref().copied()) .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? .0; // 4. If x is NaN, return "Invalid Date". - if t.is_nan() { + if x.is_nan() { return Ok(JsValue::new(js_string!("Invalid Date"))); } // 5. Let dateFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, any, all). @@ -1734,7 +1734,7 @@ impl Date { options, FormatType::Any, FormatDefaults::All, - t, + x, context, ) } @@ -1768,13 +1768,13 @@ impl Date { // 1. Let dateObject be the this value. // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). // 3. Let x be dateObject.[[DateValue]]. - let t = this + let x = this .as_object() .and_then(|obj| obj.downcast_ref::().as_deref().copied()) .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? .0; // 4. If x is NaN, return "Invalid Date". - if t.is_nan() { + if x.is_nan() { return Ok(JsValue::new(js_string!("Invalid Date"))); } // 5. Let timeFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, time, time). @@ -1786,7 +1786,7 @@ impl Date { options, FormatType::Time, FormatDefaults::Time, - t, + x, context, ) } From 870c11515e482bce597af432b3c3b05e2669d4f5 Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Sat, 20 Jun 2026 05:53:33 +0300 Subject: [PATCH 3/9] Introduce shared implementation --- core/engine/src/builtins/date/mod.rs | 107 +++++++++------------------ 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/core/engine/src/builtins/date/mod.rs b/core/engine/src/builtins/date/mod.rs index a1396040180..dbd555c4134 100644 --- a/core/engine/src/builtins/date/mod.rs +++ b/core/engine/src/builtins/date/mod.rs @@ -1641,6 +1641,38 @@ impl Date { func.call(this, &[], context) } + /// Shared implementation of `Date.prototype.toLocaleString`, + /// `Date.prototype.toLocaleDateString`, and `Date.prototype.toLocaleTimeString` + /// methods with the corresponding formatting params + #[inline] + fn to_locale_string_with( + this: &JsValue, + args: &[JsValue], + required: FormatType, + defaults: FormatDefaults, + context: &mut Context, + ) -> JsResult { + // 1. Let dateObject be the this value. + // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). + // 3. Let x be dateObject.[[DateValue]]. + let x = this + .as_object() + .and_then(|obj| obj.downcast_ref::().as_deref().copied()) + .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? + .0; + + // 4. If x is NaN, return "Invalid Date". + if x.is_nan() { + return Ok(JsValue::new(js_string!("Invalid Date"))); + } + + // 5. Let dateFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, required, defaults). + // 6. Return ! FormatDateTime(dateFormat, x). + let locales = args.get_or_undefined(0); + let options = args.get_or_undefined(1); + format_date_time_locale(locales, options, required, defaults, x, context) + } + /// [`Date.prototype.toLocaleDateString()`][spec]. /// /// The `toLocaleDateString()` method returns the date portion of the given Date instance according @@ -1662,30 +1694,7 @@ impl Date { ) -> JsResult { #[cfg(feature = "intl")] { - // 1. Let dateObject be the this value. - // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). - // 3. Let x be dateObject.[[DateValue]]. - let x = this - .as_object() - .and_then(|obj| obj.downcast_ref::().as_deref().copied()) - .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? - .0; - // 4. If x is NaN, return "Invalid Date". - if x.is_nan() { - return Ok(JsValue::new(js_string!("Invalid Date"))); - } - // 5. Let dateFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, date, date). - // 6. Return ! FormatDateTime(dateFormat, x). - let locales = args.get_or_undefined(0); - let options = args.get_or_undefined(1); - format_date_time_locale( - locales, - options, - FormatType::Date, - FormatDefaults::Date, - x, - context, - ) + Self::to_locale_string_with(this, args, FormatType::Date, FormatDefaults::Date, context) } #[cfg(not(feature = "intl"))] { @@ -1713,30 +1722,7 @@ impl Date { ) -> JsResult { #[cfg(feature = "intl")] { - // 1. Let dateObject be the this value. - // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). - // 3. Let x be dateObject.[[DateValue]]. - let x = this - .as_object() - .and_then(|obj| obj.downcast_ref::().as_deref().copied()) - .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? - .0; - // 4. If x is NaN, return "Invalid Date". - if x.is_nan() { - return Ok(JsValue::new(js_string!("Invalid Date"))); - } - // 5. Let dateFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, any, all). - // 6. Return ! FormatDateTime(dateFormat, x). - let locales = args.get_or_undefined(0); - let options = args.get_or_undefined(1); - format_date_time_locale( - locales, - options, - FormatType::Any, - FormatDefaults::All, - x, - context, - ) + Self::to_locale_string_with(this, args, FormatType::Any, FormatDefaults::All, context) } #[cfg(not(feature = "intl"))] { @@ -1765,30 +1751,7 @@ impl Date { ) -> JsResult { #[cfg(feature = "intl")] { - // 1. Let dateObject be the this value. - // 2. Perform ? RequireInternalSlot(dateObject, [[DateValue]]). - // 3. Let x be dateObject.[[DateValue]]. - let x = this - .as_object() - .and_then(|obj| obj.downcast_ref::().as_deref().copied()) - .ok_or_else(|| JsNativeError::typ().with_message("'this' is not a Date"))? - .0; - // 4. If x is NaN, return "Invalid Date". - if x.is_nan() { - return Ok(JsValue::new(js_string!("Invalid Date"))); - } - // 5. Let timeFormat be ? CreateDateTimeFormat(%Intl.DateTimeFormat%, locales, options, time, time). - // 6. Return ! FormatDateTime(timeFormat, x). - let locales = args.get_or_undefined(0); - let options = args.get_or_undefined(1); - format_date_time_locale( - locales, - options, - FormatType::Time, - FormatDefaults::Time, - x, - context, - ) + Self::to_locale_string_with(this, args, FormatType::Time, FormatDefaults::Time, context) } #[cfg(not(feature = "intl"))] { From 00a536e4736b63275fae265d27af805bbda672f0 Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Sat, 20 Jun 2026 22:10:29 +0300 Subject: [PATCH 4/9] Remove `format_date_time_locale` --- core/engine/src/builtins/date/mod.rs | 5 +- .../src/builtins/intl/date_time_format/mod.rs | 56 +++++++++---------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/core/engine/src/builtins/date/mod.rs b/core/engine/src/builtins/date/mod.rs index dbd555c4134..2fc68d6e60f 100644 --- a/core/engine/src/builtins/date/mod.rs +++ b/core/engine/src/builtins/date/mod.rs @@ -34,7 +34,7 @@ use boa_macros::js_str; #[cfg(feature = "intl")] use crate::builtins::intl::date_time_format::{ - FormatDefaults, FormatType, format_date_time_locale, + FormatDefaults, FormatType, create_date_time_format, format_timestamp_with_dtf, }; pub(crate) mod utils; @@ -1670,7 +1670,8 @@ impl Date { // 6. Return ! FormatDateTime(dateFormat, x). let locales = args.get_or_undefined(0); let options = args.get_or_undefined(1); - format_date_time_locale(locales, options, required, defaults, x, context) + let dtf = create_date_time_format(locales, options, required, defaults, context)?; + format_timestamp_with_dtf(&dtf, x, context) } /// [`Date.prototype.toLocaleDateString()`][spec]. diff --git a/core/engine/src/builtins/intl/date_time_format/mod.rs b/core/engine/src/builtins/intl/date_time_format/mod.rs index b888eebbe21..38f0084d16d 100644 --- a/core/engine/src/builtins/intl/date_time_format/mod.rs +++ b/core/engine/src/builtins/intl/date_time_format/mod.rs @@ -283,8 +283,7 @@ impl DateTimeFormat { if x.is_nan() { return Err(js_error!(RangeError: "formatted date cannot be NaN")); } - let result = format_timestamp_with_dtf(dtf.borrow().data(), x, context)?; - Ok(JsValue::from(result)) + format_timestamp_with_dtf(dtf.borrow().data(), x, context) }, dtf_clone, ), @@ -849,11 +848,11 @@ pub(crate) fn create_date_time_format( /// /// Then calls `ToLocalTime::from_local_epoch_milliseconds` to obtain calendar fields, /// and formats the resulting `ZonedDateTime` with ICU4X. -fn format_timestamp_with_dtf( +pub(crate) fn format_timestamp_with_dtf( dtf: &DateTimeFormat, timestamp: f64, context: &mut Context, -) -> JsResult { +) -> JsResult { // PartitionDateTimePattern ( dtf, x ) step 3: // Let epochNanoseconds be ℤ(ℝ(x) × 10^6). // @@ -895,7 +894,7 @@ fn format_timestamp_with_dtf( zone: tz_info_at_time, }; let result = dtf.formatter.format(&zdt).to_string(); - Ok(JsString::from(result)) + Ok(JsString::from(result).into()) } fn date_time_style_format( @@ -1011,27 +1010,26 @@ fn unwrap_date_time_format( .into()) } -/// Shared helper used by Date.prototype.toLocaleString, -/// Date.prototype.toLocaleDateString, and Date.prototype.toLocaleTimeString. -/// Applies `ToDateTimeOptions` defaults, calls [`create_date_time_format`], and formats -/// the timestamp via [`format_timestamp_with_dtf`] without allocating a JS object. -#[allow(clippy::too_many_arguments)] -pub(crate) fn format_date_time_locale( - locales: &JsValue, - options: &JsValue, - format_type: FormatType, - defaults: FormatDefaults, - timestamp: f64, - context: &mut Context, -) -> JsResult { - let options = coerce_options_to_object(options, context)?; - let options_value = options.into(); - let dtf = create_date_time_format(locales, &options_value, format_type, defaults, context)?; - // FormatDateTime steps 1–2: TimeClip and NaN check (format_timestamp_with_dtf does ToLocalTime + format only). - let x = time_clip(timestamp); - if x.is_nan() { - return Err(js_error!(RangeError: "formatted date cannot be NaN")); - } - let result = format_timestamp_with_dtf(&dtf, x, context)?; - Ok(JsValue::from(result)) -} +// /// Shared helper used by Date.prototype.toLocaleString, +// /// Date.prototype.toLocaleDateString, and Date.prototype.toLocaleTimeString. +// /// Applies `ToDateTimeOptions` defaults, calls [`create_date_time_format`], and formats +// /// the timestamp via [`format_timestamp_with_dtf`] without allocating a JS object. +// #[allow(clippy::too_many_arguments)] +// pub(crate) fn format_date_time_locale( +// locales: &JsValue, +// options: &JsValue, +// format_type: FormatType, +// defaults: FormatDefaults, +// timestamp: f64, +// context: &mut Context, +// ) -> JsResult { +// let options = coerce_options_to_object(options, context)?; +// let options_value = options.into(); +// // FormatDateTime steps 1–2: TimeClip and NaN check (format_timestamp_with_dtf does ToLocalTime + format only). +// let x = time_clip(timestamp); +// if x.is_nan() { +// return Err(js_error!(RangeError: "formatted date cannot be NaN")); +// } +// let result = format_timestamp_with_dtf(&dtf, x, context)?; +// Ok(JsValue::from(result)) +// } From bd05f96c82894bb7542d6a6e42fff85131ee555b Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Sat, 20 Jun 2026 22:15:55 +0300 Subject: [PATCH 5/9] Update `format_timestamp_with_dtf` --- .../src/builtins/intl/date_time_format/mod.rs | 55 +++++-------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/core/engine/src/builtins/intl/date_time_format/mod.rs b/core/engine/src/builtins/intl/date_time_format/mod.rs index 38f0084d16d..ba9a0a77f66 100644 --- a/core/engine/src/builtins/intl/date_time_format/mod.rs +++ b/core/engine/src/builtins/intl/date_time_format/mod.rs @@ -278,11 +278,6 @@ impl DateTimeFormat { }; // 5. Return ? FormatDateTime(dtf, x). - // A.O 11.5.6 PartitionDateTimePattern: 1. TimeClip(x). 2. If NaN throw. Then ToLocalTime and format. - let x = time_clip(x); - if x.is_nan() { - return Err(js_error!(RangeError: "formatted date cannot be NaN")); - } format_timestamp_with_dtf(dtf.borrow().data(), x, context) }, dtf_clone, @@ -829,18 +824,15 @@ pub(crate) fn create_date_time_format( /// - the bound `format` function created in `get_format`, and /// - [`format_date_time_locale`] used by `Date.prototype.toLocaleString` (and friends). /// -/// It corresponds to the *post*-`TimeClip` portion of -/// [`FormatDateTime(dtf, x)`](https://tc39.es/ecma402/#sec-formatdatetime), -/// and the `ToLocalTime` / `PartitionDateTimePattern` logic from +/// It corresponds the `ToLocalTime` / `PartitionDateTimePattern` logic from /// [11.5.6](https://tc39.es/ecma402/#sec-partitiondatetimepattern) and /// [11.5.12](https://tc39.es/ecma402/#sec-tolocaltime). /// -/// Callers must have already applied `TimeClip` and `NaN` check -/// (`FormatDateTime` steps 1–2). This helper implements: +/// This helper implements: /// /// 11.5.6 `PartitionDateTimePattern` ( dtf, x ) -/// 1. Let x be TimeClip(x). (Done by caller) -/// 2. If x is `NaN`, throw a `RangeError` exception. (Done by caller) +/// 1. Let x be TimeClip(x). +/// 2. If x is `NaN`, throw a `RangeError` exception. /// 3. Let epochNanoseconds be ℤ(ℝ(x) × 10^6). /// 4. Let timeZone be dtf.[[`TimeZone`]]. /// 5. Let offsetNs be GetOffsetNanosecondsFor(timeZone, epochNanoseconds). @@ -853,11 +845,18 @@ pub(crate) fn format_timestamp_with_dtf( timestamp: f64, context: &mut Context, ) -> JsResult { + // PartitionDateTimePattern ( dtf, x ) step 1: + // 1. Let x be TimeClip(x). + let x = time_clip(timestamp); + + // PartitionDateTimePattern ( dtf, x ) step 2: + // 2. If x is `NaN`, throw a `RangeError` exception. + if x.is_nan() { + return Err(js_error!(RangeError: "formatted date cannot be NaN")); + } // PartitionDateTimePattern ( dtf, x ) step 3: // Let epochNanoseconds be ℤ(ℝ(x) × 10^6). - // - // NOTE: `timestamp` is already `TimeClip`'d by the caller and represents *UTC epoch milliseconds*. - let epoch_ns = timestamp as i128 * 1_000_000; + let epoch_ns = x as i128 * 1_000_000; // PartitionDateTimePattern ( dtf, x ) step 4: // Let timeZone be dtf.[[`TimeZone`]]. @@ -883,7 +882,7 @@ pub(crate) fn format_timestamp_with_dtf( // PartitionDateTimePattern ( dtf, x ) step 6: // Let tz be 𝔽(ℝ(x) + ℝ(offsetNs) / 10^6). - let tz = timestamp + f64::from(time_zone_offset_seconds * 1_000); + let tz = x + f64::from(time_zone_offset_seconds * 1_000); let fields = ToLocalTime::from_local_epoch_milliseconds(tz)?; let dt = fields.to_formattable_datetime()?; let tz_info = time_zone.to_time_zone_info(); @@ -1009,27 +1008,3 @@ fn unwrap_date_time_format( .with_message("object was not an initialized `Intl.DateTimeFormat` object") .into()) } - -// /// Shared helper used by Date.prototype.toLocaleString, -// /// Date.prototype.toLocaleDateString, and Date.prototype.toLocaleTimeString. -// /// Applies `ToDateTimeOptions` defaults, calls [`create_date_time_format`], and formats -// /// the timestamp via [`format_timestamp_with_dtf`] without allocating a JS object. -// #[allow(clippy::too_many_arguments)] -// pub(crate) fn format_date_time_locale( -// locales: &JsValue, -// options: &JsValue, -// format_type: FormatType, -// defaults: FormatDefaults, -// timestamp: f64, -// context: &mut Context, -// ) -> JsResult { -// let options = coerce_options_to_object(options, context)?; -// let options_value = options.into(); -// // FormatDateTime steps 1–2: TimeClip and NaN check (format_timestamp_with_dtf does ToLocalTime + format only). -// let x = time_clip(timestamp); -// if x.is_nan() { -// return Err(js_error!(RangeError: "formatted date cannot be NaN")); -// } -// let result = format_timestamp_with_dtf(&dtf, x, context)?; -// Ok(JsValue::from(result)) -// } From 325a17628d0cb77204cfdceaff0ea1bb03921a67 Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Sun, 21 Jun 2026 17:07:40 +0300 Subject: [PATCH 6/9] Gate `to_locale_string_with` behind `intl` flag --- core/engine/src/builtins/date/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/core/engine/src/builtins/date/mod.rs b/core/engine/src/builtins/date/mod.rs index 2fc68d6e60f..7e183b16164 100644 --- a/core/engine/src/builtins/date/mod.rs +++ b/core/engine/src/builtins/date/mod.rs @@ -1644,6 +1644,7 @@ impl Date { /// Shared implementation of `Date.prototype.toLocaleString`, /// `Date.prototype.toLocaleDateString`, and `Date.prototype.toLocaleTimeString` /// methods with the corresponding formatting params + #[cfg(feature = "intl")] #[inline] fn to_locale_string_with( this: &JsValue, From 70656484f98988c4d1fa16073e0183b7b48e8af4 Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Sun, 21 Jun 2026 17:24:19 +0300 Subject: [PATCH 7/9] Remove unnecessary `allow` attributes --- core/engine/src/builtins/date/mod.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/core/engine/src/builtins/date/mod.rs b/core/engine/src/builtins/date/mod.rs index 7e183b16164..0e9c56e79d1 100644 --- a/core/engine/src/builtins/date/mod.rs +++ b/core/engine/src/builtins/date/mod.rs @@ -1685,10 +1685,6 @@ impl Date { /// /// [spec]: https://tc39.es/ecma402/#sup-date.prototype.tolocaledatestring /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString - #[allow( - unused_variables, - reason = "`args` and `context` are used when the `intl` feature is enabled" - )] pub(crate) fn to_locale_date_string( this: &JsValue, args: &[JsValue], @@ -1700,7 +1696,7 @@ impl Date { } #[cfg(not(feature = "intl"))] { - Self::to_string(this, &[], context) + Self::to_string(this, args, context) } } @@ -1713,10 +1709,6 @@ impl Date { /// /// [spec]: https://tc39.es/ecma402/#sup-date.prototype.tolocalestring /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString - #[allow( - unused_variables, - reason = "`args` and `context` are used when the `intl` feature is enabled" - )] pub(crate) fn to_locale_string( this: &JsValue, args: &[JsValue], @@ -1728,7 +1720,7 @@ impl Date { } #[cfg(not(feature = "intl"))] { - Self::to_string(this, &[], context) + Self::to_string(this, args, context) } } @@ -1742,10 +1734,6 @@ impl Date { /// /// [spec]: https://tc39.es/ecma402/#sup-date.prototype.tolocaletimestring /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString - #[allow( - unused_variables, - reason = "`args` and `context` are used when the `intl` feature is enabled" - )] pub(crate) fn to_locale_time_string( this: &JsValue, args: &[JsValue], @@ -1757,7 +1745,7 @@ impl Date { } #[cfg(not(feature = "intl"))] { - Self::to_string(this, &[], context) + Self::to_string(this, args, context) } } From a8b821675d338bb47f97a75b5cd24738141fc88a Mon Sep 17 00:00:00 2001 From: Vellumic <161718748+Vellumic@users.noreply.github.com> Date: Sun, 21 Jun 2026 19:55:21 +0300 Subject: [PATCH 8/9] Improve some doc comments --- core/engine/src/builtins/intl/date_time_format/mod.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/core/engine/src/builtins/intl/date_time_format/mod.rs b/core/engine/src/builtins/intl/date_time_format/mod.rs index ba9a0a77f66..05b5827e232 100644 --- a/core/engine/src/builtins/intl/date_time_format/mod.rs +++ b/core/engine/src/builtins/intl/date_time_format/mod.rs @@ -820,10 +820,6 @@ pub(crate) fn create_date_time_format( /// Formats a timestamp (epoch milliseconds) using the given [`DateTimeFormat`] internals. /// -/// This is the shared implementation used by: -/// - the bound `format` function created in `get_format`, and -/// - [`format_date_time_locale`] used by `Date.prototype.toLocaleString` (and friends). -/// /// It corresponds the `ToLocalTime` / `PartitionDateTimePattern` logic from /// [11.5.6](https://tc39.es/ecma402/#sec-partitiondatetimepattern) and /// [11.5.12](https://tc39.es/ecma402/#sec-tolocaltime). @@ -938,8 +934,7 @@ fn best_fit_date_time_format(format_options: &FormatOptions) -> JsResult Date: Fri, 26 Jun 2026 21:09:23 +0300 Subject: [PATCH 9/9] Change doc comment --- core/engine/src/builtins/intl/date_time_format/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/engine/src/builtins/intl/date_time_format/mod.rs b/core/engine/src/builtins/intl/date_time_format/mod.rs index 05b5827e232..2b28d1b8f66 100644 --- a/core/engine/src/builtins/intl/date_time_format/mod.rs +++ b/core/engine/src/builtins/intl/date_time_format/mod.rs @@ -820,9 +820,10 @@ pub(crate) fn create_date_time_format( /// Formats a timestamp (epoch milliseconds) using the given [`DateTimeFormat`] internals. /// -/// It corresponds the `ToLocalTime` / `PartitionDateTimePattern` logic from -/// [11.5.6](https://tc39.es/ecma402/#sec-partitiondatetimepattern) and -/// [11.5.12](https://tc39.es/ecma402/#sec-tolocaltime). +/// It corresponds the logic from [`PartitionDateTimePattern`][11.5.6] and [`ToLocalTime`][11.5.12]. +/// +/// [11.5.6]: https://tc39.es/ecma402/#sec-partitiondatetimepattern +/// [11.5.12]: https://tc39.es/ecma402/#sec-tolocaltime /// /// This helper implements: ///