Skip to content

Commit d3ecce8

Browse files
committed
Test failed
1 parent 4caad16 commit d3ecce8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/[locale]/[state]/analytics/components/filter-dropdown-options.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ export default function FilterDropdownOptions({
8787
...(getRevenueCircleOptionsForDistrict(districtCode) || []),
8888
]);
8989

90-
const getDefaultDate = (timePeriod: string) => {
91-
const [year, month] = timePeriod.split('_');
90+
const getDefaultDate = (timePeriod?: string | null) => {
91+
const fallback =
92+
timePeriod ||
93+
(process.env.NEXT_PUBLIC_TIME_PERIOD as string) ||
94+
'2023_01';
95+
const [year, month] = fallback.split('_');
9296
return parseDate(`${year}-${month?.padStart(2, '0')}-01`);
9397
};
9498

@@ -100,9 +104,7 @@ export default function FilterDropdownOptions({
100104
? parseDate(
101105
getLatestDate(selectedTimePeriod.filter(Boolean)) || '2023-08-01'
102106
)
103-
: timePeriod
104-
? getDefaultDate(timePeriod)
105-
: getDefaultDate(process.env.NEXT_PUBLIC_TIME_PERIOD as string);
107+
: getDefaultDate(timePeriod);
106108

107109
return (
108110
<div>

0 commit comments

Comments
 (0)