mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
11 lines
360 B
TypeScript
11 lines
360 B
TypeScript
|
import { differenceInDays, parseISO } from 'date-fns';
|
||
|
import { IInstanceStatus } from 'interfaces/instance';
|
||
|
|
||
|
export const calculateTrialDaysRemaining = (
|
||
|
instanceStatus?: IInstanceStatus
|
||
|
): number | undefined => {
|
||
|
return instanceStatus?.trialExpiry
|
||
|
? differenceInDays(parseISO(instanceStatus.trialExpiry), new Date())
|
||
|
: undefined;
|
||
|
};
|