My Objective:
I am looking to instantiate a new Date object.
Snippet of My Code:
checkDates (currentRecSec: RecommendedSection){
var currActiveFrom = new Date(currentRecSec.activeFrom.year,currentRecSec.activeFrom.month,currentRecSec.activeFrom.day);
var currActiveTo = new Date(currentRecSec.activeTo.year,currentRecSec.activeTo.month,currentRecSec.activeTo.day);
}
The Issue I'm Facing
The structure of currentRecSec
is as follows:
activeFrom: {year: 2020, month: 10, day: 1}
activeTo: {year: 2020, month: 10, day: 2}
However, the output I receive shows:
Sun Nov 01 2020 00:00:00 GMT+0100 (Central European Standard Time)
Mon Nov 02 2020 00:00:00 GMT+0100 (Central European Standard Time)
This indicates that it displays November instead of October.
It is understood that the indexing for months starts from 0.
Could there be a straightforward solution to address this issue?