Skip to content

Commit

Permalink
Merge pull request #18 from rewiringamerica/tomc/rebate-timeline
Browse files Browse the repository at this point in the history
don't claim that rebates will be available this year
  • Loading branch information
RandomEtc authored Sep 5, 2023
2 parents 09afa7e + da1e0f9 commit 73283f9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/incentive-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,20 @@ function formatAmount(amount: number, amount_type: AmountType) {
}

function formatStartDate(start_date: number, type: IncentiveType) {
if (start_date === 2022) {
return html`<em>Available Now!</em>`;
} else if (start_date === 2023) {
if (type === 'pos_rebate') {
return html`Late 2023`;
} else {
if (type === 'pos_rebate') {
// we hard-code 2024 for rebates because their availability is not yet certain
// FIXME: we should model the uncertainty explicitly rather than leaving it to frontend code
return html`2024`;
} else if (type === 'tax_credit') {
// for tax credits, the year is safe to use as data:
const thisYear = new Date().getFullYear();
if (start_date <= thisYear) {
return html`<em>Available Now!</em>`;
} else {
return html`${start_date.toString()}`;
}
} else {
// while we technically don't expect another IncentiveType, fall back to date here if needed:
return html`${start_date.toString()}`;
}
}
Expand Down

1 comment on commit 73283f9

@vercel
Copy link

@vercel vercel bot commented on 73283f9 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.