Skip to content

Commit 468782a

Browse files
committed
to_zoned_date_time implementation in compiled
1 parent 72d3515 commit 468782a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/builtins/compiled/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
mod duration;
44
mod instant;
55
mod now;
6+
mod plain_date_time;
67
mod zoneddatetime;
78

89
mod options {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use crate::{
2+
builtins::core::{PlainDateTime, ZonedDateTime},
3+
builtins::TZ_PROVIDER,
4+
options::Disambiguation,
5+
TemporalError, TemporalResult, TimeZone,
6+
};
7+
8+
impl PlainDateTime {
9+
/// Returns a `ZonedDateTime` with the provided `PlainDateTime`, TimeZone` and
10+
/// `Disambiguation`
11+
/// Enable with the `compiled_data` feature flag.
12+
pub fn to_zoned_date_time(
13+
&self,
14+
time_zone: &TimeZone,
15+
disambiguation: Disambiguation,
16+
) -> TemporalResult<ZonedDateTime> {
17+
let provider = TZ_PROVIDER
18+
.lock()
19+
.map_err(|_| TemporalError::general("Unable to acquire lock"))?;
20+
21+
self.to_zoned_date_time_with_provider(time_zone, disambiguation, &*provider)
22+
}
23+
}

0 commit comments

Comments
 (0)