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,8 +1098,7 @@ 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

@ -80,17 +80,18 @@ namespace SparkleLib {
public static string ToPrettyDate (this DateTime timestamp)
{
TimeSpan time_diff = DateTime.Now.Subtract(timestamp);
TimeSpan time_diff = DateTime.Now.Subtract (timestamp);
int day_diff = (int) time_diff.TotalDays;
if (day_diff == 0) {
return "at " + timestamp.ToString ("HH:mm");
DateTime yesterday = DateTime.Today.AddDays (-1);
} 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");
return timestamp.ToString ("dddd");
} else if (day_diff < 31) {
if (day_diff < 14)