fix(05): end of month installments
This commit is contained in:
parent
6ddf3a9030
commit
b55437fa7e
1 changed files with 4 additions and 1 deletions
|
|
@ -165,10 +165,13 @@ function installmentsDate(date: Date | string) {
|
||||||
return pay;
|
return pay;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new Date object to avoid mutating the original one
|
|
||||||
let updatedDate = new Date(firstPayDateObj);
|
let updatedDate = new Date(firstPayDateObj);
|
||||||
updatedDate.setMonth(updatedDate.getMonth() + index);
|
updatedDate.setMonth(updatedDate.getMonth() + index);
|
||||||
|
|
||||||
|
if (updatedDate.getDate() !== firstPayDateObj.getDate()) {
|
||||||
|
updatedDate.setDate(0);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...pay,
|
...pay,
|
||||||
date: updatedDate.toISOString(),
|
date: updatedDate.toISOString(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue