Find the duration between two specific moments in time.
Real-Time Calculation: The difference between the two dates updates automatically as you change either the start or end date and time inputs.
Clear and Readable Output: The calculated duration is displayed in a human-readable format (e.g., "1 day, 2 hours, 3 minutes, 4 seconds"), making it easy to understand the time difference at a glance.
Error Handling: The component includes a Snackbar
to display clear, user-friendly error messages for invalid date inputs or other issues, ensuring a smooth user experience.
Loading State Indicator: A CircularProgress
component is shown on the "Calculate Difference" button while the calculation is in progress, preventing double-clicks and indicating that the app is working.
Absolute Difference: The calculation uses Math.abs()
to ensure the difference is always a positive value, regardless of which date is earlier.