From 21840379aa5e576ce1f7b425ea00a3aac28de937 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 3 Nov 2025 05:07:37 +0100 Subject: [PATCH] feat: add `Time::to_zoned()` to unleash the power of `jiff::Zoned`. --- gix-date/src/time/format.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gix-date/src/time/format.rs b/gix-date/src/time/format.rs index eeb4bf706b7..76f45f25563 100644 --- a/gix-date/src/time/format.rs +++ b/gix-date/src/time/format.rs @@ -42,7 +42,7 @@ impl Time { fn format_inner(&self, format: Format) -> String { match format { - Format::Custom(CustomFormat(format)) => self.to_time().strftime(format).to_string(), + Format::Custom(CustomFormat(format)) => self.to_zoned().strftime(format).to_string(), Format::Unix => self.seconds.to_string(), Format::Raw => self.to_string(), } @@ -50,7 +50,8 @@ impl Time { } impl Time { - fn to_time(self) -> jiff::Zoned { + /// Produce a `Zoned` time for complex time computations and limitless formatting. + pub fn to_zoned(self) -> jiff::Zoned { let offset = jiff::tz::Offset::from_seconds(self.offset).expect("valid offset"); jiff::Timestamp::from_second(self.seconds) .expect("always valid unix time")