Calculating the first day of the week given a specified date corrected with a specified weeknumber

Well, I needed a function to calculate the first day of the weeknumber of a given date corrected with a specified week-number. I did came up with the following wich does it work according to the unit tests. But I'm still not 100% confinced...so Shoot!

public class CABdate
{
    // returns the first day of a week last year from the specified date corrected 
    // with the weeknumber
    public DateTime GetFirstDayOfWeekLastYear( this DateTime date, int weeknumber)
    {
        DateTime firstOfJanuariLastYear = new DateTime((date.Year - 1), 1, 1);
        DateTime firstSundayLastYear = 
            firstOfJanuariLastYear.AddDays(
                GetAmountOfDaysUntilFirstDayOfWeek(firstOfJanuariLastYear)
                );
        int week = GetWeekNumberFromDate(date) + weeknumber + WeekFix(firstSundayLastYear);

        double aantaldagen = week * 7;

        DateTime firstdayofspecifiedweeklastyear = firstSundayLastYear.AddDays(aantaldagen);
        return GetFirstDayOfTheWeekFromDate(firstdayofspecifiedweeklastyear);
    }

    private DateTime GetFirstDayOfTheWeekFromDate(DateTime startdate)
    {
        while (startdate.DayOfWeek != DayOfWeek.Sunday)
        {
            startdate = startdate.AddDays(-1);
        }
        return startdate;
    }

    public int GetWeekNumberFromDate(DateTime datetime)
    {
        CultureInfo ciCurr = CultureInfo.CurrentCulture;
        return ciCurr.Calendar.GetWeekOfYear(
            datetime, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday
            );
    }

    private int WeekFix(DateTime eerstemaandag)
    {
        int returnwaarde = -1;
        if (GetWeekNumberFromDate(eerstemaandag) == 52)
        {
            returnwaarde = 0;
        }
        return returnwaarde;
    }

    private int GetAmountOfDaysUntilFirstDayOfWeek(DateTime date)
    {
        return DayOfWeek.Sunday - date.DayOfWeek;
    }
}

{{opmerking.Naam}}:

{{opmerking.OpmerkingText}}

            

Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!