File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/app/user/instance-new Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,9 @@ export class InstanceExperimentSelectComponent implements OnInit {
118118 this . includeOpenData = true ;
119119 }
120120
121+ // Ensure valid years read from localStorage
122+ const currentYear = new Date ( ) . getFullYear ( ) ;
123+
121124 const localInstrumentId = localStorage . getItem ( InstanceExperimentSelectComponent . USER_INSTANCE_EXPERIMENTS_INSTRUMENT_ID_KEY ) ;
122125 const localFromYear = localStorage . getItem ( InstanceExperimentSelectComponent . USER_INSTANCE_EXPERIMENTS_FROM_YEAR_KEY ) ;
123126 const localToYear = localStorage . getItem ( InstanceExperimentSelectComponent . USER_INSTANCE_EXPERIMENTS_TO_YEAR_KEY ) ;
@@ -129,10 +132,10 @@ export class InstanceExperimentSelectComponent implements OnInit {
129132 this . _instrumentId = + localInstrumentId ;
130133 }
131134 if ( localFromYear ) {
132- this . _fromYear = + localFromYear ;
135+ this . _fromYear = Math . min ( + localFromYear , currentYear ) ;
133136 }
134137 if ( localToYear ) {
135- this . _toYear = + localToYear ;
138+ this . _toYear = Math . min ( + localToYear , currentYear ) ;
136139 }
137140 if ( localIncludingOpenData ) {
138141 this . _includeOpenData = localIncludingOpenData === 'true' ;
You can’t perform that action at this time.
0 commit comments