In my html document I have a date field:
<input type="date" id="birthDate" class="date-picker">
I get this date in javascript like so:
var birthdate = new Date($('#birthDate').val());
and do some sums:
var today = new Date(Date.now());
var oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
var bornDays = Math.floor(Math.abs((today.getTime() - birthdate.getTime()) / (oneDay)));
The user enters a date in DD/MM/YYYY format on the html page. In Chrome this works fine and gives me the correct number of days since birth 'bornDays'. IE however appears to interpret the entered date as being US format, i.e. MM/DD/YYYY so when I get the date into javascript it thinks the days are months and vice versa. How can I specify that the date is in UK format when getting it from IE?
EXTRA CLARIFICATION:
If the user enters a date 09/11/2018 in the browser
In Chrome,
birthdate.getDate() returns 9
In IE,
birthdate.getDate() returns 11