1- import moment from 'moment'
21import Permissions from '../../../security/permissions'
32import identifyTenant from '../../../segment/identifyTenant'
43import MemberEnrichmentService from '../../../services/premium/enrichment/memberEnrichmentService'
54import PermissionChecker from '../../../services/user/permissionChecker'
65import { FeatureFlagRedisKey } from '../../../types/common'
76import { RedisCache } from '../../../utils/redis/redisCache'
87import track from '../../../segment/track'
8+ import { createServiceLogger } from '../../../utils/logging'
9+ import { getSecondsTillEndOfMonth } from '../../../utils/timing'
10+
11+ const log = createServiceLogger ( )
912
1013export default async ( req , res ) => {
1114 new PermissionChecker ( req ) . validateHas ( Permissions . values . memberEdit )
@@ -21,10 +24,9 @@ export default async (req, res) => {
2124
2225 const memberEnrichmentCount = await memberEnrichmentCountCache . getValue ( req . currentTenant . id )
2326
24- const endTime = moment ( ) . endOf ( 'month' )
25- const startTime = moment ( )
27+ const secondsRemainingUntilEndOfMonth = getSecondsTillEndOfMonth ( )
2628
27- const secondsRemainingUntilEndOfMonth = endTime . diff ( startTime , 'days' ) * 86400
29+ log . info ( secondsRemainingUntilEndOfMonth , 'Seconds remaining' )
2830
2931 if ( ! memberEnrichmentCount ) {
3032 await memberEnrichmentCountCache . setValue (
0 commit comments