Skip to content

Commit 0a360d3

Browse files
committed
Bug: Fix to show date
1 parent 09d7c34 commit 0a360d3

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

β€Žclient-next/src/components/UI/ContentsList/Content/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { IContent } from 'types/content.interface';
22
import { useNavigate } from 'react-router-dom';
3+
import { DateUtil } from '@utils/index';
34
import * as S from './style';
45
import TagList from './TagList';
56

@@ -21,7 +22,9 @@ const Content = ({ className, content }: IContentsComponent) => {
2122
<div className="category">
2223
{content.mainCategory.title}/{content.subCategory.title}
2324
</div>
24-
<div className="date">{content.date}</div>
25+
<div className="date">
26+
{DateUtil.getYMD(new Date(content.updateAt))}
27+
</div>
2528
</div>
2629
<TagList tagList={content.tags} />
2730
</S.SubInfo>

β€Žclient-next/src/components/UI/Post/Titlebox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getYMD } from '@lib/date';
1+
import { getYMD } from '@utils/date';
22
import * as S from './style';
33

44
interface TitleBox {

β€Žclient-next/src/fixture/ContentsList/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ const testObj = {
88
export const testContentList: IContent[] = [
99
{
1010
title: 'κΈ€ 1',
11-
date: '첫번째 κΈ€μ—λŒ€ν•œ λ‚΄μš©μž…λ‹ˆλ‹€.',
11+
updateAt: new Date('2020-10-20'),
1212
slug: '/1',
1313
...testObj,
1414
},
1515
{
1616
title: 'κΈ€ 2',
17-
date: 'λ‘λ²ˆμ§Έ κΈ€μ—λŒ€ν•œ λ‚΄μš©μž…λ‹ˆλ‹€.',
17+
updateAt: new Date('2020-10-20'),
1818
slug: '/1',
1919
...testObj,
2020
},
2121
{
2222
title: 'κΈ€ 3',
23-
date: 'μ„Έλ²ˆμ§Έ κΈ€μ—λŒ€ν•œ λ‚΄μš©μž…λ‹ˆλ‹€.',
23+
updateAt: new Date('2020-10-20'),
2424
slug: '/1',
2525
...testObj,
2626
},
2727
{
2828
title: 'κΈ€ 4',
29-
date: 'λ„€λ²ˆμ§Έ κΈ€μ—λŒ€ν•œ λ‚΄μš©μž…λ‹ˆλ‹€.',
29+
updateAt: new Date('2020-10-20'),
3030
slug: '/1',
3131
...testObj,
3232
},
3333
{
3434
title: 'κΈ€ 5',
35-
date: 'λ‹€μ„―λ²ˆμ§Έ κΈ€μ—λŒ€ν•œ λ‚΄μš©μž…λ‹ˆλ‹€.',
35+
updateAt: new Date('2020-10-20'),
3636
slug: '/1',
3737
...testObj,
3838
},
3939
];
4040

4141
export const testContent: any = {
4242
title: '제λͺ©μž…λ‹ˆλ‹€.',
43-
date: '2020-20-20',
43+
date: '2020-10-20',
4444
};

β€Žclient-next/src/types/content.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ITag } from './tag.interface';
33

44
export interface IContent {
55
title: string;
6-
date: string;
6+
updateAt: Date;
77
slug: string;
88
mainCategory: IMainCategory;
99
subCategory: ISubCategory;
File renamed without changes.

β€Žclient-next/src/utils/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as DU from './date';
2+
3+
export const DateUtil = DU;
4+
export default {};

0 commit comments

Comments
Β (0)