refactor: replace custom date utilities with date-fns and date-fns-tz
Description:
Refactored date and time utility functions in src/lib/utils.ts by replacing custom implementations with date-fns and date-fns-tz. This removes manual date/time calculations and improves reliability and maintainability.
- Replaced
formatModernTimewithformatDistanceToNow - Refactored
formatDurationusingintervalToDurationandformatDurationfrom date-fns - Replaced
getISTDatewithtoZonedTimeusing'Asia/Kolkata' - Removed hardcoded timezone offsets and manual logic
- Preserved existing function signatures to avoid breaking changes
- Restored missing utility functions (
formatMediaDuration,formatRelativeTime,formatISTDateTime) to maintain compatibility across the app
Type of Change:
-
Bug Fix -
Feature Development -
Documentation
Testing:
-
Tested on desktop -
Tested on mobile -
Tested in different browsers
Screenshots (if applicable):
No UI changes. Refactor is internal and does not affect visual output.
Video Demo
N/A (No UI/feature changes)
Checklist:
-
Code follows project style guidelines -
Self-review completed -
No console errors -
TypeScript types are correct