1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Added ToBestDateString for DateTime, using on Series/Details.

This commit is contained in:
Mark McDowall 2011-09-27 17:10:08 -07:00
parent 5f0a95b2b1
commit 9271b39787
3 changed files with 20 additions and 1 deletions

View File

@ -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>

View File

@ -28,5 +28,22 @@ public static Int64 Gigabytes(this int gigabytes)
{
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();
}
}
}

View File

@ -4,6 +4,7 @@
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 @@ private List<EpisodeModel> GetEpisodeModels(IList<Episode> episodesInDb)
var airDate = String.Empty;
if (e.AirDate != null)
airDate = e.AirDate.Value.ToShortDateString();
airDate = e.AirDate.Value.ToBestDateString();
episodes.Add(new EpisodeModel
{