mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
formatting date in property information
This commit is contained in:
parent
c572fe8a21
commit
adc93a6012
1 changed files with 16 additions and 1 deletions
|
|
@ -8,6 +8,21 @@ import {
|
|||
UserGroupIcon,
|
||||
} from "@heroicons/react/24/solid";
|
||||
|
||||
function formatDateTime(dateTimeString: string): string {
|
||||
// Create a new Date object
|
||||
const dateTime = new Date(dateTimeString);
|
||||
|
||||
// Get the various parts of the date
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
};
|
||||
return dateTime.toLocaleDateString("en-GB", options);
|
||||
}
|
||||
|
||||
function EpcCard({ epcRating }: { epcRating: string }) {
|
||||
return (
|
||||
<div className="flex flex-col items-center p-8 shadow rounded-md max-w-xl mx-auto justify-start text-gray-100 bg-brandblue">
|
||||
|
|
@ -44,7 +59,7 @@ export default function BuildingPassportHome() {
|
|||
<div className="flex items-center space-x-2 mb-2">
|
||||
<CalendarIcon className="h-5 w-5 text-gray-400" />
|
||||
<div className="text-gray-500">Building Passport Created At:</div>
|
||||
<div>{propertyMeta.createdAt}</div>
|
||||
<div>{formatDateTime(propertyMeta.createdAt)}</div>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2 mb-2">
|
||||
<HomeIcon className="h-5 w-5 text-gray-400" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue