Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gix-date/src/time/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ 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(),
}
}
}

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")
Expand Down
Loading