Getting an Error and no clue why with Time widget

I have a time progression widget i have been using and it works great for the most part but for some reason when I get to the afternoon I get an error. Ill pots the widgets for the time below as well as the error Im getting.

/*Time progression widget*/
<<widget "addTime">>
	<<if $args[0]>>
    <<set $args to $args[0]>>
    	<<set $time += $args>>

<<widget "clock">>
	<<if $dayNum is 1>>
    	<<set $day to "Sunday">>
		<<elseif $dayNum is 2>>
        	<<set $day to "Monday">>
        <<elseif $dayNum is 3>>
        	<<set $day to "Tuesday">>
        <<elseif $dayNum is 4>>
        	<<set $day to "Wednesday">>
        <<elseif $dayNum is 5>>
        	<<set $day to "Thursday">>
        <<elseif $dayNum is 6>>
        	<<set $day to "Friday">>
        <<elseif $dayNum is 7>>
        	<<set $day to "Saturday">>
    	<<if $time is 1>>
        	<<set $timeOfDay to "Morning">>
        <<elseif $time is 2>>
        	<<set $timeOfDay to "Noon">>
        <<elseif $time is 3>>
        	<<set $timeOfDay to "Afternoon">>
        <<elseif $time if 4>>
        	<<set $timeOfDay to "Evening">>
        <<elseif $time is 5>>
        	<<set $timeOfDay to "Night">>

And this is the error

Error: <<clock>>: error within widget code (Error: <<if>>: bad conditional expression in <<elseif>> clause (#3): Unexpected token 'if')

I am seeing nothing wrong with the elseif statement at all unless my eyes are really messed up.

shoud be is.

 <<elseif $time is 4>>

Ugggg I guess its time to get my glasses checked. no clue how I missed that!! Thank you!