diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-08-10 18:50:46 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-14 19:13:11 -0400 |
commit | 86b2fef8ce5295e4572f78af65053d418171ad37 (patch) | |
tree | cb45d2f80967a2394900c3c70364db39d579bdac /src/SMAPI.Web | |
parent | cff42300bc9e2862585e81ef5be00c90fa17d24a (diff) | |
download | SMAPI-86b2fef8ce5295e4572f78af65053d418171ad37.tar.gz SMAPI-86b2fef8ce5295e4572f78af65053d418171ad37.tar.bz2 SMAPI-86b2fef8ce5295e4572f78af65053d418171ad37.zip |
better handle stale age label on mod compatibility list
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r-- | src/SMAPI.Web/SMAPI.Web.csproj | 1 | ||||
-rw-r--r-- | src/SMAPI.Web/Views/Mods/Index.cshtml | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/SMAPI.Web/SMAPI.Web.csproj b/src/SMAPI.Web/SMAPI.Web.csproj index 316a6a28..f7b2dc24 100644 --- a/src/SMAPI.Web/SMAPI.Web.csproj +++ b/src/SMAPI.Web/SMAPI.Web.csproj @@ -15,6 +15,7 @@ <PackageReference Include="Hangfire.AspNetCore" Version="1.7.5" /> <PackageReference Include="Hangfire.Mongo" Version="0.6.1" /> <PackageReference Include="HtmlAgilityPack" Version="1.11.9" /> + <PackageReference Include="Humanizer.Core" Version="2.6.2" /> <PackageReference Include="Markdig" Version="0.17.1" /> <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" /> diff --git a/src/SMAPI.Web/Views/Mods/Index.cshtml b/src/SMAPI.Web/Views/Mods/Index.cshtml index aa7c0678..50b59b45 100644 --- a/src/SMAPI.Web/Views/Mods/Index.cshtml +++ b/src/SMAPI.Web/Views/Mods/Index.cshtml @@ -1,7 +1,11 @@ +@using Humanizer +@using Humanizer.Localisation @using Newtonsoft.Json @model StardewModdingAPI.Web.ViewModels.ModListModel @{ ViewData["Title"] = "Mod compatibility"; + + TimeSpan staleAge = DateTimeOffset.UtcNow - Model.LastUpdated; } @section Head { <link rel="stylesheet" href="~/Content/css/mods.css?r=20190302" /> @@ -26,7 +30,7 @@ else { @if (Model.IsStale) { - <div class="error">Showing data from @(Math.Round((DateTimeOffset.UtcNow - Model.LastUpdated).TotalMinutes)) minutes ago. (Couldn't fetch newer data; the wiki API may be offline.)</div> + <div class="error">Showing data from @staleAge.Humanize(maxUnit: TimeUnit.Hour, minUnit: TimeUnit.Minute) ago. (Couldn't fetch newer data; the wiki API may be offline.)</div> } <div id="app"> |