Looking for way to set alarm to ToDo (list) / external app?

an alternative, if you prefer, understandably, to avoid firing up an instance of JSContext from AppleScript (but would still like a tested date library to handle the edge cases) is to:

  • add the incantation "use framework Foundation" at the top of your script,
  • and study the ObjC (rather than Swift) documentation of NSISO8601DateFormatter

https://developer.apple.com/documentation/foundation/nsiso8601dateformatter

Here’s a first sketch, but it might be good to test a bit and read up the details, just in case I’ve missed anything.

(remember of course, that once we use the ObjC interface, we have to be careful to clear any C pointer references before the script ends, either simply with end tell , or by resetting any variables pointing to ObjC interface values to missing value

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions


-- https://developer.apple.com/documentation/foundation/nsiso8601dateformatter

-- dateFromTbxString :: String -> Date
on dateFromTbxString(isoDateString)
    if "never" ≠ isoDateString then
        set ca to current application
        tell ca's NSISO8601DateFormatter's alloc's init()
            set its formatOptions to (ca's NSISO8601DateFormatWithInternetDateTime as integer)
            set dteParsed to (its dateFromString:(isoDateString)) as date
        end tell
        return dteParsed
    else
        return missing value
    end if
end dateFromTbxString


-- TEST -----------------------------------------------------------
-- Assuming a selected note with a date value other than 'never' in the StartDate attribute
on run
    tell application "Tinderbox 8"
        tell selected note of front document to set strDate to value of attribute "StartDate"
    end tell
    
    return dateFromTbxString(strDate)
end run