diff --git a/apps/fo/app/pages/(map-layout)/map/page.tsx b/apps/fo/app/pages/(map-layout)/map/page.tsx index d27dbe834..f41439b92 100644 --- a/apps/fo/app/pages/(map-layout)/map/page.tsx +++ b/apps/fo/app/pages/(map-layout)/map/page.tsx @@ -73,6 +73,17 @@ const Map = () => { fetchData(); }, []); + function formatWithCommas(value: any) { + if (value === null || value === undefined) return value; + const num = Number(value); + return isNaN(num) ? value : num.toLocaleString(); + } + + function formatDateString(dateStr: string) { + if (typeof dateStr !== "string" || dateStr.length !== 8) return dateStr; + return `${dateStr.slice(0, 4)}-${dateStr.slice(4, 6)}-${dateStr.slice(6)}`; + } + // ===== 오버레이 콘텐츠 빌더 ===== const buildOverlayContent = (layerType: string, feature: FeatureData) => { const props: Record = {}; @@ -84,9 +95,9 @@ const Map = () => { if (layerType === "tb_il_swage_prcs_fclt") { // 하수처리시설 props["하수처리시설명"] = mayGet("swtrmt_fclt_nm"); - props["시설용량(m³/d)"] = mayGet("fclt_cpct"); + props["시설용량(m³/d)"] = formatWithCommas(mayGet("fclt_cpct")); props["주소"] = mayGet("rdnm_addr"); - props["가동개시일"] = mayGet("oprtng_strt_ymd"); + props["가동개시일"] = formatDateString(mayGet("oprtng_strt_ymd")); props["공법"] = mayGet("rprs_msrc_cn"); } else if (layerType === "tb_ms_swage_prcs_zone") { // 처리구역(존) @@ -116,14 +127,14 @@ const Map = () => {
${title}
${Object.entries(props) - .map( - ([k, v]) => ` + .map( + ([k, v]) => ` ` - ) - .join("")} + ) + .join("")}
${k} ${safe(v)}
`; return el;