fix(date): UTC 기반 날짜를 로컬 타임존으로 변경
- 공통 날짜 유틸리티 함수 추가 (src/utils/date.ts)
- getLocalDateString(): 로컬 타임존 YYYY-MM-DD 포맷
- getTodayString(): 오늘 날짜 반환
- getDateAfterDays(): N일 후 날짜 계산
- formatDateForInput(): API 응답 → input 포맷 변환
- toISOString().split('T')[0] 패턴을 공통 함수로 교체
- 견적: QuoteRegistration, QuoteRegistrationV2, types
- 건설: contract, site-briefings, estimates, bidding types
- 건설: IssueDetailForm, ConstructionDetailClient, ProjectEndDialog
- 자재: InspectionCreate, ReceivingReceiptContent, StockStatus/mockData
- 품질: InspectionManagement/mockData
- 기타: PricingFormClient, ShipmentCreate, PurchaseOrderDocument
- 기타: MainDashboard, attendance/actions, dev/generators
문제: toISOString()은 UTC 기준이라 한국(UTC+9)에서 오전 9시 이전에
전날 날짜가 표시되는 버그 발생
해결: 로컬 타임존 기반 날짜 포맷 함수로 통일
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
* 샘플 데이터 생성 공통 유틸리티
|
||||
*/
|
||||
|
||||
import { getLocalDateString } from '@/utils/date';
|
||||
|
||||
// 랜덤 선택
|
||||
export function randomPick<T>(arr: T[]): T {
|
||||
return arr[Math.floor(Math.random() * arr.length)];
|
||||
@@ -30,12 +32,12 @@ export function randomPhone(): string {
|
||||
export function dateAfterDays(days: number): string {
|
||||
const date = new Date();
|
||||
date.setDate(date.getDate() + days);
|
||||
return date.toISOString().split('T')[0];
|
||||
return getLocalDateString(date);
|
||||
}
|
||||
|
||||
// 오늘 날짜
|
||||
export function today(): string {
|
||||
return new Date().toISOString().split('T')[0];
|
||||
return getLocalDateString(new Date());
|
||||
}
|
||||
|
||||
// 랜덤 층수
|
||||
|
||||
Reference in New Issue
Block a user