Fix TypeError message: moment(...) is null

Avoiding TypeError message when the input field is empty and some key (like Backspace) is pressed.