Does delete or backspacing a Date field to blank create the null value?

Does delete or backspacing a Date field to blank create the null value?

The on Input script below is designed to set the penalty field value to 30 if the day of the month is after the 15th, and to 0 if the date is not after the 15th OR if the date is blank (I'm assuming a blank date is null).  The problem I am having is that when I delete or highlight and backspace the date to a blank (and then click outside the field to trigger the script) the penalty field is not reverting to 0. Can anyone hazard a guess as to what is wrong with my script?

Thanks to Gaev for sending solution via private mail: Change order to have null at top and getDay in middle.

  1. if (input.JanDate.getDay()  >  15)
  2. {
  3.     input.JanPenalty = 30.0;
  4. }
  5. else if ((input.JanPenaltySHOULD HAVE BEENJanDate  Duh! == null))
  6. {
  7.     input.JanPenalty = 0.0;
  8. }
  9. else
  10. {
  11.     input.JanPenalty = 0.0;
  12. }