Get weekofweekyear in NodaTime asp.net core

public static int IsoWeekOfYear(this DateTime dateTime)
        {
            var date = new LocalDate(dateTime.Year, dateTime.Month, dateTime.Day);
            //weekOfWeekYear
            return date.WeekOfWeekYear;
        }

WeekOfWeekYear does not exist in the LocalDate Assembly..

How an I go around this?

Jon Skeet
people
quotationmark

If you're using .NET Core, you're probably using a beta of 2.0. (I'm hoping to release 2.0 within a week.)

The week-of-week-year handling has been overhauled for 2.0. In 2.0 you'd use:

return WeekYearRules.Iso.GetWeekOfWeekYear(date);

(You'll need a using directive for the NodaTime.Calendars namespace.)

If you want to use a non-ISO week numbering, you can use one of the factory methods in WeekYearRules.

people

See more on this question at Stackoverflow