Skip to content

Commit

Permalink
Update dateRangelabels
Browse files Browse the repository at this point in the history
Co-authored-by: Mary McGrath <m.c.mcgrath13@gmail.com>
  • Loading branch information
angelathe and mcmcgrath13 authored Dec 20, 2024
1 parent 3c82083 commit 50bdae1
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions containers/ecr-viewer/src/app/view-data/utils/date-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,13 @@ export enum DateRangeOptions {
LastYear = "last-year",
}

export const dateRangeLabels: { [key in DateRangeOptions]: string } = {
[DateRangeOptions.Last24Hours]: toSentenceCase(
DateRangeOptions.Last24Hours.replace(/-/g, " "),
) as string,
[DateRangeOptions.Last7Days]: toSentenceCase(
DateRangeOptions.Last7Days.replace(/-/g, " "),
) as string,
[DateRangeOptions.Last30Days]: toSentenceCase(
DateRangeOptions.Last30Days.replace(/-/g, " "),
) as string,
[DateRangeOptions.Last3Months]: toSentenceCase(
DateRangeOptions.Last3Months.replace(/-/g, " "),
) as string,
[DateRangeOptions.Last6Months]: toSentenceCase(
DateRangeOptions.Last6Months.replace(/-/g, " "),
) as string,
[DateRangeOptions.LastYear]: toSentenceCase(
DateRangeOptions.LastYear.replace(/-/g, " "),
) as string,
};
export const dateRangeLabels = Object.keys(DateRangeOptions).reduce((res, k) => {
if (typeof DateRangeOptions[k] === 'number') {
res[k] = toSentenceCase(k.replace(/-/g, " "))
}
return res
}, {}
)

/**
* Calculates the date a specified number of days ago from the given date
Expand Down

0 comments on commit 50bdae1

Please sign in to comment.