diff --git a/src/Form.tsx b/src/Form.tsx index 98afd9b..7e1c6b2 100644 --- a/src/Form.tsx +++ b/src/Form.tsx @@ -15,6 +15,7 @@ import { import { formatMoney, formatPercentage } from "./formatting"; import { Percentage } from "./Percentage"; import { DatePicker } from "@mui/x-date-pickers"; +import { getMaxContribution } from "./constants"; export default function Form() { // Form fields @@ -29,7 +30,7 @@ export default function Form() { >(0); const [targetContribution, setTargetContribution] = React.useState< number | undefined - >(22500); + >(getMaxContribution()); // Calculated fields const paycheckAmount = getPaycheckAmount(annualSalary, paycheckFrequency); @@ -155,7 +156,7 @@ export default function Form() { $ ), }} - helperText="Note: The annual maximum for 2023 is $22,500." + helperText={`Note: The annual maximum for ${new Date().getFullYear()} is $${getMaxContribution()}.`} /> diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..95541fa --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,11 @@ +export function getMaxContribution() { + const year = new Date().getFullYear(); + + if (year === 2023) { + return 22500; + } else if (year === 2024) { + return 23000; + } + + return 23000; +}