I want to write a script that returns a boolean value as to whether the entered text is a valid or invalid date, something like:
–Date: Sunday, March 11, 2012
set longDate to (current date)
set dateString to (date string of longDate)
set enteredDate to text returned of (display dialog “Enter date to be tested” default answer dateString)
–If the user changes the default date to say, Monday, March 11, 2012, then it is not a valid date because the 12th falls on Monday, not the 11th
I know how to trap for such off-the-wall things as Doomsday, March 81, 2012 and others of the sort, but noone is likely to enter such things.
Does anyone have any idea how I would set out to do this ?
Model: MacBook
AppleScript: 2.1.2
Browser: Chrome 17.0
Operating System: Mac OS X (10.6)