Validate date to now()

I have date field where user selects a date and I have a function to set a variable, visningvalgt , if date is < today, = today or > today:

if (FodselsTerminsDato.dato < now()) {visningvalgt = 1};
if (FodselsTerminsDato.dato == now()) {visningvalgt = 2};
if (FodselsTerminsDato.dato > now()) {visningvalgt = 3};

But if date < now() the variable visningvalgt is set to 2. Anybody who knows why.

It can be fixed by changing the validation to:

if (FodselsTerminsDato.dato < now()) {visningvalgt = 1};
if (FodselsTerminsDato.dato >= now()) {visningvalgt = 2};
if (FodselsTerminsDato.dato > now()) {visningvalgt = 3};