mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
feat: add money request cronjob, and edit money request entity
This commit is contained in:
@ -84,7 +84,13 @@ export class Allowance {
|
||||
const calculateNextDate = (unit: moment.unitOfTime.Diff) => {
|
||||
const diff = now.diff(startDate, unit);
|
||||
const nextDate = startDate.clone().add(diff, unit);
|
||||
return nextDate.isSameOrAfter(now) ? nextDate.toDate() : nextDate.add('1', unit).toDate();
|
||||
const adjustedDate = nextDate.isSameOrAfter(now) ? nextDate : nextDate.add('1', unit);
|
||||
|
||||
if (endDate && adjustedDate.isAfter(endDate)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return adjustedDate.toDate();
|
||||
};
|
||||
|
||||
switch (this.frequency) {
|
||||
|
Reference in New Issue
Block a user