Skip to content

Commit 15c3be9

Browse files
authored
Merge pull request #113 from lzutao/112-off-by-one
Fix an off-by-one error when calculating current nightly date in local
2 parents 57a6dd7 + a18023a commit 15c3be9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/toolchains.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ impl Toolchain {
100100
let month = cap.get(2)?.as_str().parse::<u32>().ok()?;
101101
let day = cap.get(3)?.as_str().parse::<u32>().ok()?;
102102

103-
return Some(Date::from_utc(
104-
naive::NaiveDate::from_ymd(year, month, day),
105-
Utc,
106-
));
103+
// rustc commit date is off-by-one.
104+
let date = naive::NaiveDate::from_ymd(year, month, day).succ();
105+
106+
return Some(Date::from_utc(date, Utc));
107107
}
108108
}
109109
}

0 commit comments

Comments
 (0)