extensions: Timestamps < 24h ago can also be yesterday

This commit is contained in:
Hylke Bons 2014-11-08 17:26:09 +00:00
parent 4fbd037eff
commit 1cce51d66d
2 changed files with 8 additions and 8 deletions

View file

@ -1098,7 +1098,6 @@ namespace SparkleLib.Git {
private List<SparkleChange> ParseStatus ()
{
List<SparkleChange> changes = new List<SparkleChange> ();
int count = 0;
SparkleGit git_status = new SparkleGit (LocalPath, "status --porcelain");
git_status.Start ();

View file

@ -82,13 +82,14 @@ namespace SparkleLib {
{
TimeSpan time_diff = DateTime.Now.Subtract (timestamp);
int day_diff = (int) time_diff.TotalDays;
DateTime yesterday = DateTime.Today.AddDays (-1);
if (day_diff == 0) {
return "at " + timestamp.ToString ("HH:mm");
} else if (day_diff == 1) {
if (timestamp >= yesterday && timestamp < DateTime.Today) {
return "yesterday at " + timestamp.ToString ("HH:mm");
} else if (day_diff == 0) {
return "today at " + timestamp.ToString ("HH:mm");
} else if (day_diff < 7) {
return timestamp.ToString ("dddd");