diff --git a/SurveyFrontend/src/api/SurveyApi.ts b/SurveyFrontend/src/api/SurveyApi.ts index d182347..4c20c73 100644 --- a/SurveyFrontend/src/api/SurveyApi.ts +++ b/SurveyFrontend/src/api/SurveyApi.ts @@ -5,6 +5,7 @@ export interface ISurvey { title: string; description: string; createdBy: number; + createdAt: string; } export interface INewSurvey{ diff --git a/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx b/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx index 6fa3d1a..8083640 100644 --- a/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx +++ b/SurveyFrontend/src/components/MySurveyList/MySurveyList.tsx @@ -13,6 +13,17 @@ export const MySurveyList = () => { const navigate = useNavigate(); const [surveys, setSurveys] = useState([]); + const formatDate = (dateString: string) => { + const date = new Date(dateString); + const day = String(date.getDate()).padStart(2, '0'); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const year = date.getFullYear(); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + + return `${day}/${month}/${year} ${hours}:${minutes}`; + }; + useEffect(() => { const fetchSurvey = async () => { try { @@ -63,7 +74,7 @@ export const MySurveyList = () => {

{survey.title}

{survey.description}

- Дата создания: {survey.createdBy} + Дата создания: {formatDate(survey.createdAt)}