I'm trying to get the last day of a given month and year. The user has the option to insert the month and year in the following format mm.yyyy
(e.g. 08.2020
).
I'm trying to get the first day and the last day of the given month:
let dtFrom = '01.' + $('#month_from').val(); // adds 01. to the month.year to get the first
let dateFrom = new Date(dtFrom);
let LastDay = new Date(dateFrom.getFullYear(), dateFrom.getMonth() + 1, 0);
let lastDayFormat = ((LastDay.getDate() > 9) ? LastDay.getDate() : (LastDay.getDate()));
console.log('lastDayFormat: ' + LastDayFormat);
when testing, it works using chrome, but not firefox