Ejemplo n.º 1
0
        public async Task GetDaysUntilHoliday([Remainder][Summary("Name of the holiday to get a countdown for.")] string holidayName)
        {
            var now = DateTime.Now;

            var holiday = await _holidayService.GetHolidayByName(holidayName, "US", now.Year);

            var daysUntilHoliday = holiday.Date.Subtract(now).Days;

            if (daysUntilHoliday > 0)
            {
                await ReplyAsync($"There are {daysUntilHoliday} days until {holiday.Name}.");
            }
            else
            {
                await ReplyAsync($"{holiday.Name} was {daysUntilHoliday * -1} days ago.");
            }
        }