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

Function formatDate

client/src/component/MyProjectCard.jsx:54–65  ·  view source on GitHub ↗
(dateString)

Source from the content-addressed store, hash-verified

52
53 // Function to format date
54 const formatDate = (dateString) => {
55 const date = new Date(dateString);
56
57 const year = date.getFullYear().toString().slice(-2); // Get last 2 digits of the year
58 const month = ('0' + (date.getMonth() + 1)).slice(-2); // Add leading zero for single-digit months
59 const day = ('0' + date.getDate()).slice(-2); // Add leading zero for single-digit days
60 const hours = ('0' + date.getHours()).slice(-2); // Add leading zero for single-digit hours
61 const minutes = ('0' + date.getMinutes()).slice(-2); // Add leading zero for single-digit minutes
62
63 // Format the date and time
64 return `${day}/${month}/${year} | ${hours}:${minutes}`;
65 };
66
67 // Max Length for title and description
68 const maxTitleLength = 30;

Callers 1

MyProfileCardFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected