AppleScript: < and > a set date
Hi,
I'm wanting to get the result of "Current" if the date on the website (current eg. https://comicvine.gamespot.com/invincible-iron-man/4050-95596/ ended eg. https://comicvine.gamespot.com/howard-the-human/4050-83960/)(only month and year) comes after a set date (March 2018) and "Ended" if it comes before that date.
The Ended script runs fine, but I can't get the Current part the work unless I reverse the current and ended ifs. Is there something that I'm not doing or need to add?
Thank you in advance
tell application "Google Chrome"
repeat with x from 0 to ((executeactive tab of first windowjavascript "document.getElementsByTagName('p').length") - 1)
set theEnd to executeactive tab of first windowjavascript "document.getElementsByTagName('p')[" & x & "].outerHTML"
if theEnd contains "issue-date" then exit repeat
end repeat
set theEnd to executeactive tab of first windowjavascript "document.getElementsByTagName('p')[" & x & "].innerHTML"
set issueDate to date "Thursday, 1 March 2018 at 12:00:00 am"
if theEnd is greater than or equal to issueDate then set theResult to "Current"
if theEnd is less than issueDate then set theResult to "Ended"
end tell
MacBook Pro with Retina display, macOS High Sierra (10.13.4)