File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import { cachedStore } from '$lib/helpers/cache';
8
8
import { Query , type Models } from '@appwrite.io/console' ;
9
9
import { headerAlert } from './headerAlert' ;
10
10
import PaymentAuthRequired from '$lib/components/billing/alerts/paymentAuthRequired.svelte' ;
11
- import { diffDays } from '$lib/helpers/date' ;
12
11
import { addNotification , notifications } from './notifications' ;
13
12
import { goto } from '$app/navigation' ;
14
13
import { base } from '$app/paths' ;
@@ -161,7 +160,12 @@ export function calculateTrialDay(org: Organization) {
161
160
if ( org ?. billingPlan === BillingPlan . STARTER ) return false ;
162
161
const endDate = new Date ( org ?. billingStartDate ) ;
163
162
const today = new Date ( ) ;
164
- const days = diffDays ( today , endDate ) ;
163
+
164
+ let diffTime = endDate . getTime ( ) - today . getTime ( ) ;
165
+ diffTime = Math . ceil ( diffTime / ( 1000 * 60 * 60 * 24 ) ) + 1 ;
166
+
167
+ const days = diffTime < 1 ? 0 : diffTime ;
168
+
165
169
daysLeftInTrial . set ( days ) ;
166
170
return days ;
167
171
}
You can’t perform that action at this time.
0 commit comments