File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -375,23 +375,22 @@ const decideShowDefaultGate = (): ShowGateValues => {
375375} ;
376376
377377const getGateDisplayCount = ( ) : number => {
378- const rawValue = storage . local . getRaw ( 'gate_display_count' ) ;
379- const count = parseInt ( rawValue ?? '0' , 10 ) ;
380- return count ;
378+ const count = parseInt (
379+ storage . local . getRaw ( 'gate_display_count' ) ?? '0' ,
380+ 10 ,
381+ ) ;
382+ if ( Number . isInteger ( count ) ) {
383+ return count ;
384+ }
385+ return 0 ;
381386} ;
382387
383388const incrementGateDisplayCount = ( ) => {
384389 const count = getGateDisplayCount ( ) ;
385- const now = new Date ( ) ;
386- const oneYearFromNow = new Date ( now . getTime ( ) + 365 * 86400 ) ;
387390 const newCount = count + 1 ;
388391 // Using `storage.local.set`, instead of `storage.local.setRaw`
389392 // because `setRaw` doesn't allow for specifying the duration.
390- storage . local . set (
391- 'gate_display_count' ,
392- newCount . toString ( ) ,
393- oneYearFromNow ,
394- ) ;
393+ storage . local . setRaw ( 'gate_display_count' , newCount . toString ( ) ) ;
395394} ;
396395
397396const buildAuxiaGateDisplayData = async (
You can’t perform that action at this time.
0 commit comments