@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 +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.js
CHANGED
|
@@ -15851,18 +15851,20 @@ function formatCountdown(ms) {
|
|
|
15851
15851
|
}
|
|
15852
15852
|
|
|
15853
15853
|
/**
|
|
15854
|
-
* Format a timestamp as
|
|
15854
|
+
* Format a timestamp as an absolute time string.
|
|
15855
15855
|
* @param {number|string} timestamp - epoch ms or ISO string
|
|
15856
|
-
* @returns {string} e.g. "
|
|
15856
|
+
* @returns {string} e.g. "1:05:30 PM" for today, or full date+time for older
|
|
15857
15857
|
*/
|
|
15858
15858
|
function formatRelativeTime(timestamp) {
|
|
15859
15859
|
if (!timestamp) return null;
|
|
15860
15860
|
var ts = typeof timestamp === "string" ? new Date(timestamp).getTime() : timestamp;
|
|
15861
|
-
var
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
if (
|
|
15865
|
-
|
|
15861
|
+
var date = new Date(ts);
|
|
15862
|
+
var now = new Date();
|
|
15863
|
+
var isToday = date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate();
|
|
15864
|
+
if (isToday) {
|
|
15865
|
+
return date.toLocaleTimeString();
|
|
15866
|
+
}
|
|
15867
|
+
return date.toLocaleString();
|
|
15866
15868
|
}
|
|
15867
15869
|
|
|
15868
15870
|
/**
|