Skip to content

Commit f98f5cf

Browse files
authored
Use rounded instant in ZDT::toString (#396)
1 parent f101cbd commit f98f5cf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/builtins/core/zoneddatetime.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,9 +1256,10 @@ impl ZonedDateTime {
12561256
.round_instant(ResolvedRoundingOptions::from_to_string_options(
12571257
&resolved_options,
12581258
))?;
1259+
let rounded_instant = Instant::try_new(result)?;
12591260

12601261
let offset = self.tz.get_offset_nanos_for(result, provider)?;
1261-
let datetime = self.tz.get_iso_datetime_for(&self.instant, provider)?;
1262+
let datetime = self.tz.get_iso_datetime_for(&rounded_instant, provider)?;
12621263
let (sign, hour, minute) = nanoseconds_to_formattable_offset_minutes(offset)?;
12631264
let timezone_id = self.timezone().identifier()?;
12641265

0 commit comments

Comments
 (0)