diff --git a/calendar/generate_calendar.php b/calendar/generate_calendar.php index e3a16c7..c88f6a2 100644 --- a/calendar/generate_calendar.php +++ b/calendar/generate_calendar.php @@ -39,10 +39,6 @@ Example: - $year = 2013; - - $first_monday = new DateTime( "2012-12-31" ); - $periods = array( 'SummerSchool' => array( 'first_week' => 2, @@ -97,6 +93,11 @@ require 'calendar_config.php'; +// Get first Monday of week 1 according to ISO 8601. +$year = date("Y"); +$first_monday = new DateTime(); +$first_monday->setISODate($year, 1); + // A couple of handy date intervals: four days to the end of the current week, // and seven days to the start of next week. $plus_four_days = new DateInterval( 'P4D' );