MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / formatFixedDate

Function formatFixedDate

apps/OpenSign/src/utils/fileUtils.js:47–72  ·  view source on GitHub ↗
(date = new Date())

Source from the content-addressed store, hash-verified

45}
46
47function formatFixedDate(date = new Date()) {
48 const dd = String(date.getDate()).padStart(2, "0");
49 const months = [
50 "Jan",
51 "Feb",
52 "Mar",
53 "Apr",
54 "May",
55 "Jun",
56 "Jul",
57 "Aug",
58 "Sep",
59 "Oct",
60 "Nov",
61 "Dec"
62 ];
63 const mmm = months[date.getMonth()];
64 const yyyy = String(date.getFullYear());
65 let h = date.getHours();
66 const ampm = h >= 12 ? "PM" : "AM";
67 h = h % 12;
68 if (h === 0) h = 12;
69 const HH12 = String(h).padStart(2, "0");
70 const MM = String(date.getMinutes()).padStart(2, "0");
71 return `${dd}-${mmm}-${yyyy} ${HH12}:${MM} ${ampm}`;
72}
73
74/**
75 * Remove characters not allowed in file names for major OSes.

Callers 1

buildDownloadFilenameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected