File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
app/[locale]/[state]/analytics/components Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff 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 >
You can’t perform that action at this time.
0 commit comments