Set creation date from file names like "Apr 27, 2021"

Thanks for the tip! Now I have:

tell application id "DNtp"
	set sel to (selection as list)
	my performSmartRule(sel)
end tell

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with theRecord in theRecords
			set theName to the name of theRecord
			set creation date of theRecord to my getDate(theName)
		end repeat
	end tell
end performSmartRule

on getDate(theName)
	set sedString to quoted form of "s/^.* \\([A-Z][a-z]\\{2,3\\} [0-9]\\{1,2\\}, [0-9]\\{4\\}\\)/\\1/"
	set theString to do shell script "echo " & quoted form of theName & "| sed " & sedString
	set theDate to date theString
	return theDate
end getDate

And this works perfectly when I select records and run from the script editor. However when I try to run this as a smart rule, I get invalid argument date.