The function below calculates the age based of the given parameters.
var now = new Date();
var past = new Date(select_year + "-" + select_month + "-" + select_day);
var nowYear = now.getFullYear();
var pastYear = past.getFullYear();
var age = nowYear - pastYear;
It works perfectly in Chrome.
But when I switch over to Safari, the following line says Invalid Date
:
var past = new Date(select_year + "-" + select_month + "-" + select_day);
I'm assuming it is failing to reconstruct the date.
Is there a way to fix this?