Removed rudundant conditionals

This commit is contained in:
斟酌 鵬兄 2017-09-26 12:53:53 +08:00
parent c60e0a2e1c
commit 54790b3235

View File

@ -11,12 +11,12 @@ var DAY = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "S
var getOrdinalSuffix = function(day)
{
if (day < 4 || ( 20 < day && day < 24 )) {
if (day == 1 || day == 21) return "st";
if( day < 1 || 31 < day )
throw new Error( "Day is out of range 1 <= day <= 31" );
if ( day == 1 || day == 21 || day == 31 ) return "st";
else if ( day == 2 || day == 22 ) return "nd";
else if ( day == 3 || day == 23 ) return "rd";
}
else if (day == 31) return "st";
return "th";
};