From b55437fa7e4d4787d8c71a9682aaecfcf6b245a5 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 17 Oct 2024 13:47:38 +0700 Subject: [PATCH] fix(05): end of month installments --- src/pages/05_quotation/QuotationFormInfo.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/05_quotation/QuotationFormInfo.vue b/src/pages/05_quotation/QuotationFormInfo.vue index a94990a9..51518d04 100644 --- a/src/pages/05_quotation/QuotationFormInfo.vue +++ b/src/pages/05_quotation/QuotationFormInfo.vue @@ -165,10 +165,13 @@ function installmentsDate(date: Date | string) { return pay; } - // Create a new Date object to avoid mutating the original one let updatedDate = new Date(firstPayDateObj); updatedDate.setMonth(updatedDate.getMonth() + index); + if (updatedDate.getDate() !== firstPayDateObj.getDate()) { + updatedDate.setDate(0); + } + return { ...pay, date: updatedDate.toISOString(),