function red_days(year) {
A = year % 19;
B = Math.round(year/100);
C = year % 100;
D = Math.round(B/4);
E = B % 4;
F = Math.round((B+8)/25);
G = Math.round((B-F+1)/3);
H = (19*A+B-D-G+15) % 30;
I = Math.round(C/4);
J = C % 4;
K = (32+2*E+2*I-H-J) % 7;
L = Math.round((A+11*H+22*K)/451);
M = Math.round((H+K-7*L+114)/31);
N = (H+K-7*L+114) % 31;
paskdagen = year + '-' + ('0'+M).slice(-2) + '-' + ('0'+(N+1)).slice(-2);
midsomdag = new Date(year + '-06-20');
allahelgo = new Date(year + '-10-31');
if (new Date(midsomdag).getDay() < 7) {
/*while (new Date(midsomdag).getDay() < 7) {
midsomdag++;
}*/
}
if (new Date(allahelgo).getDay() < 7) {
/*while (new Date(allahelgo).getDay() < 7) {
allahelgo++;
}*/
}
red = {};
red['Nyårsdagen'] = year + '-01-01';
red['Trettondagen'] = year + '-01-06';
red['Långfredag'] = new Date(new Date(paskdagen).valueOf()-(3600*24*2)).toISOString();
red['Påskdagen'] = paskdagen;
red['Annandag påsk'] = new Date(new Date(paskdagen).valueOf()+(3600*24*1)).toISOString();
red['Första maj'] = year + '-05-01';
red['Kristi himmelfärdsdag'] = new Date(new Date(paskdagen).valueOf()+(3600*24*39)).toISOString();
red['Pingstdagen'] = new Date(new Date(paskdagen).valueOf()+(3600*24*49)).toISOString();
red['Annandag pingst'] = new Date(new Date(paskdagen).valueOf()+(3600*24*50)).toISOString();
red['Sveriges nationaldag'] = year + '-06-06';
red['Midsommarafton'] = new Date(new Date(midsomdag).valueOf()-(3600*24*1)).toISOString();
red['Midsommardagen'] = new Date(midsomdag).toISOString();
red['Alla helgons dag'] = new Date(allahelgo).toISOString();
red['Julafton'] = year + '-12-24';
red['Juldagen'] = year + '-12-25';
red['Annandag jul'] = year + '-12-26';
return red;
}
console.log(JSON.stringify(reddays(2020)));