fix import date cast bug

This commit is contained in:
Dobromir Popov
2024-04-13 19:18:45 +03:00
parent cb2ed5aa4d
commit 74f308743d
2 changed files with 3 additions and 1 deletions

View File

@ -183,7 +183,7 @@ export default function ImportPage() {
let day = new Date();
day.setDate(1); // Set to the first day of the month to avoid overflow
if (importDate && importDate.value) {
let monthOfIportInfo = common.getMonthInfo(importDate.value);
let monthOfIportInfo = common.getMonthInfo(new Date(importDate.value));
day = monthOfIportInfo.firstMonday;
}

View File

@ -249,6 +249,8 @@ exports.getDateFromWeekNrAndDayOfWeek = function (firstMonday, weekNr, dayOfWeek
}
exports.getMonthDatesInfo = function (date) {
// cast to date if not daate
date = new Date(date);
// get first day of the month
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
// get first day of next month