Create shared utility module to eliminate function duplication

- Create public/utils.js with shared frontend utility functions
- Extract parseUTCDate, getTimeAgo, getTimeRemaining, getRemainingClass to utils.js
- Remove duplicate functions from admin.js, app-mapbox.js, app-google.js, and app.js
- Add utils.js script import to index.html and admin.html
- Add comprehensive JSDoc documentation for all utility functions
- Ensure consistent UTC timestamp parsing across all frontend scripts

This addresses Copilot AI feedback about function duplication across multiple frontend scripts.
Now all timestamp and time calculation logic is centralized in one maintainable module.

Benefits:
- Single source of truth for time-related utilities
- Easier maintenance and updates
- Consistent behavior across all frontend components
- Better code organization and documentation
- Reduced bundle size through deduplication
This commit is contained in:
Deco Vander 2025-07-04 13:22:17 -04:00
parent c0dc1f3c6d
commit a063d5a2c9
7 changed files with 103 additions and 120 deletions

View file

@ -558,6 +558,7 @@
</div>
</div>
<script src="utils.js"></script>
<script src="admin.js"></script>
</body>
</html>