History

feat: add `Time::to_zoned()` to unleash the power of `jiff::Zoned`.

Sebastian Thiel committed 1 year ago

Commit 21840371 parent bc62b1e1 file · +3 −2Browse files

Unified · Split

gix-date/src/time/format.rs+3−2
@@ -42,7 +42,7 @@ impl Time { · 41 unmodified lines
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 }
@@ -50,7 +50,8 @@ impl Time { · 1 unmodified line
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")