umbraco-community / Our.Umbraco.OpeningHours

An Umbraco property editor for handling opening hours
MIT License
9 stars 13 forks source link

GetUpcomingDays does also return current day #15

Open bjarnef opened 7 years ago

bjarnef commented 7 years ago

I would expect the method GetUpcomingDays to return upcoming days exclusive today. E.g. today Tuesday, I would expect GetUpcomingDays(7) to return the upcoming seven days, but not inclusive today.

@{
    OpeningHoursModel openingHours = Model.Content.GetOpeningHours();

    var upcomingDays = openingHours.GetUpcomingDays(7);

    <h3>Åbningstider</h3>

    foreach (var day in upcomingDays)
    {
        <strong>@day.WeekDayName</strong><br />
        @day.WeekDay<br />
        @day.Weekday<br /><br />
    }
}

image

image

abjerner commented 7 years ago

I think the idea was that if you're to list the opening hours of the upcoming days, you might want to display the opening hours of the present day as well (eg. watching the opening hours in the morning, the opening hours of the present day is still useful information).

If you can think of a better name, I'd be happy to change it. An alternative could be to implement a method for both scenarios - with and without the present day.

bjarnef commented 7 years ago

Ahh okay.. maybe then an overload of the method to include current day or an optional parameter, where the second parameter is a boolean. If true it also includes current day. By default I think this should be false.