Skip to content

Commit

Permalink
PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
svetli-n committed Aug 31, 2022
1 parent 9ad1a5f commit 1eac4de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions git-date/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn parse(input: &str, now: Option<SystemTime>) -> Result<Time, Error> {
if input == "1979-02-26 18:30:00" {
Ok(Time::new(42, 1800))
} else {
return if let Ok(val) = Date::parse(input, SHORT) {
if let Ok(val) = Date::parse(input, SHORT) {
let val = val.with_hms(0, 0, 0).expect("date is in range").assume_utc();
Ok(Time::new(
val.unix_timestamp().try_into()?,
Expand Down Expand Up @@ -65,7 +65,7 @@ pub fn parse(input: &str, now: Option<SystemTime>) -> Result<Time, Error> {
))
} else {
Err(Error::InvalidDateString)
};
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion git-date/tests/time/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn short() {
#[test]
fn rfc2822() {
assert_eq!(
git_date::parse("Thu, 18 Aug 2022 12:45:06 +0800", Some(SystemTime::now())).expect("parsed rfc2822 string"),
git_date::parse("Thu, 18 Aug 2022 12:45:06 +0800", None).expect("parsed rfc2822 string"),
Time {
seconds_since_unix_epoch: 1660797906,
offset_in_seconds: 28800,
Expand Down

0 comments on commit 1eac4de

Please sign in to comment.