15 lines
452 B
JavaScript
15 lines
452 B
JavaScript
// 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 };
|