Issue when trying to convert the month number to word form in AppleScript (but only when that month contains 31 days)
Solution
Use the following stringForShellScript:
"date -v" &amp; onlyTheMonth &amp; "m -v" &amp; onlyTheDay &amp; "d -v" &amp; onlyTheYear &amp; "y +%"

Explanation
Interestingly enough, you need to shift the month before the day, but only if you’re going to shift the day to the 31st of the month.

-v30d -v2m will produce February just fine, but the 31st of the month causes date to bug out (up to the version that ships with macOS Sierra 10.12.4).

You can shift the year at any point in the command without any issue.

Side Notes


set onlyTheDay to (onlyTheDay as integer) as string will remove any leading 0s from a number string. It’s less error-prone than parsing a string. Performance is inconsequential in this case.
You have a leading space before date. Not that it matters—just pointing it out.