Skip to content

Commit

Permalink
remove void permit duration calculation
Browse files Browse the repository at this point in the history
for partial refund
  • Loading branch information
gchauhan-aot committed Jan 16, 2025
1 parent 70b9d7b commit 143e869
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions vehicles/src/common/helper/permit-fee.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '../constants/permit.constant';
import { differenceBetween } from './date-time.helper';
import * as dayjs from 'dayjs';
import { ApplicationStatus } from '../enum/application-status.enum';
import { Nullable } from '../types/common';

/**
Expand Down Expand Up @@ -103,19 +102,8 @@ export const yearlyPermit = (duration: number): boolean => {
};

export const calculateDuration = (application: Permit): number => {
let startDate = application.permitData.startDate;
const startDate = application.permitData.startDate;
const endDate = application.permitData.expiryDate;
const today = dayjs(new Date()).format('YYYY-MM-DD');
if (
application.permitStatus === ApplicationStatus.VOIDED &&
startDate < today
)
startDate = today;
if (
application.permitStatus === ApplicationStatus.VOIDED &&
today === startDate
)
startDate = dayjs(today).add(1, 'day').format('YYYY-MM-DD');
const duration = differenceBetween(startDate, endDate) + 1;
return duration;
};
Expand Down

0 comments on commit 143e869

Please sign in to comment.