socket-function 0.29.0 → 0.30.0
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/package.json +1 -1
- package/src/formatting/format.ts +11 -0
package/package.json
CHANGED
package/src/formatting/format.ts
CHANGED
|
@@ -247,6 +247,17 @@ export function formatNiceDateTime(time: number) {
|
|
|
247
247
|
return date.getFullYear() + " " + date.toLocaleString("default", { month: "long" }) + " " + date.getDate() + ", " + days[date.getDay()] + ", " + strTime;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/** 2024 January 1, Monday, 12:53:02pm (4 months ago) */
|
|
251
|
+
export function formatVeryNiceDateTime(time: number) {
|
|
252
|
+
if (!time) {
|
|
253
|
+
return "";
|
|
254
|
+
}
|
|
255
|
+
if (typeof time !== "number") {
|
|
256
|
+
return String(time);
|
|
257
|
+
}
|
|
258
|
+
return `${formatNiceDateTime(time)} (${formatTime(Date.now() - time)})`;
|
|
259
|
+
}
|
|
260
|
+
|
|
250
261
|
/** YYYY/MM/DD */
|
|
251
262
|
export function formatDate(time: number) {
|
|
252
263
|
function p(s: number) {
|