mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Additional formatting tweaks (#5909)
This commit is contained in:
@@ -24,7 +24,10 @@ namespace PowerLauncher.Storage
|
||||
{
|
||||
int years = (span.Days / 365);
|
||||
if (span.Days % 365 != 0)
|
||||
{
|
||||
years += 1;
|
||||
}
|
||||
|
||||
return $"about {years} {(years == 1 ? "year" : "years")} ago";
|
||||
}
|
||||
|
||||
@@ -32,20 +35,38 @@ namespace PowerLauncher.Storage
|
||||
{
|
||||
int months = (span.Days / 30);
|
||||
if (span.Days % 31 != 0)
|
||||
{
|
||||
months += 1;
|
||||
}
|
||||
|
||||
return $"about {months} {(months == 1 ? "month" : "months")} ago";
|
||||
}
|
||||
|
||||
if (span.Days > 0)
|
||||
{
|
||||
return $"about {span.Days} {(span.Days == 1 ? "day" : "days")} ago";
|
||||
}
|
||||
|
||||
if (span.Hours > 0)
|
||||
{
|
||||
return $"about {span.Hours} {(span.Hours == 1 ? "hour" : "hours")} ago";
|
||||
}
|
||||
|
||||
if (span.Minutes > 0)
|
||||
{
|
||||
return $"about {span.Minutes} {(span.Minutes == 1 ? "minute" : "minutes")} ago";
|
||||
}
|
||||
|
||||
if (span.Seconds > 5)
|
||||
{
|
||||
return $"about {span.Seconds} seconds ago";
|
||||
}
|
||||
|
||||
if (span.Seconds <= 5)
|
||||
{
|
||||
return "just now";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ namespace PowerLauncher.Storage
|
||||
|
||||
public void Add(string query)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query)) return;
|
||||
if (string.IsNullOrEmpty(query))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Items.Count > _maxHistory)
|
||||
{
|
||||
Items.RemoveAt(0);
|
||||
@@ -31,7 +35,7 @@ namespace PowerLauncher.Storage
|
||||
Items.Add(new HistoryItem
|
||||
{
|
||||
Query = query,
|
||||
ExecutedDateTime = DateTime.Now
|
||||
ExecutedDateTime = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace PowerLauncher.Storage
|
||||
{
|
||||
PluginID = result.PluginID,
|
||||
Title = result.Title,
|
||||
SubTitle = result.SubTitle
|
||||
SubTitle = result.SubTitle,
|
||||
};
|
||||
records[result.OriginQuery.RawQuery] = record;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user