How can I check if leap year in AppleScript?
An alternative approach would be to ask for the month of February 29. In a non-leap year, it should return 'March'.

month of date "2/29/2018"


This shows the approach but as pointed out in the comments, the above is automatically compiled into a long date.

To address this and to also provide flexibility as to the year, this will return ‘February’ in a leap year, and ‘March’ otherwise.

month of date ("2/29/" &amp; (year of (current date) as text))


-> March

Incorporating the question code, it could look like this. I ordered it this way so as to bail out of the elses earlier for more months.

set g31 to {1, 3, 5, 7, 8, 10, 12}
set g30 to {4, 6, 9, 11}

set MM to month of (current date) as integer

if g31 contains MM then
    set Prefix to "Gregorian_31"
else
    if g30 contains MM then
        set Prefix to "Gregorian_30"
    else
        if month of date ("2/29/" &amp; (year of (current date))) as integer = 2 then
            set Prefix to "Gregorian_Leap"
        else
            set Prefix to "Gregorian_28"
        end if
    end if
end if