diff --git a/pages/cart/publishers/import.tsx b/pages/cart/publishers/import.tsx index 99cda46..81d3824 100644 --- a/pages/cart/publishers/import.tsx +++ b/pages/cart/publishers/import.tsx @@ -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; } diff --git a/src/helpers/common.js b/src/helpers/common.js index f2cf555..b732095 100644 --- a/src/helpers/common.js +++ b/src/helpers/common.js @@ -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