Skip to content

Commit ac53b44

Browse files
authored
Implementation of toZonedDateTimeISO for Instant (#258)
Fixes #246 Implementation of toZonedDateTimeISO for Instant. most tests pass, one strange test262 function looks like it should pass, but doesn't somehow. https://github.com/tc39/test262/blob/main/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js This one in particular.. The code does indeed throw a range error when trying to create a timezone from those strings.. but the test doesn't pass.
1 parent ac07ef9 commit ac53b44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/builtins/core/instant.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
provider::TimeZoneProvider,
1818
rounding::{IncrementRounder, Round},
1919
time::EpochNanoseconds,
20-
TemporalError, TemporalResult, TemporalUnwrap, TimeZone,
20+
Calendar, TemporalError, TemporalResult, TemporalUnwrap, TimeZone,
2121
};
2222

2323
use ixdtf::parsers::records::UtcOffsetRecordOrZ;
@@ -236,8 +236,8 @@ impl Instant {
236236
}
237237

238238
// TODO: May end up needing a provider API during impl
239-
pub fn to_zoned_date_time_iso(&self, _time_zone: TimeZone) -> TemporalResult<ZonedDateTime> {
240-
Err(TemporalError::general("Not yet implemented"))
239+
pub fn to_zoned_date_time_iso(&self, time_zone: TimeZone) -> ZonedDateTime {
240+
ZonedDateTime::new_unchecked(*self, Calendar::default(), time_zone)
241241
}
242242
}
243243

0 commit comments

Comments
 (0)