socket-function 0.29.0 → 0.31.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -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) {
@@ -302,7 +302,7 @@ export async function startSocketServer(
302
302
  }
303
303
 
304
304
  let nodeId = getNodeId(getCommonName(config.cert), port);
305
- console.log(green(`Started Listening on ${nodeId} after ${formatTime(process.uptime() * 1000)}`));
305
+ console.log(green(`Started Listening on ${nodeId} (${host}) after ${formatTime(process.uptime() * 1000)}`));
306
306
 
307
307
  return nodeId;
308
308
  }