@trops/dash-core 0.1.152 → 0.1.153
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 +9 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -15833,18 +15833,20 @@ function formatCountdown(ms) {
|
|
|
15833
15833
|
}
|
|
15834
15834
|
|
|
15835
15835
|
/**
|
|
15836
|
-
* Format a timestamp as
|
|
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. "
|
|
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
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
if (
|
|
15847
|
-
|
|
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
|
/**
|