File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
packages/firebase/functions/src Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export const hideContent = async (hideContentPayload: HideContentPayload): Promi
54
54
flag : FLAGS . hidden ,
55
55
reasons : item . moderation ?. reasons || [ ] ,
56
56
moderatorNote : item . moderation ?. moderatorNote || '' ,
57
- quietEnding : item . moderation ?. countdownStart || null ,
57
+ quietEnding : item . moderation ?. quietEnding || null ,
58
58
updatedAt,
59
59
countdownPeriod,
60
60
reporter : userId ,
Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ import { firestore } from 'firebase-admin';
9
9
*/
10
10
export const getNewCountdown = ( currCountdown : number , quietEndingPeriod : number ) : number => {
11
11
12
- const now = firestore . Timestamp . now ( ) ;
13
- const countdownHour = ( new Date ( currCountdown * 1000 ) ) . getHours ( ) ;
14
- const diff = ( Math . abs ( ( now . toDate ( ) ) . getHours ( ) - countdownHour ) ) % 24 ;
12
+ const nowMillis = ( firestore . Timestamp . now ( ) ) . toMillis ( ) ;
13
+ const countdownMillis = currCountdown * 1000 ;
14
+
15
+ const diff = ( countdownMillis - nowMillis ) / 1000 / 60 / 60 ;
15
16
16
17
if ( diff > 0 && diff < quietEndingPeriod / 3600 )
17
18
{
You can’t perform that action at this time.
0 commit comments