Skip to content

Commit 3e81366

Browse files
authored
Merge pull request #2246 from GitoxideLabs/improvements
feat: add `Time::to_zoned()` to unleash the power of `jiff::Zoned`.
2 parents bc62b1e + 2184037 commit 3e81366

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gix-date/src/time/format.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ impl Time {
4242

4343
fn format_inner(&self, format: Format) -> String {
4444
match format {
45-
Format::Custom(CustomFormat(format)) => self.to_time().strftime(format).to_string(),
45+
Format::Custom(CustomFormat(format)) => self.to_zoned().strftime(format).to_string(),
4646
Format::Unix => self.seconds.to_string(),
4747
Format::Raw => self.to_string(),
4848
}
4949
}
5050
}
5151

5252
impl Time {
53-
fn to_time(self) -> jiff::Zoned {
53+
/// Produce a `Zoned` time for complex time computations and limitless formatting.
54+
pub fn to_zoned(self) -> jiff::Zoned {
5455
let offset = jiff::tz::Offset::from_seconds(self.offset).expect("valid offset");
5556
jiff::Timestamp::from_second(self.seconds)
5657
.expect("always valid unix time")

0 commit comments

Comments
 (0)