Localize home notice date format based on language
- Add formatDate function to display dates based on current language - Korean (ko): YY년 MM월 DD일 format (e.g., 25년 10월 31일) - English (en): YYYY.MM.DD format (e.g., 2025.10.31) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,16 @@ export const HomeNoticeItem = ({
|
|||||||
setDetailData,
|
setDetailData,
|
||||||
}: NoticeItemProps) => {
|
}: NoticeItemProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
|
|
||||||
|
const formatDate = (date?: string) => {
|
||||||
|
if (!date) return '';
|
||||||
|
const currentLang = i18n.language;
|
||||||
|
if (currentLang === 'ko') {
|
||||||
|
return moment(date).format('YY년 MM월 DD일');
|
||||||
|
}
|
||||||
|
return moment(date).format('YYYY.MM.DD');
|
||||||
|
};
|
||||||
|
|
||||||
const onClickToDetail = () => {
|
const onClickToDetail = () => {
|
||||||
if(setDetailData){
|
if(setDetailData){
|
||||||
@@ -29,7 +38,7 @@ export const HomeNoticeItem = ({
|
|||||||
>
|
>
|
||||||
<div className="notice-content">
|
<div className="notice-content">
|
||||||
<div className="notice-title">{ noticeItem.title }</div>
|
<div className="notice-title">{ noticeItem.title }</div>
|
||||||
<div className="notice-meta">{ t(`support.notice.categories.${noticeItem.informCl}`) }<span>{ noticeItem.regDt? moment(noticeItem.regDt).format('YYYY.MM.DD'): '' }</span></div>
|
<div className="notice-meta">{ t(`support.notice.categories.${noticeItem.informCl}`) }<span>{ formatDate(noticeItem.regDt) }</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div className="notice-arrow">
|
<div className="notice-arrow">
|
||||||
<img
|
<img
|
||||||
|
|||||||
Reference in New Issue
Block a user