From ba6136d43e2daa159c6d17c7f0685ff284176672 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Sat, 11 Jan 2025 10:29:20 -0600 Subject: [PATCH 01/10] Bump temporal_rs and add Date string methods --- Cargo.lock | 3 +- Cargo.toml | 2 +- core/engine/src/builtins/temporal/options.rs | 4 +-- .../src/builtins/temporal/plain_date/mod.rs | 31 ++++++++++++++++++- .../builtins/temporal/plain_month_day/mod.rs | 14 ++++----- .../builtins/temporal/plain_year_month/mod.rs | 14 ++++----- 6 files changed, 49 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d91d84fa0a8..67eda682304 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3541,7 +3541,7 @@ checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" [[package]] name = "temporal_rs" version = "0.0.4" -source = "git+https://github.com/boa-dev/temporal.git?rev=8b796edec18a2652af282735aab4a2d0512b9a1d#8b796edec18a2652af282735aab4a2d0512b9a1d" +source = "git+https://github.com/boa-dev/temporal.git?rev=436b07d9b27e3e2274905c9a4eabf8bbff9ad9ec#436b07d9b27e3e2274905c9a4eabf8bbff9ad9ec" dependencies = [ "bitflags 2.6.0", "combine", @@ -3554,6 +3554,7 @@ dependencies = [ "tinystr 0.8.0", "tzif", "web-time", + "writeable 0.6.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b411f795297..951f1f0f9a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ intrusive-collections = "0.9.7" cfg-if = "1.0.0" either = "1.13.0" sys-locale = "0.3.2" -temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "8b796edec18a2652af282735aab4a2d0512b9a1d", features = ["tzdb", "now"] } +temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "436b07d9b27e3e2274905c9a4eabf8bbff9ad9ec", features = ["tzdb"] } web-time = "1.1.0" criterion = "0.5.1" float-cmp = "0.10.0" diff --git a/core/engine/src/builtins/temporal/options.rs b/core/engine/src/builtins/temporal/options.rs index 46883c52eeb..f1744e321a8 100644 --- a/core/engine/src/builtins/temporal/options.rs +++ b/core/engine/src/builtins/temporal/options.rs @@ -13,7 +13,7 @@ use crate::{ js_string, Context, JsNativeError, JsObject, JsResult, JsString, JsValue, }; use temporal_rs::options::{ - ArithmeticOverflow, CalendarName, DifferenceSettings, Disambiguation, DurationOverflow, + ArithmeticOverflow, DisplayCalendar, DifferenceSettings, Disambiguation, DurationOverflow, OffsetDisambiguation, RoundingIncrement, TemporalRoundingMode, TemporalUnit, }; @@ -116,7 +116,7 @@ impl ParsableOptionType for DurationOverflow {} impl ParsableOptionType for Disambiguation {} impl ParsableOptionType for OffsetDisambiguation {} impl ParsableOptionType for TemporalRoundingMode {} -impl ParsableOptionType for CalendarName {} +impl ParsableOptionType for DisplayCalendar {} impl OptionType for RoundingIncrement { fn from_value(value: JsValue, context: &mut Context) -> JsResult { diff --git a/core/engine/src/builtins/temporal/plain_date/mod.rs b/core/engine/src/builtins/temporal/plain_date/mod.rs index a173a320c74..f680b8f939f 100644 --- a/core/engine/src/builtins/temporal/plain_date/mod.rs +++ b/core/engine/src/builtins/temporal/plain_date/mod.rs @@ -20,7 +20,7 @@ use crate::{ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use temporal_rs::{ - options::ArithmeticOverflow, partial::PartialDate, PlainDate as InnerDate, TinyAsciiStr, + options::{ArithmeticOverflow, DisplayCalendar}, partial::PartialDate, PlainDate as InnerDate, TinyAsciiStr, }; use super::{ @@ -214,6 +214,8 @@ impl IntrinsicObject for PlainDate { .method(Self::since, js_string!("since"), 1) .method(Self::equals, js_string!("equals"), 1) .method(Self::to_plain_datetime, js_string!("toPlainDateTime"), 0) + .method(Self::to_string, js_string!("toString"), 0) + .method(Self::to_json, js_string!("toJSON"), 0) .method(Self::value_of, js_string!("valueOf"), 0) .build(); } @@ -730,6 +732,33 @@ impl PlainDate { create_temporal_datetime(date.inner.to_date_time(time)?, None, context).map(Into::into) } + /// 3.3.30 `Temporal.PlainDate.prototype.toString ( [ options ] )` + fn to_string(this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { + let date = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a PlainDate object.") + })?; + + let options = get_options_object(args.get_or_undefined(0))?; + let display_calendar = get_option::(&options, js_string!("calendarName"), context)?.unwrap_or(DisplayCalendar::Auto); + Ok(JsString::from(date.inner.to_ixdtf_string(display_calendar)).into()) + } + + // 3.3.32 `Temporal.PlainDate.prototype.toJSON ( )` + fn to_json(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { + let date = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a PlainDate object.") + })?; + + Ok(JsString::from(date.inner.to_string()).into()) + } + + /// 3.3.33 `Temporal.PlainDate.prototype.valueOf ( )` pub(crate) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { Err(JsNativeError::typ() .with_message("`valueOf` not supported by Temporal built-ins. See 'compare', 'equals', or `toString`") diff --git a/core/engine/src/builtins/temporal/plain_month_day/mod.rs b/core/engine/src/builtins/temporal/plain_month_day/mod.rs index 26f20b203b0..8030d1cf07a 100644 --- a/core/engine/src/builtins/temporal/plain_month_day/mod.rs +++ b/core/engine/src/builtins/temporal/plain_month_day/mod.rs @@ -20,7 +20,7 @@ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use temporal_rs::{ - options::{ArithmeticOverflow, CalendarName}, + options::{ArithmeticOverflow, DisplayCalendar}, partial::PartialDate, PlainMonthDay as InnerMonthDay, TinyAsciiStr, }; @@ -110,8 +110,8 @@ impl PlainMonthDay { // 4. Let showCalendar be ? ToShowCalendarOption(options). // Get calendarName from the options object let show_calendar = - get_option::(&options, js_string!("calendarName"), context)? - .unwrap_or(CalendarName::Auto); + get_option::(&options, js_string!("calendarName"), context)? + .unwrap_or(DisplayCalendar::Auto); Ok(month_day_to_string(inner, show_calendar)) } @@ -231,7 +231,7 @@ impl BuiltInConstructor for PlainMonthDay { // ==== `PlainMonthDay` Abstract Operations ==== -fn month_day_to_string(inner: &InnerMonthDay, show_calendar: CalendarName) -> JsValue { +fn month_day_to_string(inner: &InnerMonthDay, show_calendar: DisplayCalendar) -> JsValue { // Let month be monthDay.[[ISOMonth]] formatted as a two-digit decimal number, padded to the left with a zero if necessary let month = inner.iso_month().to_string(); @@ -252,11 +252,11 @@ fn month_day_to_string(inner: &InnerMonthDay, show_calendar: CalendarName) -> Js // b. Set result to the string-concatenation of result, the code unit 0x0040 (COMMERCIAL AT), and calendarString. if (matches!( show_calendar, - CalendarName::Critical | CalendarName::Always | CalendarName::Auto - )) && !(matches!(show_calendar, CalendarName::Auto) && calendar_id == "iso8601") + DisplayCalendar::Critical | DisplayCalendar::Always | DisplayCalendar::Auto + )) && !(matches!(show_calendar, DisplayCalendar::Auto) && calendar_id == "iso8601") { let year = inner.iso_year().to_string(); - let flag = if matches!(show_calendar, CalendarName::Critical) { + let flag = if matches!(show_calendar, DisplayCalendar::Critical) { "!" } else { "" diff --git a/core/engine/src/builtins/temporal/plain_year_month/mod.rs b/core/engine/src/builtins/temporal/plain_year_month/mod.rs index 389858c044b..b06cbfa1403 100644 --- a/core/engine/src/builtins/temporal/plain_year_month/mod.rs +++ b/core/engine/src/builtins/temporal/plain_year_month/mod.rs @@ -20,7 +20,7 @@ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use temporal_rs::{ - options::{ArithmeticOverflow, CalendarName}, + options::{ArithmeticOverflow, DisplayCalendar}, Duration, PlainYearMonth as InnerYearMonth, }; @@ -433,8 +433,8 @@ impl PlainYearMonth { // 4. Let showCalendar be ? ToShowCalendarOption(options). // Get calendarName from the options object let show_calendar = - get_option::(&options, js_string!("calendarName"), context)? - .unwrap_or(CalendarName::Auto); + get_option::(&options, js_string!("calendarName"), context)? + .unwrap_or(DisplayCalendar::Auto); Ok(year_month_to_string(inner, show_calendar)) } @@ -529,7 +529,7 @@ fn add_or_subtract_duration( create_temporal_year_month(year_month_result, None, context) } -fn year_month_to_string(inner: &InnerYearMonth, show_calendar: CalendarName) -> JsValue { +fn year_month_to_string(inner: &InnerYearMonth, show_calendar: DisplayCalendar) -> JsValue { // Let year be PadISOYear(yearMonth.[[ISOYear]]). let year = inner.padded_iso_year_string(); // Let month be ToZeroPaddedDecimalString(yearMonth.[[ISOMonth]], 2). @@ -545,12 +545,12 @@ fn year_month_to_string(inner: &InnerYearMonth, show_calendar: CalendarName) -> // 7. Set result to the string-concatenation of result and calendarString. if matches!( show_calendar, - CalendarName::Critical | CalendarName::Always | CalendarName::Auto - ) && !(matches!(show_calendar, CalendarName::Auto) && inner.calendar_id() == "iso8601") + DisplayCalendar::Critical | DisplayCalendar::Always | DisplayCalendar::Auto + ) && !(matches!(show_calendar, DisplayCalendar::Auto) && inner.calendar_id() == "iso8601") { let calendar = inner.calendar_id(); let calendar_string = calendar.to_string(); - let flag = if matches!(show_calendar, CalendarName::Critical) { + let flag = if matches!(show_calendar, DisplayCalendar::Critical) { "!" } else { "" From 7071dd20cf523095945f50236696ef4d1fbc1f84 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Sat, 11 Jan 2025 10:29:37 -0600 Subject: [PATCH 02/10] Add zdt handling in to_instant op --- core/engine/src/builtins/temporal/instant/mod.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/engine/src/builtins/temporal/instant/mod.rs b/core/engine/src/builtins/temporal/instant/mod.rs index 366fe7bcfe9..988efa332ab 100644 --- a/core/engine/src/builtins/temporal/instant/mod.rs +++ b/core/engine/src/builtins/temporal/instant/mod.rs @@ -531,10 +531,8 @@ fn to_temporal_instant(item: &JsValue, context: &mut Context) -> JsResult() { return Ok(instant.inner); - } else if let Some(_zdt) = obj.downcast_ref::() { - return Err(JsNativeError::error() - .with_message("Not yet implemented.") - .into()); + } else if let Some(zdt) = obj.downcast_ref::() { + return Ok(zdt.inner.to_instant()) } item.to_primitive(context, PreferredType::String)? } else { From 2ac348a83fa982e91559fe0944bab7ddc53d7c34 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Sat, 11 Jan 2025 10:31:56 -0600 Subject: [PATCH 03/10] Cargo fmt --- core/engine/src/builtins/temporal/instant/mod.rs | 2 +- core/engine/src/builtins/temporal/options.rs | 2 +- core/engine/src/builtins/temporal/plain_date/mod.rs | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/engine/src/builtins/temporal/instant/mod.rs b/core/engine/src/builtins/temporal/instant/mod.rs index 988efa332ab..5177673d17a 100644 --- a/core/engine/src/builtins/temporal/instant/mod.rs +++ b/core/engine/src/builtins/temporal/instant/mod.rs @@ -532,7 +532,7 @@ fn to_temporal_instant(item: &JsValue, context: &mut Context) -> JsResult() { return Ok(instant.inner); } else if let Some(zdt) = obj.downcast_ref::() { - return Ok(zdt.inner.to_instant()) + return Ok(zdt.inner.to_instant()); } item.to_primitive(context, PreferredType::String)? } else { diff --git a/core/engine/src/builtins/temporal/options.rs b/core/engine/src/builtins/temporal/options.rs index f1744e321a8..3213435bbab 100644 --- a/core/engine/src/builtins/temporal/options.rs +++ b/core/engine/src/builtins/temporal/options.rs @@ -13,7 +13,7 @@ use crate::{ js_string, Context, JsNativeError, JsObject, JsResult, JsString, JsValue, }; use temporal_rs::options::{ - ArithmeticOverflow, DisplayCalendar, DifferenceSettings, Disambiguation, DurationOverflow, + ArithmeticOverflow, DifferenceSettings, Disambiguation, DisplayCalendar, DurationOverflow, OffsetDisambiguation, RoundingIncrement, TemporalRoundingMode, TemporalUnit, }; diff --git a/core/engine/src/builtins/temporal/plain_date/mod.rs b/core/engine/src/builtins/temporal/plain_date/mod.rs index f680b8f939f..a008fb98217 100644 --- a/core/engine/src/builtins/temporal/plain_date/mod.rs +++ b/core/engine/src/builtins/temporal/plain_date/mod.rs @@ -20,7 +20,9 @@ use crate::{ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use temporal_rs::{ - options::{ArithmeticOverflow, DisplayCalendar}, partial::PartialDate, PlainDate as InnerDate, TinyAsciiStr, + options::{ArithmeticOverflow, DisplayCalendar}, + partial::PartialDate, + PlainDate as InnerDate, TinyAsciiStr, }; use super::{ @@ -742,7 +744,9 @@ impl PlainDate { })?; let options = get_options_object(args.get_or_undefined(0))?; - let display_calendar = get_option::(&options, js_string!("calendarName"), context)?.unwrap_or(DisplayCalendar::Auto); + let display_calendar = + get_option::(&options, js_string!("calendarName"), context)? + .unwrap_or(DisplayCalendar::Auto); Ok(JsString::from(date.inner.to_ixdtf_string(display_calendar)).into()) } From b64612713d03e43b6aca01ecab4c084123fb2ce0 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Sat, 11 Jan 2025 10:41:43 -0600 Subject: [PATCH 04/10] Fix failing test output --- core/engine/src/builtins/temporal/plain_date/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/engine/src/builtins/temporal/plain_date/tests.rs b/core/engine/src/builtins/temporal/plain_date/tests.rs index d98f5313e89..f492a3d61c1 100644 --- a/core/engine/src/builtins/temporal/plain_date/tests.rs +++ b/core/engine/src/builtins/temporal/plain_date/tests.rs @@ -41,6 +41,6 @@ fn string_null_option_value() { run_test_actions([TestAction::assert_native_error( "Temporal.PlainDate.from('1976-11-18Z', null)", JsNativeErrorKind::Range, - "Error: Unexpected character found after parsing was completed.", + "RangeError: Unexpected character found after parsing was completed.", )]); } From 6c3b86154c0dc454c44f7ab9dba9fd4165ffa27b Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Sat, 11 Jan 2025 23:57:40 -0600 Subject: [PATCH 05/10] Implement more supported to_string methods --- core/engine/src/builtins/temporal/options.rs | 38 ++++++++++++++++++- .../builtins/temporal/plain_date_time/mod.rs | 28 +++++++++++++- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/core/engine/src/builtins/temporal/options.rs b/core/engine/src/builtins/temporal/options.rs index 3213435bbab..b01fab6b5de 100644 --- a/core/engine/src/builtins/temporal/options.rs +++ b/core/engine/src/builtins/temporal/options.rs @@ -12,10 +12,10 @@ use crate::{ builtins::options::{get_option, OptionType, ParsableOptionType}, js_string, Context, JsNativeError, JsObject, JsResult, JsString, JsValue, }; -use temporal_rs::options::{ +use temporal_rs::{options::{ ArithmeticOverflow, DifferenceSettings, Disambiguation, DisplayCalendar, DurationOverflow, OffsetDisambiguation, RoundingIncrement, TemporalRoundingMode, TemporalUnit, -}; +}, parsers::Precision}; // TODO: Expand docs on the below options. @@ -62,6 +62,40 @@ pub(crate) fn get_difference_settings( Ok(settings) } +pub(crate) fn get_digits_option( + options: &JsObject, + context: &mut Context, +) -> JsResult { + // 1. Let digitsValue be ? Get(options, "fractionalSecondDigits"). + let digits_value = options.get(js_string!("fractionalSecondDigits"), context)?; + // 2. If digitsValue is undefined, return auto. + if digits_value.is_undefined() { + return Ok(Precision::Auto) + } + // 3. If digitsValue is not a Number, then + let Some(digits_number) = digits_value.as_number() else { + // a. If ? ToString(digitsValue) is not "auto", throw a RangeError exception. + if digits_value.to_string(context)? != js_string!("auto") { + return Err(JsNativeError::range().with_message("fractionalSecondDigits must be a digit or 'auto'").into()) + } + // b. Return auto. + return Ok(Precision::Auto) + }; + + // 4. If digitsValue is NaN, +∞𝔽, or -∞𝔽, throw a RangeError exception. + if !digits_number.is_finite() { + return Err(JsNativeError::range().with_message("fractionalSecondDigits must be a finite number").into()) + } + // 5. Let digitCount be floor(ℝ(digitsValue)). + let digits = digits_number.floor() as i32; + // 6. If digitCount < 0 or digitCount > 9, throw a RangeError exception. + if digits < 0 || digits > 9 { + return Err(JsNativeError::range().with_message("fractionalSecondDigits must be in an inclusive range of 0-9").into()) + } + // 7. Return digitCount. + Ok(Precision::Digit(digits as u8)) +} + #[derive(Debug, Clone, Copy)] #[allow(unused)] pub(crate) enum TemporalUnitGroup { diff --git a/core/engine/src/builtins/temporal/plain_date_time/mod.rs b/core/engine/src/builtins/temporal/plain_date_time/mod.rs index 7bd400448e2..34d9690d7c0 100644 --- a/core/engine/src/builtins/temporal/plain_date_time/mod.rs +++ b/core/engine/src/builtins/temporal/plain_date_time/mod.rs @@ -24,7 +24,7 @@ use boa_profiler::Profiler; mod tests; use temporal_rs::{ - options::{ArithmeticOverflow, RoundingIncrement, RoundingOptions, TemporalRoundingMode}, + options::{ArithmeticOverflow, DisplayCalendar, RoundingIncrement, RoundingOptions, TemporalRoundingMode, TemporalUnit, ToStringRoundingOptions}, partial::PartialDateTime, PlainDateTime as InnerDateTime, PlainTime, }; @@ -32,7 +32,7 @@ use temporal_rs::{ use super::{ calendar::{get_temporal_calendar_slot_value_with_default, to_temporal_calendar_slot_value}, create_temporal_duration, - options::{get_difference_settings, get_temporal_unit, TemporalUnitGroup}, + options::{get_difference_settings, get_digits_option, get_temporal_unit, TemporalUnitGroup}, to_temporal_duration_record, to_temporal_time, PlainDate, ZonedDateTime, }; use crate::value::JsVariant; @@ -279,6 +279,7 @@ impl IntrinsicObject for PlainDateTime { .method(Self::since, js_string!("since"), 1) .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) + .method(Self::to_string, js_string!("toString"), 0) .method(Self::value_of, js_string!("valueOf"), 0) .build(); } @@ -933,6 +934,29 @@ impl PlainDateTime { Ok((dt.inner == other).into()) } + fn to_string(this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { + let dt = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a PlainDateTime object.") + })?; + + let options = get_options_object(args.get_or_undefined(0))?; + + let show_calendar = get_option::(&options, js_string!("calendarName"), context)?.unwrap_or(DisplayCalendar::Auto); + let precision = get_digits_option(&options, context)?; + let rounding_mode = get_option::(&options, js_string!("roundingMode"), context)?; + let smallest_unit = get_option::(&options, js_string!("smallestUnit"), context)?; + + let ixdtf = dt.inner.to_ixdtf_string(ToStringRoundingOptions { + precision, + smallest_unit, + rounding_mode, + }, show_calendar)?; + Ok(JsString::from(ixdtf).into()) + } + pub(crate) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { Err(JsNativeError::typ() .with_message("`valueOf` not supported by Temporal built-ins. See 'compare', 'equals', or `toString`") From 40ea0c22cc222624671979584a2b2da4e1dca3c1 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Mon, 13 Jan 2025 00:04:08 -0600 Subject: [PATCH 06/10] Implement more to_string and to_json methods --- Cargo.lock | 2 +- Cargo.toml | 2 +- .../src/builtins/temporal/instant/mod.rs | 60 +++++++++++++- core/engine/src/builtins/temporal/options.rs | 37 +++++---- .../builtins/temporal/plain_date_time/mod.rs | 45 +++++++--- .../src/builtins/temporal/plain_time/mod.rs | 83 +++++++++---------- .../builtins/temporal/zoneddatetime/mod.rs | 75 +++++++++++++++-- 7 files changed, 227 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67eda682304..761cfbde5cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3541,7 +3541,7 @@ checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" [[package]] name = "temporal_rs" version = "0.0.4" -source = "git+https://github.com/boa-dev/temporal.git?rev=436b07d9b27e3e2274905c9a4eabf8bbff9ad9ec#436b07d9b27e3e2274905c9a4eabf8bbff9ad9ec" +source = "git+https://github.com/boa-dev/temporal.git?rev=e4fc6305b5c60986f67795f2cb3ff9c4e1d4e692#e4fc6305b5c60986f67795f2cb3ff9c4e1d4e692" dependencies = [ "bitflags 2.6.0", "combine", diff --git a/Cargo.toml b/Cargo.toml index 951f1f0f9a6..5e3df54f952 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ intrusive-collections = "0.9.7" cfg-if = "1.0.0" either = "1.13.0" sys-locale = "0.3.2" -temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "436b07d9b27e3e2274905c9a4eabf8bbff9ad9ec", features = ["tzdb"] } +temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "e4fc6305b5c60986f67795f2cb3ff9c4e1d4e692", features = ["tzdb"] } web-time = "1.1.0" criterion = "0.5.1" float-cmp = "0.10.0" diff --git a/core/engine/src/builtins/temporal/instant/mod.rs b/core/engine/src/builtins/temporal/instant/mod.rs index 5177673d17a..7c6a8a026a9 100644 --- a/core/engine/src/builtins/temporal/instant/mod.rs +++ b/core/engine/src/builtins/temporal/instant/mod.rs @@ -1,6 +1,7 @@ //! Boa's implementation of ECMAScript's `Temporal.Instant` builtin object. -use super::options::get_difference_settings; +use super::options::{get_difference_settings, get_digits_option}; +use super::to_temporal_timezone_identifier; use crate::value::JsVariant; use crate::{ builtins::{ @@ -25,6 +26,7 @@ use crate::{ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use num_traits::ToPrimitive; +use temporal_rs::options::{TemporalUnit, ToStringRoundingOptions}; use temporal_rs::{ options::{RoundingIncrement, RoundingOptions, TemporalRoundingMode}, Instant as InnerInstant, @@ -91,6 +93,8 @@ impl IntrinsicObject for Instant { .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) .method(Self::to_zoned_date_time, js_string!("toZonedDateTime"), 1) + .method(Self::to_string, js_string!("toString"), 0) + .method(Self::to_json, js_string!("toJSON"), 0) .method(Self::value_of, js_string!("valueOf"), 0) .method( Self::to_zoned_date_time_iso, @@ -477,6 +481,60 @@ impl Instant { .into()) } + fn to_string(this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { + let instant = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ() + .with_message("the this object must be a Temporal.Instant object.") + })?; + + let options = get_options_object(args.get_or_undefined(0))?; + + let precision = get_digits_option(&options, context)?; + let rounding_mode = + get_option::(&options, js_string!("roundingMode"), context)?; + let smallest_unit = + get_option::(&options, js_string!("smallestUnit"), context)?; + // NOTE: There may be an order-of-operations here due to a check on Unit groups and smallest_unit value. + let timezone = options + .get(js_string!("timeZone"), context)? + .map(|v| to_temporal_timezone_identifier(v, context)) + .transpose()?; + + let options = ToStringRoundingOptions { + precision, + smallest_unit, + rounding_mode, + }; + + let ixdtf = instant.inner.to_ixdtf_string_with_provider( + timezone.as_ref(), + options, + context.tz_provider(), + )?; + + Ok(JsString::from(ixdtf).into()) + } + + fn to_json(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult { + let instant = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ() + .with_message("the this object must be a Temporal.Instant object.") + })?; + + let ixdtf = instant.inner.to_ixdtf_string_with_provider( + None, + ToStringRoundingOptions::default(), + context.tz_provider(), + )?; + Ok(JsString::from(ixdtf).into()) + } + pub(crate) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { Err(JsNativeError::typ() .with_message("`valueOf` not supported by Temporal built-ins. See 'compare', 'equals', or `toString`") diff --git a/core/engine/src/builtins/temporal/options.rs b/core/engine/src/builtins/temporal/options.rs index b01fab6b5de..58d4110976a 100644 --- a/core/engine/src/builtins/temporal/options.rs +++ b/core/engine/src/builtins/temporal/options.rs @@ -12,10 +12,14 @@ use crate::{ builtins::options::{get_option, OptionType, ParsableOptionType}, js_string, Context, JsNativeError, JsObject, JsResult, JsString, JsValue, }; -use temporal_rs::{options::{ - ArithmeticOverflow, DifferenceSettings, Disambiguation, DisplayCalendar, DurationOverflow, - OffsetDisambiguation, RoundingIncrement, TemporalRoundingMode, TemporalUnit, -}, parsers::Precision}; +use temporal_rs::{ + options::{ + ArithmeticOverflow, DifferenceSettings, Disambiguation, DisplayCalendar, DisplayOffset, + DisplayTimeZone, DurationOverflow, OffsetDisambiguation, RoundingIncrement, + TemporalRoundingMode, TemporalUnit, + }, + parsers::Precision, +}; // TODO: Expand docs on the below options. @@ -62,35 +66,38 @@ pub(crate) fn get_difference_settings( Ok(settings) } -pub(crate) fn get_digits_option( - options: &JsObject, - context: &mut Context, -) -> JsResult { +pub(crate) fn get_digits_option(options: &JsObject, context: &mut Context) -> JsResult { // 1. Let digitsValue be ? Get(options, "fractionalSecondDigits"). let digits_value = options.get(js_string!("fractionalSecondDigits"), context)?; // 2. If digitsValue is undefined, return auto. if digits_value.is_undefined() { - return Ok(Precision::Auto) + return Ok(Precision::Auto); } // 3. If digitsValue is not a Number, then let Some(digits_number) = digits_value.as_number() else { // a. If ? ToString(digitsValue) is not "auto", throw a RangeError exception. if digits_value.to_string(context)? != js_string!("auto") { - return Err(JsNativeError::range().with_message("fractionalSecondDigits must be a digit or 'auto'").into()) + return Err(JsNativeError::range() + .with_message("fractionalSecondDigits must be a digit or 'auto'") + .into()); } // b. Return auto. - return Ok(Precision::Auto) + return Ok(Precision::Auto); }; // 4. If digitsValue is NaN, +∞𝔽, or -∞𝔽, throw a RangeError exception. if !digits_number.is_finite() { - return Err(JsNativeError::range().with_message("fractionalSecondDigits must be a finite number").into()) + return Err(JsNativeError::range() + .with_message("fractionalSecondDigits must be a finite number") + .into()); } // 5. Let digitCount be floor(ℝ(digitsValue)). let digits = digits_number.floor() as i32; // 6. If digitCount < 0 or digitCount > 9, throw a RangeError exception. - if digits < 0 || digits > 9 { - return Err(JsNativeError::range().with_message("fractionalSecondDigits must be in an inclusive range of 0-9").into()) + if !(0..=9).contains(&digits) { + return Err(JsNativeError::range() + .with_message("fractionalSecondDigits must be in an inclusive range of 0-9") + .into()); } // 7. Return digitCount. Ok(Precision::Digit(digits as u8)) @@ -151,6 +158,8 @@ impl ParsableOptionType for Disambiguation {} impl ParsableOptionType for OffsetDisambiguation {} impl ParsableOptionType for TemporalRoundingMode {} impl ParsableOptionType for DisplayCalendar {} +impl ParsableOptionType for DisplayOffset {} +impl ParsableOptionType for DisplayTimeZone {} impl OptionType for RoundingIncrement { fn from_value(value: JsValue, context: &mut Context) -> JsResult { diff --git a/core/engine/src/builtins/temporal/plain_date_time/mod.rs b/core/engine/src/builtins/temporal/plain_date_time/mod.rs index 34d9690d7c0..462e3d3d038 100644 --- a/core/engine/src/builtins/temporal/plain_date_time/mod.rs +++ b/core/engine/src/builtins/temporal/plain_date_time/mod.rs @@ -24,7 +24,10 @@ use boa_profiler::Profiler; mod tests; use temporal_rs::{ - options::{ArithmeticOverflow, DisplayCalendar, RoundingIncrement, RoundingOptions, TemporalRoundingMode, TemporalUnit, ToStringRoundingOptions}, + options::{ + ArithmeticOverflow, DisplayCalendar, RoundingIncrement, RoundingOptions, + TemporalRoundingMode, TemporalUnit, ToStringRoundingOptions, + }, partial::PartialDateTime, PlainDateTime as InnerDateTime, PlainTime, }; @@ -280,6 +283,7 @@ impl IntrinsicObject for PlainDateTime { .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) .method(Self::to_string, js_string!("toString"), 0) + .method(Self::to_json, js_string!("toJSON"), 0) .method(Self::value_of, js_string!("valueOf"), 0) .build(); } @@ -944,16 +948,37 @@ impl PlainDateTime { let options = get_options_object(args.get_or_undefined(0))?; - let show_calendar = get_option::(&options, js_string!("calendarName"), context)?.unwrap_or(DisplayCalendar::Auto); + let show_calendar = + get_option::(&options, js_string!("calendarName"), context)? + .unwrap_or(DisplayCalendar::Auto); let precision = get_digits_option(&options, context)?; - let rounding_mode = get_option::(&options, js_string!("roundingMode"), context)?; - let smallest_unit = get_option::(&options, js_string!("smallestUnit"), context)?; - - let ixdtf = dt.inner.to_ixdtf_string(ToStringRoundingOptions { - precision, - smallest_unit, - rounding_mode, - }, show_calendar)?; + let rounding_mode = + get_option::(&options, js_string!("roundingMode"), context)?; + let smallest_unit = + get_option::(&options, js_string!("smallestUnit"), context)?; + + let ixdtf = dt.inner.to_ixdtf_string( + ToStringRoundingOptions { + precision, + smallest_unit, + rounding_mode, + }, + show_calendar, + )?; + Ok(JsString::from(ixdtf).into()) + } + + fn to_json(this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { + let dt = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a PlainDateTime object.") + })?; + + let ixdtf = dt + .inner + .to_ixdtf_string(ToStringRoundingOptions::default(), DisplayCalendar::Auto)?; Ok(JsString::from(ixdtf).into()) } diff --git a/core/engine/src/builtins/temporal/plain_time/mod.rs b/core/engine/src/builtins/temporal/plain_time/mod.rs index 35cbe4a6742..84cbd121b2a 100644 --- a/core/engine/src/builtins/temporal/plain_time/mod.rs +++ b/core/engine/src/builtins/temporal/plain_time/mod.rs @@ -5,7 +5,7 @@ use super::{ options::{get_difference_settings, get_temporal_unit, TemporalUnitGroup}, to_temporal_duration_record, PlainDateTime, ZonedDateTime, }; -use crate::value::JsVariant; +use crate::{builtins::temporal::options::get_digits_option, value::JsVariant}; use crate::{ builtins::{ options::{get_option, get_options_object}, @@ -23,7 +23,7 @@ use crate::{ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use temporal_rs::{ - options::{ArithmeticOverflow, TemporalRoundingMode}, + options::{ArithmeticOverflow, TemporalRoundingMode, TemporalUnit, ToStringRoundingOptions}, partial::PartialTime, PlainTime as PlainTimeInner, }; @@ -118,7 +118,8 @@ impl IntrinsicObject for PlainTime { .method(Self::since, js_string!("since"), 1) .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) - .method(Self::get_iso_fields, js_string!("getISOFields"), 0) + .method(Self::to_string, js_string!("toString"), 0) + .method(Self::to_json, js_string!("toJSON"), 0) .method(Self::value_of, js_string!("valueOf"), 0) .build(); } @@ -530,58 +531,50 @@ impl PlainTime { Ok((time.inner == other).into()) } - /// 4.3.18 Temporal.PlainTime.prototype.getISOFields ( ) - fn get_iso_fields(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult { - // 1. Let temporalTime be the this value. - // 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]). + /// 4.3.16 `Temporal.PlainTime.prototype.toString ( [ options ] )` + fn to_string(this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { let time = this .as_object() - .and_then(JsObject::downcast_ref::) + .and_then(JsObject::downcast_ref::) .ok_or_else(|| { JsNativeError::typ().with_message("the this object must be a PlainTime object.") })?; - // 3. Let fields be OrdinaryObjectCreate(%Object.prototype%). - let fields = JsObject::with_object_proto(context.intrinsics()); + let options = get_options_object(args.get_or_undefined(0))?; - // 4. Perform ! CreateDataPropertyOrThrow(fields, "isoHour", 𝔽(temporalTime.[[ISOHour]])). - fields.create_data_property_or_throw(js_string!("isoHour"), time.inner.hour(), context)?; - // 5. Perform ! CreateDataPropertyOrThrow(fields, "isoMicrosecond", 𝔽(temporalTime.[[ISOMicrosecond]])). - fields.create_data_property_or_throw( - js_string!("isoMicrosecond"), - time.inner.microsecond(), - context, - )?; - // 6. Perform ! CreateDataPropertyOrThrow(fields, "isoMillisecond", 𝔽(temporalTime.[[ISOMillisecond]])). - fields.create_data_property_or_throw( - js_string!("isoMillisecond"), - time.inner.millisecond(), - context, - )?; - // 7. Perform ! CreateDataPropertyOrThrow(fields, "isoMinute", 𝔽(temporalTime.[[ISOMinute]])). - fields.create_data_property_or_throw( - js_string!("isoMinute"), - time.inner.minute(), - context, - )?; - // 8. Perform ! CreateDataPropertyOrThrow(fields, "isoNanosecond", 𝔽(temporalTime.[[ISONanosecond]])). - fields.create_data_property_or_throw( - js_string!("isoNanosecond"), - time.inner.nanosecond(), - context, - )?; - // 9. Perform ! CreateDataPropertyOrThrow(fields, "isoSecond", 𝔽(temporalTime.[[ISOSecond]])). - fields.create_data_property_or_throw( - js_string!("isoSecond"), - time.inner.second(), - context, - )?; + let precision = get_digits_option(&options, context)?; + let rounding_mode = + get_option::(&options, js_string!("roundingMode"), context)?; + let smallest_unit = + get_option::(&options, js_string!("smallestUnit"), context)?; + + let options = ToStringRoundingOptions { + precision, + rounding_mode, + smallest_unit, + }; - // 10. Return fields. - Ok(fields.into()) + let ixdtf = time.inner.to_ixdtf_string(options)?; + + Ok(JsString::from(ixdtf).into()) + } + + /// 4.3.18 `Temporal.PlainTime.prototype.toJSON ( )` + fn to_json(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { + let time = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a PlainTime object.") + })?; + + let ixdtf = time + .inner + .to_ixdtf_string(ToStringRoundingOptions::default())?; + Ok(JsString::from(ixdtf).into()) } - /// 4.3.22 Temporal.PlainTime.prototype.valueOf ( ) + /// 4.3.19 Temporal.PlainTime.prototype.valueOf ( ) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { // 1. Throw a TypeError exception. Err(JsNativeError::typ() diff --git a/core/engine/src/builtins/temporal/zoneddatetime/mod.rs b/core/engine/src/builtins/temporal/zoneddatetime/mod.rs index 5d989d086f6..15b3dbec9af 100644 --- a/core/engine/src/builtins/temporal/zoneddatetime/mod.rs +++ b/core/engine/src/builtins/temporal/zoneddatetime/mod.rs @@ -3,6 +3,7 @@ use std::str::FromStr; use crate::{ builtins::{ options::{get_option, get_options_object}, + temporal::options::get_digits_option, BuiltInBuilder, BuiltInConstructor, BuiltInObject, IntrinsicObject, }, context::intrinsics::{Intrinsics, StandardConstructor, StandardConstructors}, @@ -19,7 +20,10 @@ use boa_gc::{Finalize, Trace}; use boa_profiler::Profiler; use num_traits::ToPrimitive; use temporal_rs::{ - options::{ArithmeticOverflow, Disambiguation, OffsetDisambiguation}, + options::{ + ArithmeticOverflow, Disambiguation, DisplayCalendar, DisplayOffset, DisplayTimeZone, + OffsetDisambiguation, TemporalRoundingMode, TemporalUnit, ToStringRoundingOptions, + }, partial::PartialZonedDateTime, Calendar, TimeZone, ZonedDateTime as ZonedDateTimeInner, }; @@ -325,6 +329,8 @@ impl IntrinsicObject for ZonedDateTime { .method(Self::add, js_string!("add"), 1) .method(Self::subtract, js_string!("subtract"), 1) .method(Self::equals, js_string!("equals"), 1) + .method(Self::to_string, js_string!("toString"), 0) + .method(Self::to_json, js_string!("toJSON"), 0) .method(Self::value_of, js_string!("valueOf"), 0) .method(Self::start_of_day, js_string!("startOfDay"), 0) .method(Self::to_instant, js_string!("toInstant"), 0) @@ -430,16 +436,15 @@ impl ZonedDateTime { /// 6.3.4 get `Temporal.ZonedDateTime.prototype.timeZoneId` fn get_timezone_id(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { - let _zdt = this + let zdt = this .as_object() .and_then(JsObject::downcast_ref::) .ok_or_else(|| { JsNativeError::typ().with_message("the this object must be a ZonedDateTime object.") })?; - Err(JsNativeError::error() - .with_message("Not yet implemented.") - .into()) + let tz_id = zdt.inner.timezone().id()?; + Ok(JsString::from(tz_id).into()) } /// 6.3.5 get `Temporal.ZonedDateTime.prototype.era` @@ -932,6 +937,66 @@ impl ZonedDateTime { Ok((zdt.inner == other).into()) } + fn to_string(this: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { + let zdt = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a ZonedDateTime object.") + })?; + + let options = get_options_object(args.get_or_undefined(0))?; + + let show_calendar = + get_option::(&options, js_string!("calendarName"), context)? + .unwrap_or(DisplayCalendar::Auto); + let precision = get_digits_option(&options, context)?; + let show_offset = get_option::(&options, js_string!("offset"), context)? + .unwrap_or(DisplayOffset::Auto); + let rounding_mode = + get_option::(&options, js_string!("roundingMode"), context)?; + let smallest_unit = + get_option::(&options, js_string!("smallestUnit"), context)?; + // NOTE: There may be an order-of-operations here due to a check on Unit groups and smallest_unit value. + let display_timezone = + get_option::(&options, js_string!("offset"), context)? + .unwrap_or(DisplayTimeZone::Auto); + + let options = ToStringRoundingOptions { + precision, + smallest_unit, + rounding_mode, + }; + let ixdtf = zdt.inner.to_ixdtf_string_with_provider( + show_offset, + display_timezone, + show_calendar, + options, + context.tz_provider(), + )?; + + Ok(JsString::from(ixdtf).into()) + } + + fn to_json(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult { + let zdt = this + .as_object() + .and_then(JsObject::downcast_ref::) + .ok_or_else(|| { + JsNativeError::typ().with_message("the this object must be a ZonedDateTime object.") + })?; + + let ixdtf = zdt.inner.to_ixdtf_string_with_provider( + DisplayOffset::Auto, + DisplayTimeZone::Auto, + DisplayCalendar::Auto, + ToStringRoundingOptions::default(), + context.tz_provider(), + )?; + + Ok(JsString::from(ixdtf).into()) + } + /// 6.3.44 `Temporal.ZonedDateTime.prototype.valueOf ( )` pub(crate) fn value_of(_this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { Err(JsNativeError::typ() From f9e9510435d30eb7fe1cc02abf01a0bb3faf79d0 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Mon, 13 Jan 2025 00:16:58 -0600 Subject: [PATCH 07/10] Bump msrv to 1.84 to support Option::::expect const fn --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5e3df54f952..351f6988f9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ exclude = [ [workspace.package] edition = "2021" version = "0.20.0" -rust-version = "1.82.0" +rust-version = "1.84.0" authors = ["boa-dev"] repository = "https://github.com/boa-dev/boa" license = "Unlicense OR MIT" From 3d5378f54125396541ff7a6da842d96faff70186 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Mon, 13 Jan 2025 00:20:11 -0600 Subject: [PATCH 08/10] Revert MSRV bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 351f6988f9e..5e3df54f952 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ exclude = [ [workspace.package] edition = "2021" version = "0.20.0" -rust-version = "1.84.0" +rust-version = "1.82.0" authors = ["boa-dev"] repository = "https://github.com/boa-dev/boa" license = "Unlicense OR MIT" From 8c358565054934123cd5db293e77e916cb915b40 Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Mon, 13 Jan 2025 08:48:36 -0600 Subject: [PATCH 09/10] Bump temporal_rs to msrv version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 761cfbde5cb..fd6424406f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3541,7 +3541,7 @@ checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" [[package]] name = "temporal_rs" version = "0.0.4" -source = "git+https://github.com/boa-dev/temporal.git?rev=e4fc6305b5c60986f67795f2cb3ff9c4e1d4e692#e4fc6305b5c60986f67795f2cb3ff9c4e1d4e692" +source = "git+https://github.com/boa-dev/temporal.git?rev=a92149d907252749098eb2305f1cae2e4fdf19fe#a92149d907252749098eb2305f1cae2e4fdf19fe" dependencies = [ "bitflags 2.6.0", "combine", diff --git a/Cargo.toml b/Cargo.toml index 5e3df54f952..f2f529ebb77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ intrusive-collections = "0.9.7" cfg-if = "1.0.0" either = "1.13.0" sys-locale = "0.3.2" -temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "e4fc6305b5c60986f67795f2cb3ff9c4e1d4e692", features = ["tzdb"] } +temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "a92149d907252749098eb2305f1cae2e4fdf19fe", features = ["tzdb"] } web-time = "1.1.0" criterion = "0.5.1" float-cmp = "0.10.0" From daccbd3a9f60c73136d6e9be69169604b9c5187c Mon Sep 17 00:00:00 2001 From: Kevin Ness <46825870+nekevss@users.noreply.github.com> Date: Wed, 15 Jan 2025 10:43:58 -0600 Subject: [PATCH 10/10] Bump temporal_rs for bug fix to cross-epoch broken test --- Cargo.lock | 26 ++++++++++++-------------- Cargo.toml | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd6424406f7..999db0c8aed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -301,9 +301,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" dependencies = [ "serde", ] @@ -326,7 +326,7 @@ name = "boa_ast" version = "0.20.0" dependencies = [ "arbitrary", - "bitflags 2.6.0", + "bitflags 2.7.0", "boa_interner", "boa_macros", "boa_string", @@ -361,7 +361,7 @@ name = "boa_engine" version = "0.20.0" dependencies = [ "arrayvec", - "bitflags 2.6.0", + "bitflags 2.7.0", "boa_ast", "boa_gc", "boa_icu_provider", @@ -524,7 +524,7 @@ dependencies = [ name = "boa_parser" version = "0.20.0" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "boa_ast", "boa_interner", "boa_macros", @@ -576,7 +576,7 @@ dependencies = [ name = "boa_tester" version = "0.20.0" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "boa_engine", "boa_gc", "boa_runtime", @@ -1012,7 +1012,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "crossterm_winapi", "parking_lot", "rustix", @@ -2519,7 +2519,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "cfg_aliases", "libc", @@ -3018,7 +3018,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", ] [[package]] @@ -3124,7 +3124,7 @@ version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "errno", "libc", "linux-raw-sys", @@ -3175,7 +3175,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "clipboard-win", "fd-lock", @@ -3541,16 +3541,14 @@ checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" [[package]] name = "temporal_rs" version = "0.0.4" -source = "git+https://github.com/boa-dev/temporal.git?rev=a92149d907252749098eb2305f1cae2e4fdf19fe#a92149d907252749098eb2305f1cae2e4fdf19fe" +source = "git+https://github.com/boa-dev/temporal.git?rev=53fc1fc11f039574000d3d22a5d06d75836a4494#53fc1fc11f039574000d3d22a5d06d75836a4494" dependencies = [ - "bitflags 2.6.0", "combine", "iana-time-zone", "icu_calendar 2.0.0-beta1", "ixdtf", "jiff-tzdb", "num-traits", - "rustc-hash 2.1.0", "tinystr 0.8.0", "tzif", "web-time", diff --git a/Cargo.toml b/Cargo.toml index f2f529ebb77..411756bed7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,7 @@ intrusive-collections = "0.9.7" cfg-if = "1.0.0" either = "1.13.0" sys-locale = "0.3.2" -temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "a92149d907252749098eb2305f1cae2e4fdf19fe", features = ["tzdb"] } +temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "53fc1fc11f039574000d3d22a5d06d75836a4494", features = ["tzdb"] } web-time = "1.1.0" criterion = "0.5.1" float-cmp = "0.10.0"