small date comparison bug fix in js part of code