날짜포멧 수정

This commit is contained in:
Macbook
2026-05-29 02:25:03 +09:00
parent 990b3a0710
commit 03441337f2
19 changed files with 166 additions and 26 deletions
+6
View File
@@ -503,6 +503,12 @@ export class ChartManager {
this._applyDisplayTimezoneOptions();
}
/** 시간축·크로스헤어·캔들 pane 시간 라벨 포맷만 갱신 */
setChartTimeFormat(chartTimeFormat: string): void {
this.chartTimeFormat = normalizeChartTimeFormat(chartTimeFormat);
this._applyDisplayTimezoneOptions();
}
// ─── Theme ──────────────────────────────────────────────────────────────
setTheme(theme: Theme): void {
this.currentTheme = theme;
+2
View File
@@ -446,6 +446,8 @@ export interface AppSettingsDto {
displayTimezone?: string;
/** 차트 하단 시간축 포맷 (예: yyyy-MM-dd HH:mm) */
chartTimeFormat?: string;
/** 매매 시그널 알림 팝업 시간 포맷 */
tradeAlertTimeFormat?: string;
/** 추세검색 기본 설정 */
trendSearchSettings?: import('./trendSearchAppSettings').TrendSearchAppSettings | null;
/** UI 설정 통합 (편집기·팔레트·가상투자 목록·패널 크기 등) */
+11 -1
View File
@@ -13,15 +13,25 @@ export interface ChartTimeFormatPreset {
label: string;
}
/** 통상적인 차트 시간축 프리셋 */
/** 통상적인 차트 시간축 프리셋 (일반설정·차트 설정 공통) */
export const CHART_TIME_FORMAT_PRESETS: ChartTimeFormatPreset[] = [
{ id: 'yyyy-MM-dd HH:mm:ss', label: 'yyyy-MM-dd HH:mm:ss' },
{ id: 'yyyy-MM-dd HH:mm', label: 'yyyy-MM-dd HH:mm' },
{ id: 'yyyy-MM-dd', label: 'yyyy-MM-dd' },
{ id: 'yyyy/MM/dd HH:mm:ss', label: 'yyyy/MM/dd HH:mm:ss' },
{ id: 'yyyy/MM/dd HH:mm', label: 'yyyy/MM/dd HH:mm' },
{ id: 'MM-dd HH:mm:ss', label: 'MM-dd HH:mm:ss' },
{ id: 'MM-dd HH:mm', label: 'MM-dd HH:mm' },
{ id: 'MM/dd/yyyy HH:mm:ss', label: 'MM/dd/yyyy HH:mm:ss' },
{ id: 'MM/dd/yyyy HH:mm', label: 'MM/dd/yyyy HH:mm' },
{ id: 'dd/MM/yyyy HH:mm:ss', label: 'dd/MM/yyyy HH:mm:ss' },
{ id: 'dd/MM/yyyy HH:mm', label: 'dd/MM/yyyy HH:mm' },
{ id: 'dd/MM HH:mm:ss', label: 'dd/MM HH:mm:ss' },
{ id: 'dd/MM HH:mm', label: 'dd/MM HH:mm' },
{ id: 'dd-MM HH:mm:ss', label: 'dd-MM HH:mm:ss' },
{ id: 'dd-MM HH:mm', label: 'dd-MM HH:mm' },
{ id: 'dd.MM.yyyy HH:mm:ss', label: 'dd.MM.yyyy HH:mm:ss' },
{ id: 'dd.MM.yyyy HH:mm', label: 'dd.MM.yyyy HH:mm' },
{ id: 'HH:mm:ss', label: 'HH:mm:ss' },
{ id: 'HH:mm', label: 'HH:mm' },
];
@@ -0,0 +1,37 @@
/**
* 매매 시그널 알림 팝업·상세의 시간 표시 포맷 (일반설정, DB 동기화)
*/
import { useSyncExternalStore } from 'react';
import {
DEFAULT_CHART_TIME_FORMAT,
normalizeChartTimeFormat,
} from './chartTimeFormat';
export const DEFAULT_TRADE_ALERT_TIME_FORMAT = DEFAULT_CHART_TIME_FORMAT;
let _format = DEFAULT_TRADE_ALERT_TIME_FORMAT;
const _listeners = new Set<() => void>();
export function getTradeAlertTimeFormat(): string {
return _format;
}
export function setTradeAlertTimeFormat(format: string): void {
const next = normalizeChartTimeFormat(format);
if (_format === next) return;
_format = next;
_listeners.forEach(l => l());
}
export function subscribeTradeAlertTimeFormat(cb: () => void): () => void {
_listeners.add(cb);
return () => _listeners.delete(cb);
}
export function useTradeAlertTimeFormat(): string {
return useSyncExternalStore(
subscribeTradeAlertTimeFormat,
getTradeAlertTimeFormat,
() => DEFAULT_TRADE_ALERT_TIME_FORMAT,
);
}
+9 -3
View File
@@ -1,8 +1,10 @@
/**
* 매매 시그널 알림 표시용 포맷·라벨
*/
import { formatUnixWithChartPattern, splitChartTimePattern } from './chartTimeFormat';
import { getKoreanName } from './marketNameCache';
import { formatUnixDateTime, formatUnixClock, getDisplayTimezone } from './timezone';
import { getTradeAlertTimeFormat } from './tradeAlertTimeFormat';
import { getDisplayTimezone } from './timezone';
export interface TradeSignalDisplaySource {
market: string;
@@ -31,8 +33,12 @@ export function formatSignalPrice(price: number): string {
export function formatSignalTime(unixSec: number, withDate = true): string {
if (!unixSec) return '—';
const tz = getDisplayTimezone();
if (!withDate) return formatUnixClock(unixSec, tz, true);
return formatUnixDateTime(unixSec, tz);
const fmt = getTradeAlertTimeFormat();
if (!withDate) {
const { time } = splitChartTimePattern(fmt);
return formatUnixWithChartPattern(unixSec, time || 'HH:mm', tz);
}
return formatUnixWithChartPattern(unixSec, fmt, tz);
}
export function getSignalTypeKo(type: 'BUY' | 'SELL'): string {