I have a strange issue , when trying to coerce dates. The following script logs result of checking if 12/21/21 is greater than January 1,2022 or February 1, 2022 in the 1st case it returns true which is obviously incorrect in the second false which is correct. I checked every month and it returns the same error for Oct, Nov & Dec. So it appears as if a “1” in the month is the problem.
Does anyone have any suggestions or can tell me what I may be doing incorrectly.
this is the log of the results
(Ex 12/21/21 Opt 1/1/22 Ex > Opt true)
(Ex 12/21/21 Opt 2/1/22 Ex > Opt false)
set ExdivDate to "12/21/21"
set ExdivDate to date ExdivDate
set Optdate to "January 1,2022"
set Optdate to date Optdate
set ExdivDate to short date string of ExdivDate
set Optdate to short date string of Optdate
log "Ex " & ExdivDate & " Opt " & Optdate & " Ex > Opt " & (ExdivDate > Optdate)
set ExdivDate to "12/21/21"
set ExdivDate to date ExdivDate
set Optdate to "February 1,2022"
set Optdate to date Optdate
set ExdivDate to short date string of ExdivDate
set Optdate to short date string of Optdate
log "Ex " & ExdivDate & " Opt " & Optdate & " Ex > Opt " & (ExdivDate > Optdate)