I am running a script on a page that tests the current date against the date the user specifies as the date for their entry (Diary Site). If the users entry date is a date greater than the current date they are given an alert that they can only enter a date for the current date or a previous one. Everything operates as it should in IE6 (and above) and Firefox. However, the Safari Browser run on Macs is allowing users to post entries beyond the current date.
Using alerts to test for the location of the issue, I have found that it is in the
new Date(); that is created using the values from the form in Safari.
The line of code giving me the issue is the var formDate = new Date(values): values I assume being the culprit:
When I run an alert..alert(formDate); I am given the error "Invalid Date".
var formDate = new Date(form.byear.value + " " + form.bmonth.value + " " + form.bday.value);
In all other browsers I am given:
Day Month Date Year Hrs:Minutes:Seconds GMT as you would expect.
I have run tests to ensure that document.byear.value, bmonth and bday are all being passed correctly and they are (In all Browsers including Safari).
Has anyone else encountered this issue?