I have the following fields on my html
page:
When I click save I refer to each field and create a new date as shown here:
var dob = new Date(this.editProfileForm.value['year'], this.editProfileForm.value['month'], this.editProfileForm.value['day']
When displays:
Mon Jan 23 1989 00:00:00 GMT+1100
Which as you can see is incorrect, how is it getting January? my html
markup for my select list month is:
<select name="month" id="month" class="form-control" formControlName="month">
<option value="" selected>Please Select</option>
<option value=01>January</option>
<option value=02>February</option>
<option value=03>March</option>
<option value=04>April</option>
<option value=05>May</option>
<option value=06>June</option>
<option value=07>July</option>
<option value=08>August</option>
<option value=09>September</option>
<option value=10>October</option>
<option value=11>November</option>
<option value=12>December</option>
</select>
When I change this to start with 00
for January all the way to 11
for December it works... but that doesn't seem correct to me?
But it also does the same for the Year too... which is dynamically built:
<option _ngcontent-c2="" value="1999" ng-reflect-value="1999">1999</option>
<option _ngcontent-c2="" value="1998" ng-reflect-value="1998">1998</option>
<option _ngcontent-c2="" value="1997" ng-reflect-value="1997">1997</option>
All the way down to 1939...
Can someone shed some light into why this might be happening regarding the month and year?
I've just noticed it's also decreasing the day by 1 every time I save it.