How to find difference between two dates from DatePicker Widgets?

This question was posted by one of our users on Discord. We’ve made a sample app to demonstrate how we can perform differences on two dates from DatePicker widgets using the moment library.

This thread demonstrates how to find the difference between two dates using two Date Picker widgets on Appsmith.

Live Sample App: Appsmith

How to Build This App?

  1. Add two Date Picker widgets.

  2. Choose the default dates or add dates dynamically to perform difference operation.

  3. Drag and drop a text widget, or widget of your preference to display the difference.

  4. Use moment(DatePicker2.selectedDate).diff(DatePicker1.selectedDate, "days") to perform the operation.