refactor: 사주 Python 엔진 제거 + lunar-javascript 기반 절기 계산 도입
- lib/solar-terms.ts: solarlunar → lunar-javascript로 전면 교체 - getSolarTermDate(): LunarYear.fromYear().getJieQiJulianDays() 사용 (시분 단위 정밀도) - 소한(22)/대한(23)은 year-1로 조회해 해당 연도 1월 날짜 정확히 반환 - getCurrentSolarTerm(): 입춘 기준 두 구간 분리, Date.UTC() 비교 - lib/daeun-calculator.ts: getSolarTermDate 정확도 향상으로 termYear 수동 보정 제거 - lib/saju-calculator.ts: 일주 기준일 甲戌, Date.UTC(), 오호둔월법 공식 적용 - lib/ai-interpretation.ts: 신약 용신 후보 내림차순 정렬 수정 - app/saju/result/page.tsx: Python 엔진(fetchFromPythonEngine) 완전 제거, TS 전용 - app/api/saju/calculate/route.ts: Python 프록시 라우트 삭제 - app/saju/page.tsx: fromHistory 파라미터 제거 - types/lunar-javascript.d.ts: 타입 선언 파일 추가 검증 케이스(1992-12-23 16:30 남성): 壬申/壬子/癸酉/庚申 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,17 +42,8 @@ function calculateDaeunStartAge(
|
||||
const currentTerm = getCurrentSolarTerm(birthYear, birthMonth, birthDay);
|
||||
const termDate = getSolarTermDate(birthYear, currentTerm);
|
||||
|
||||
let termYear = termDate.year;
|
||||
let termMonth = termDate.month;
|
||||
|
||||
// 대한, 소한 처리
|
||||
if (currentTerm >= 22 && birthMonth >= 2) {
|
||||
termYear = birthYear;
|
||||
} else if (currentTerm >= 22) {
|
||||
termYear = birthYear - 1;
|
||||
}
|
||||
|
||||
const termDateObj = new Date(termYear, termMonth - 1, termDate.day);
|
||||
// getSolarTermDate가 소한(22)/대한(23)에 대해 birthYear 1월 날짜를 올바르게 반환
|
||||
const termDateObj = new Date(termDate.year, termDate.month - 1, termDate.day);
|
||||
const birthDateObj = new Date(birthYear, birthMonth - 1, birthDay);
|
||||
|
||||
const diffTime = birthDateObj.getTime() - termDateObj.getTime();
|
||||
|
||||
Reference in New Issue
Block a user