MCPcopy Create free account
hub / github.com/Bitbox-Connect/Bitbox / formatDate

Function formatDate

client/src/component/CommunityCard.jsx:24–34  ·  view source on GitHub ↗
(dateString)

Source from the content-addressed store, hash-verified

22
23 // Function to format date
24 const formatDate = (dateString) => {
25 const date = new Date(dateString);
26 const year = date.getFullYear().toString().slice(-2); // Get last 2 digits of the year
27 const month = ('0' + (date.getMonth() + 1)).slice(-2); // Add leading zero for single-digit months
28 const day = ('0' + date.getDate()).slice(-2); // Add leading zero for single-digit days
29 const hours = ('0' + date.getHours()).slice(-2); // Add leading zero for single-digit hours
30 const minutes = ('0' + date.getMinutes()).slice(-2); // Add leading zero for single-digit minutes
31
32 // Format the date and time
33 return `${day}/${month}/${year} | ${hours}:${minutes}`;
34 };
35
36 // Max Length for title and description
37 const maxTitleLength = 30;

Callers 1

CommunityCardFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected