<!DOCTYPE html>
<html>
<head>
	<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
	<meta content="utf-8" http-equiv="encoding">
	<link rel="stylesheet" type="text/css" href="index.css">
	<style>
		.deadline {
			display: inline;
		}

		.late {
			color: red;
		}
	</style>
</head>
<body>
	<h1>Grades when</h1>
	<h2>AN Resit</h2>
	<p>
	The resit for AN was at 2023-07-28.</br>
	The grade deadline <span class="deadline" data-deadline="2023-08-18"></span>.
	</p>

	<h2>OT</h2>
	<p>
	The hand-in of the OT report was at 2023-06-04.</br>
	The grade deadline <span class="deadline" data-deadline="2023-06-22"></span>.
	</p>

	<h2>RP2</h2>
	<p>
	The hand-in of the RP2 report was at 2023-07-14.</br>
	The final date of re-enrolment <span class="deadline" data-deadline="2023-08-31"></span>.
	</p>

	<h2>AS</h2>
	<p>
	The grades were published 2023-07-19 🎉
	</p>

	<h1>References</h2>
	OER-A (<a href="https://beeldbank.uva.nl/m/4ae52bce4e5d86a8/original/OER-2022-2023-FNWI-MSc-EN.pdf">link</a>):
	<ul>
	<li>The resit for an examination must not take place within ten working days of the announcement of the result of the examination being resat.</li>
	<li>The examiner determines the result (= mark) of a written examination as soon as possible, but at the latest within fifteen working days.</li>
	</ul>

	<!--
	OER-A 2022 - 2023:
	The resit for an examination must not take place within ten working days of the announcement of the result of the examination being resat.
	The examiner determines the result (= mark) of a written examination as soon as possible, but at the latest within fifteen working days.

	 AS 
	Exam date 30th May
	Deadline grade 19th June
	Retake date 4th August
	Deadline grade for resit 21st July

	 OT 
	OT deadline date 4th June
	OT grade deadline 22th June

	 RP2 
	RP2 handin date 14th July
	Final re-enrollment date 31th August
	-->
	<script>
		function set_deadlines() {
			const minute = 60;
			const hour = 60 * minute;
			const day = 24 * hour;
			const now = Date.now();
			const deadlines = document.getElementsByClassName('deadline');
			for (let i = 0; i < deadlines.length; ++i) {
				const deadline = deadlines[i];
				const dl_date = Date.parse(deadline.dataset.deadline);

				var str = "";

				str += dl_date > now ? "is at " : "was at ";
				var time_added = false;

				str += deadline.dataset.deadline;
				str += " (";
				str += "<span";
				str += dl_date < now ? ' class="late">' : ">";

				var timediff = Math.round((now - dl_date) / 1000);
				timediff = timediff < 0 ? -timediff : timediff

				if (timediff >= day) {
					const days = Math.floor(timediff / day);
					str += days + " days";
					time_added = true;
					timediff -= days * day;
				}

				if (timediff >= hour) {
					const hours = Math.floor(timediff / hour);
					if (time_added) {
						str += ", ";
					}
					str += hours + " hours";
					time_added = true;
					timediff -= hours * hour;
				}

				if (timediff >= minute) {
					const minutes = Math.floor(timediff / minute);
					if (time_added) {
						str += ", ";
					}
					str += minutes + " minutes";
					time_added = true;
					timediff -= minutes * minute;
				}

				if (time_added) {
					str += " and ";
				}
				str += timediff + " seconds";
				time_added = true;

				str += dl_date > now ? " from now" : " ago";
				str += "</span>" ;
				str += ")";

				deadline.innerHTML = str;
			}
		}

		setInterval(set_deadlines, 1000);
		set_deadlines();
	</script>
</body>
</html