How to compare two dates in javascript
Date comparison is a fundamental requirement for any application. Often when displaying data on a page, you need to display the latest record at the top and then the records that were created later. For that, the records should be compared based on their date of creation. Javascript provides different ways to compare dates using its Date object and this article will discuss them with examples. Method 1: Using relational operator comparison Two date objects can directly be compared using <, >, ==, <=, >= and != operators. Behind the scenes, their values are compared and the result is determined. Example, // create two dateRead More →