separated utils from room template
This commit is contained in:
15
static/js/utils.js
Normal file
15
static/js/utils.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Utility functions for DocuPulse
|
||||
|
||||
/**
|
||||
* Formats a Unix timestamp into a localized date and time string
|
||||
* @param {number} ts - Unix timestamp in seconds
|
||||
* @returns {string} Formatted date and time string
|
||||
*/
|
||||
function formatDate(ts) {
|
||||
if (!ts) return '';
|
||||
const d = new Date(ts * 1000);
|
||||
return d.toLocaleDateString() + ' ' + d.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
|
||||
}
|
||||
|
||||
// Export the functions
|
||||
export { formatDate };
|
||||
Reference in New Issue
Block a user