diff --git a/src/est.js b/src/est.js index 6cdc7b5..88450e2 100644 --- a/src/est.js +++ b/src/est.js @@ -3,22 +3,30 @@ // @see https://www.usp.gv.at/steuern-finanzen/einkommensteuer-ueberblick/weitere-informationen-est/tarifstufen.html export function einkommensteuer(value, year) { - let limits = year >= 2023 ? [11693, 19134, 32075, 62080, 93120, 1000000] : [11000, 18000, 31000, 60000, 90000, 1000000]; + let limits = [11000, 18000, 31000, 60000, 90000, 1000000]; // 2022 and below let percentages = [0, 0.25, 0.35, 0.42, 0.48, 0.5, 0.55]; // 2021 and below - // 2025: Alle Steuerstufen werden um knapp 4 Prozent angehoben. - // @see https://www.bmf.gv.at/presse/pressemeldungen/2024/juli/brunner-entlastung-2025.html - if (year >= 2025) { - limits = [13308, 21617, 35836, 69166, 103072, 1000000]; - } - if(year >= 2024) { - percentages = [0, 0.2, 0.3, 0.4, 0.48, 0.5, 0.55]; // reduce 0.41 to 0.4 from 2023 to 2024 - } - if(year === 2023) { - percentages = [0, 0.2, 0.3, 0.41, 0.48, 0.5, 0.55]; - } - if(year === 2022) { - percentages = [0, 0.2, 0.325, 0.42, 0.48, 0.5, 0.55]; + // add switch for limits and percentages + switch (year) { + case 2022: + percentages = [0, 0.2, 0.325, 0.42, 0.48, 0.5, 0.55]; + break; + case 2023: + limits = [11693, 19134, 32075, 62080, 93120, 1000000]; + percentages = [0, 0.2, 0.3, 0.41, 0.48, 0.5, 0.55]; + break; + case 2024: + limits = [12816, 20818, 34513, 66612, 99266, 1000000]; + percentages = [0, 0.2, 0.3, 0.4, 0.48, 0.5, 0.55]; // reduce 0.41 to 0.4 from 2023 to 2024 + break; + // 2025: Alle Steuerstufen werden um knapp 4 Prozent angehoben. + // @see https://www.bmf.gv.at/presse/pressemeldungen/2024/juli/brunner-entlastung-2025.html + case 2025: + limits = [13308, 21617, 35836, 69166, 103072, 1000000]; + percentages = [0, 0.2, 0.3, 0.4, 0.48, 0.5, 0.55]; + break; + default: + break; } limits = limits.filter(limit => limit < value); diff --git a/tests/est.test.js b/tests/est.test.js index 93322ff..1a52105 100644 --- a/tests/est.test.js +++ b/tests/est.test.js @@ -1,13 +1,13 @@ import { einkommensteuer, freibetragValues, investGewinnfreibetrag } from '../src/est.js'; -test('should return 0 for 0-11693 income', () => { +test('should return 0 for 0-12816 income', () => { expect(einkommensteuer(0, 2024)).toBe(0); - expect(einkommensteuer(11693, 2024)).toBe(0); - expect(einkommensteuer(11694, 2024)).not.toBe(0); + expect(einkommensteuer(12816, 2024)).toBe(0); + expect(einkommensteuer(12817, 2024)).not.toBe(0); }); test('should return correct ESt for all levels in 2024', () => { - const limits = [11693, 19134, 32075, 62080, 93120, 1000000]; + const limits = [12816, 20818, 34513, 66612, 99266, 1000000]; const percentages = [0, 0.2, 0.3, 0.4, 0.48, 0.5, 0.55]; const levels = limits.map((limit, index) => { return { @@ -52,7 +52,7 @@ test('should return correct ESt for all levels in 2022', () => { }); test('should return correct ESt for all levels + 1€ in 2024', () => { - const limits = [11693, 19134, 32075, 62080, 93120, 1000000]; + const limits = [12816, 20818, 34513, 66612, 99266, 1000000]; const percentages = [0, 0.2, 0.3, 0.4, 0.48, 0.5, 0.55]; const levels = limits.map((limit, index) => { return {