fix created at
This commit is contained in:
parent
4f1a7cc434
commit
8c67784d62
2 changed files with 13 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ export interface ISurvey {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
createdBy: number;
|
createdBy: number;
|
||||||
|
createdAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INewSurvey{
|
export interface INewSurvey{
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,17 @@ export const MySurveyList = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [surveys, setSurveys] = useState<MySurveyItem[]>([]);
|
const [surveys, setSurveys] = useState<MySurveyItem[]>([]);
|
||||||
|
|
||||||
|
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(() => {
|
useEffect(() => {
|
||||||
const fetchSurvey = async () => {
|
const fetchSurvey = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -63,7 +74,7 @@ export const MySurveyList = () => {
|
||||||
<h1 className={styles.title}>{survey.title}</h1>
|
<h1 className={styles.title}>{survey.title}</h1>
|
||||||
<h2 className={styles.description}>{survey.description}</h2>
|
<h2 className={styles.description}>{survey.description}</h2>
|
||||||
</div>
|
</div>
|
||||||
<span className={styles.date}>Дата создания: {survey.createdBy}</span>
|
<span className={styles.date}>Дата создания: {formatDate(survey.createdAt)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={`${styles.status} ${
|
<div className={`${styles.status} ${
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue