fix<Statistics>: month to index; fix using UTC time compare to local time

This commit is contained in:
leo 2024-02-26 09:27:02 +08:00
parent 68ddeb4cc5
commit 787fe4ad70

View file

@ -97,7 +97,7 @@ namespace SourceGit.Models {
} }
public void AddCommit(string committer, double timestamp) { public void AddCommit(string committer, double timestamp) {
var time = _utcStart.AddSeconds(timestamp); var time = _utcStart.AddSeconds(timestamp).ToLocalTime();
if (time.CompareTo(_thisWeekStart) >= 0 && time.CompareTo(_thisWeekEnd) < 0) { if (time.CompareTo(_thisWeekStart) >= 0 && time.CompareTo(_thisWeekEnd) < 0) {
Week.AddCommit((int)time.DayOfWeek, committer); Week.AddCommit((int)time.DayOfWeek, committer);
} }
@ -106,7 +106,7 @@ namespace SourceGit.Models {
Month.AddCommit(time.Day - 1, committer); Month.AddCommit(time.Day - 1, committer);
} }
Year.AddCommit(time.Month, committer); Year.AddCommit(time.Month - 1, committer);
} }
public void Complete() { public void Complete() {