Use router.navigate instead of location.href.
Check variable `date` using ===.