Update. Never mind, used new Date(...) to compare. Now next challenge to get rid of time portion in both dates.
http://stackoverflow.com/questions/2698725/comparing-date-part-only-without-comparing-time-in-javascript - so setHours helped to get date only portion.
Hi everybody,
I seem to be having problems with dates. One date comes from SQL Server table and another is defined in my code as
date: new Date().
When I pass it to my method, I see 'Invalid Date' in the object value. Here is what I see in console when I output values from both (see attached).
The date is greater than the date from the table but the condition evaluates to false.
Also, I want to compare just dates, not time portion as well.
What should I adjust in my code?
case 4: // Before Date
if ($scope.invoicesToApplyFees[i].lastTransactionDate< date)
$scope.invoicesToApplyFees[i].payit = apply;
break;
case 5: // On or After Date
if ($scope.invoicesToApplyFees[i].lastTransactionDate>= date)
$scope.invoicesToApplyFees[i].payit = apply;
break;
If it's not broken, fix it until it is.
My Blog