Fixed date check

Previously this check always returned false, because `typeof` of date objects returns `'object'`. Therefore it always took current date as an argument.