MCPcopy
hub / github.com/remotely-save/remotely-save / unixTimeToStr

Function unixTimeToStr

src/misc.ts:344–355  ·  view source on GitHub ↗
(x: number | undefined | null, hasMs = false)

Source from the content-addressed store, hash-verified

342};
343
344export const unixTimeToStr = (x: number | undefined | null, hasMs = false) => {
345 if (x === undefined || x === null || Number.isNaN(x)) {
346 return undefined;
347 }
348 if (hasMs) {
349 // 1716712162574 => '2024-05-26T16:29:22.574+08:00'
350 return window.moment(x).toISOString(true);
351 } else {
352 // 1716712162574 => '2024-05-26T16:29:22+08:00'
353 return window.moment(x).format() as string;
354 }
355};
356
357/**
358 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#examples

Callers 10

statMethod · 0.90
toStringMethod · 0.90
mkdirMethod · 0.90
writeFileMethod · 0.90
mkdirMethod · 0.90
writeFileMethod · 0.90
writeFileMethod · 0.90
getSyncPlanInplaceFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected