Use public toDate() method rather than private _d property or passing Moment object to Date object
Fix usage of undefined property to format date
Remove unnecessary click event listeners
Use separate variables for strings and date objects
This makes it easier to reason about the code, and also improves performance since new Moment objects do not have to be constructed each time a date is checked.
toDate()
method rather than private_d
property or passingMoment
object toDate
objectMoment
objects do not have to be constructed each time a date is checked.