noiasca
4
you have lot of duplicated code lines.
"day of year" ... is a solved problem and if you do some research you will find shorter variants.
this is just the first result I found:
and the evaluation of your DST looks very copy-pasted too.
there is a shorter variant from @jurs