@trops/dash-core 0.1.152 → 0.1.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -15833,18 +15833,20 @@ function formatCountdown(ms) {
15833
15833
  }
15834
15834
 
15835
15835
  /**
15836
- * Format a timestamp as relative time ago.
15836
+ * Format a timestamp as an absolute time string.
15837
15837
  * @param {number|string} timestamp - epoch ms or ISO string
15838
- * @returns {string} e.g. "2m ago", "1h ago", "just now"
15838
+ * @returns {string} e.g. "1:05:30 PM" for today, or full date+time for older
15839
15839
  */
15840
15840
  function formatRelativeTime(timestamp) {
15841
15841
  if (!timestamp) return null;
15842
15842
  var ts = typeof timestamp === "string" ? new Date(timestamp).getTime() : timestamp;
15843
- var diff = Date.now() - ts;
15844
- if (diff < 60000) return "just now";
15845
- if (diff < 3600000) return "".concat(Math.floor(diff / 60000), "m ago");
15846
- if (diff < 86400000) return "".concat(Math.floor(diff / 3600000), "h ago");
15847
- return "".concat(Math.floor(diff / 86400000), "d ago");
15843
+ var date = new Date(ts);
15844
+ var now = new Date();
15845
+ var isToday = date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate();
15846
+ if (isToday) {
15847
+ return date.toLocaleTimeString();
15848
+ }
15849
+ return date.toLocaleString();
15848
15850
  }
15849
15851
 
15850
15852
  /**