Skip to content

Commit be0bbf5

Browse files
committed
Merge branch 'bugfix/timestamp-to-datetime-conversion'
2 parents 70ccbb2 + be603f5 commit be0bbf5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

git-date/src/time/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ impl Time {
6363
fn to_time(self) -> time::OffsetDateTime {
6464
time::OffsetDateTime::from_unix_timestamp(self.seconds_since_unix_epoch as i64)
6565
.expect("always valid unix time")
66-
.replace_offset(time::UtcOffset::from_whole_seconds(self.offset_in_seconds).expect("valid offset"))
66+
.to_offset(time::UtcOffset::from_whole_seconds(self.offset_in_seconds).expect("valid offset"))
6767
}
6868
}

git-date/tests/time/format.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use time::macros::format_description;
66

77
#[test]
88
fn short() {
9-
assert_eq!(time().format(format::SHORT), "1973-11-29");
9+
assert_eq!(time().format(format::SHORT), "1973-11-30");
1010
}
1111

1212
#[test]
@@ -25,32 +25,32 @@ fn raw() {
2525

2626
#[test]
2727
fn iso8601() {
28-
assert_eq!(time().format(format::ISO8601), "1973-11-29 21:33:09 +0230");
28+
assert_eq!(time().format(format::ISO8601), "1973-11-30 00:03:09 +0230");
2929
}
3030

3131
#[test]
3232
fn iso8601_strict() {
33-
assert_eq!(time().format(format::ISO8601_STRICT), "1973-11-29T21:33:09+02:30");
33+
assert_eq!(time().format(format::ISO8601_STRICT), "1973-11-30T00:03:09+02:30");
3434
}
3535

3636
#[test]
3737
fn rfc2822() {
38-
assert_eq!(time().format(format::RFC2822), "Thu, 29 Nov 1973 21:33:09 +0230");
38+
assert_eq!(time().format(format::RFC2822), "Fri, 30 Nov 1973 00:03:09 +0230");
3939
}
4040

4141
#[test]
4242
fn default() {
4343
assert_eq!(
4444
time().format(git_date::time::format::DEFAULT),
45-
"Thu Nov 29 1973 21:33:09 +0230"
45+
"Fri Nov 30 1973 00:03:09 +0230"
4646
);
4747
}
4848

4949
#[test]
5050
fn custom_compile_time() {
5151
assert_eq!(
5252
time().format(format_description!("[year]-[month]-[day] [hour]:[minute]:[second]")),
53-
"1973-11-29 21:33:09",
53+
"1973-11-30 00:03:09",
5454
);
5555
}
5656

0 commit comments

Comments
 (0)