File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -89,9 +89,10 @@ export const IsaacApp = () => {
89
89
} , [ ] ) ;
90
90
91
91
useEffect ( ( ) => {
92
+ const dateNow = new Date ( ) ;
92
93
if ( showNotification ( user ) && notifications && notifications . length > 0 ) {
93
94
dispatch ( openActiveModal ( notificationModal ( notifications [ 0 ] ) ) ) ;
94
- persistence . save ( KEY . LAST_NOTIFICATION_TIME , Date . now ( ) . toString ( ) )
95
+ persistence . save ( KEY . LAST_NOTIFICATION_TIME , dateNow . toString ( ) )
95
96
}
96
97
} , [ notifications , user ] ) ;
97
98
Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ import {KEY} from "./localStorage";
4
4
5
5
6
6
export function showNotification ( user : RegisteredUserDTO | null ) {
7
- if ( user && user . registrationDate && ( Date . now ( ) - ( Number ( user . registrationDate ) ) > 14 * 24 * 60 * 60 * 1000 ) ) {
8
- if ( Date . now ( ) - Number ( persistence . load ( KEY . LAST_NOTIFICATION_TIME ) ) > 24 * 60 * 60 * 1000 ) {
7
+ const dateNow = new Date ( ) ;
8
+ const notificationTime = persistence . load ( KEY . LAST_NOTIFICATION_TIME ) ;
9
+ if ( user && user . registrationDate && ( dateNow . getTime ( ) - new Date ( user . registrationDate ) . getTime ( ) ) > 14 * 24 * 60 * 60 * 1000 ) {
10
+ if ( dateNow . getTime ( ) - ( new Date ( notificationTime || "0" ) . getTime ( ) ) > 24 * 60 * 60 * 1000 ) {
9
11
return true
10
12
}
11
13
} else return false
You can’t perform that action at this time.
0 commit comments