namespace WeatherDashboard.Extensions
{
    public static class DateExtensions
    {
        public static string FriendlyDate(this DateTime date)
        {
            var format = date.Year < DateTime.Now.Year
                ? "dddd, M/d/yy"
                : "dddd, M/d";

            return date.Date == DateTime.Now.Date ? "Today" 
                : date.Date == DateTime.Now.AddDays(-1).Date ? "Yesterday"
                : date.Date == DateTime.Now.AddDays(1).Date ? "Tomorrow"
                : date.ToString(format);
        }
    }
}
