Files
formbricks/packages/lib/utils/datetime.ts
Anshuman Pandey 53ef8771f3 feat: Make formbricks-js ready for public websites (#1470)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
Co-authored-by: Johannes <johannes@formbricks.com>
2023-11-12 09:12:58 +00:00

8 lines
289 B
TypeScript

// utility functions for date and time
// Helper function to calculate difference in days between two dates
export const diffInDays = (date1: Date, date2: Date) => {
const diffTime = Math.abs(date2.getTime() - date1.getTime());
return Math.floor(diffTime / (1000 * 60 * 60 * 24));
};