Skip to content

Commit dcd5688

Browse files
authored
unify iso naming in Now (#631)
Deprecate `Now::plain_time_with_provider` and rename it to `Now::plain_time_iso_with_provider`
1 parent ceaba22 commit dcd5688

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/builtins/compiled/now.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ impl<H: HostHooks> Now<H> {
3838
///
3939
/// Enable with the `compiled_data` and `sys` feature flags.
4040
pub fn plain_time_iso(self, time_zone: Option<TimeZone>) -> TemporalResult<PlainTime> {
41-
self.plain_time_with_provider(time_zone, &*TZ_PROVIDER)
41+
self.plain_time_iso_with_provider(time_zone, &*TZ_PROVIDER)
4242
}
4343
}

src/builtins/core/now.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,24 @@ impl<H: HostHooks> Now<H> {
9090
///
9191
/// When `TimeZone` is `None`, the value will default to the
9292
/// system time zone or UTC if the system zone is unavailable.
93+
/// Deprecated: Use `plain_time_iso_with_provider` instead.
94+
#[deprecated(since = "0.1.2", note = "Use `plain_time_iso_with_provider` instead")]
9395
pub fn plain_time_with_provider(
9496
self,
9597
time_zone: Option<TimeZone>,
9698
provider: &(impl TimeZoneProvider + ?Sized),
99+
) -> TemporalResult<PlainTime> {
100+
self.plain_time_iso_with_provider(time_zone, provider)
101+
}
102+
103+
/// Converts `Now` into the current system [`PlainTime`].
104+
///
105+
/// When `TimeZone` is `None`, the value will default to the
106+
/// system time zone or UTC if the system zone is unavailable.
107+
pub fn plain_time_iso_with_provider(
108+
self,
109+
time_zone: Option<TimeZone>,
110+
provider: &(impl TimeZoneProvider + ?Sized),
97111
) -> TemporalResult<PlainTime> {
98112
let iso = self.system_datetime_with_provider(time_zone, provider)?;
99113
Ok(PlainTime::new_unchecked(iso.time))

0 commit comments

Comments
 (0)