style: 조사매물 날짜데이터 표시형식 수정, util에 날짜포맷함수 추가
This commit is contained in:
parent
367a7409ac
commit
f94e4e047c
@ -2,6 +2,7 @@
|
||||
|
||||
import { SurveyBasicInfo } from '@/types/Survey'
|
||||
import { useSurvey } from '@/hooks/useSurvey'
|
||||
import { formatDateTime } from '@/utils/common-utils'
|
||||
|
||||
export default function DataTable({ surveyDetail }: { surveyDetail: SurveyBasicInfo }) {
|
||||
/** 제출 상태 처리 */
|
||||
@ -36,18 +37,18 @@ export default function DataTable({ surveyDetail }: { surveyDetail: SurveyBasicI
|
||||
</tr>
|
||||
<tr>
|
||||
<th>登録日</th>
|
||||
<td>{surveyDetail?.regDt ? new Date(surveyDetail.regDt).toLocaleString() : ''}</td>
|
||||
<td>{formatDateTime(surveyDetail?.regDt)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>更新日時</th>
|
||||
<td>{surveyDetail?.uptDt ? new Date(surveyDetail.uptDt).toLocaleString() : ''}</td>
|
||||
<td>{formatDateTime(surveyDetail?.uptDt)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>提出可否</th>
|
||||
<td>
|
||||
{surveyDetail?.submissionStatus && surveyDetail?.submissionDate ? (
|
||||
<>
|
||||
<div>{new Date(surveyDetail.submissionDate).toLocaleString()}</div>
|
||||
<div>{formatDateTime(surveyDetail.submissionDate)}</div>
|
||||
{submitStatus()}
|
||||
</>
|
||||
) : (
|
||||
|
||||
@ -8,6 +8,7 @@ import SearchForm from './SearchForm'
|
||||
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
||||
import { useSessionStore } from '@/store/session'
|
||||
import type { SurveyBasicInfo } from '@/types/Survey'
|
||||
import { formatDateTime } from '@/utils/common-utils'
|
||||
|
||||
export default function ListTable() {
|
||||
const router = useRouter()
|
||||
@ -74,7 +75,7 @@ export default function ListTable() {
|
||||
<div className="sale-item-customer">{survey.customerName === null ? '-' : survey.customerName}</div>
|
||||
<div className="sale-item-update-bx">
|
||||
<div className="sale-item-name">{survey.representative}</div>
|
||||
<div className="sale-item-update">{new Date(survey.uptDt).toLocaleString()}</div>
|
||||
<div className="sale-item-update">{formatDateTime(survey.uptDt)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@ -233,3 +233,24 @@ export const convertToCamelCase = (obj) => {
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* 날짜 형식 변환
|
||||
* @param {Date | string} date 날짜 데이터
|
||||
* @returns {string} 포맷팅된 날짜 문자열 (YYYY.MM.DD HH:MM:SS)
|
||||
*/
|
||||
export const formatDateTime = (date) => {
|
||||
if (date === '' || date === null || date === undefined) return ''
|
||||
|
||||
return new Date(date)
|
||||
.toLocaleString(undefined, {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hour12: false,
|
||||
})
|
||||
.replace(/\//g, '.')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user