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

Function formatDate

client/src/component/MyProject.jsx:107–117  ·  view source on GitHub ↗
(dateString)

Source from the content-addressed store, hash-verified

105
106 // Function to format date
107 const formatDate = (dateString) => {
108 const date = new Date(dateString);
109 const year = date.getFullYear().toString().slice(-2); // Get last 2 digits of the year
110 const month = ('0' + (date.getMonth() + 1)).slice(-2); // Add leading zero for single-digit months
111 const day = ('0' + date.getDate()).slice(-2); // Add leading zero for single-digit days
112 const hours = ('0' + date.getHours()).slice(-2); // Add leading zero for single-digit hours
113 const minutes = ('0' + date.getMinutes()).slice(-2); // Add leading zero for single-digit minutes
114
115 // Format the date and time
116 return `${day}/${month}/${year} | ${hours}:${minutes}`;
117 };
118
119 return (
120 <div>

Callers 1

MyProfileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected