In javascript/jquery most of the developer uses From & To date comparison which is string, without converting into date format. The simplest way to compare from date is greater then to date is.
Date.parse(fromDate) > Date.parse(toDate)
Always parse from and to date before comparison to get accurate results