# daystart

!!sets daystart_start to current day and must be called only after start date is set
if daystart_start = 0:
	if month > 1:daystart_start += 31
	if month > 2:
		if ((year mod 4 = 0) and (year mod 100 ! 0)) or (year mod 400 = 0):
			daystart_start += 29
		else
			daystart_start += 28
		end
	end
	if month > 3:daystart_start += 31
	if month > 4:daystart_start += 30
	if month > 5:daystart_start += 31
	if month > 6:daystart_start += 30
	if month > 7:daystart_start += 31
	if month > 8:daystart_start += 31
	if month > 9:daystart_start += 30
	if month > 10:daystart_start += 31
	if month > 11:daystart_start += 30
	if month > 12:daystart_start += 31
	daystart_start += day
end

daystart = (year - 2016) * 365
!!Leap year correction (+1 for 2016 which has 366 days, and +1 for every 4th year after)
if year > 2016: daystart += 1 + (year - 2016) / 4

i=1
:daystart

if month > i:

	daystart += monthsend[i]
	i += 1

	jump 'daystart'
end

daystart += day

daystart -= daystart_start

daystart += 1

--- daystart ---------------------------------

