extensions: Timestamps < 24h ago can also be yesterday
This commit is contained in:
parent
4fbd037eff
commit
1cce51d66d
|
@ -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 ();
|
||||
|
|
|
@ -80,15 +80,16 @@ 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;
|
||||
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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue