mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-24 00:37:15 +00:00
Added ToBestDateString for DateTime, using on Series/Details.
This commit is contained in:
parent
5f0a95b2b1
commit
9271b39787
3 changed files with 20 additions and 1 deletions
|
@ -125,6 +125,7 @@
|
|||
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:8989:localhost" />
|
||||
<binding protocol="http" bindingInformation="*:8989:" />
|
||||
</bindings>
|
||||
</site>
|
||||
|
|
|
@ -28,5 +28,22 @@ namespace NzbDrone.Core
|
|||
{
|
||||
return gigabytes * 1073741824L;
|
||||
}
|
||||
|
||||
public static string ToBestDateString(this DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.Today.AddDays(-1))
|
||||
return "Yesterday";
|
||||
|
||||
if (dateTime == DateTime.Today)
|
||||
return "Today";
|
||||
|
||||
if (dateTime == DateTime.Today.AddDays(1))
|
||||
return "Tomorrow";
|
||||
|
||||
if (dateTime > DateTime.Today.AddDays(1) && dateTime < DateTime.Today.AddDays(7))
|
||||
return dateTime.DayOfWeek.ToString();
|
||||
|
||||
return dateTime.ToShortDateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using MvcMiniProfiler;
|
||||
using NzbDrone.Core;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
|
@ -199,7 +200,7 @@ namespace NzbDrone.Web.Controllers
|
|||
var airDate = String.Empty;
|
||||
|
||||
if (e.AirDate != null)
|
||||
airDate = e.AirDate.Value.ToShortDateString();
|
||||
airDate = e.AirDate.Value.ToBestDateString();
|
||||
|
||||
episodes.Add(new EpisodeModel
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue