feat: 카카오 앱 키 설정, 절기 기준 계산, 대운 정밀화
카카오 앱 키 설정: - 환경 변수(.env.local)를 통한 안전한 키 관리 - NEXT_PUBLIC_KAKAO_APP_KEY 환경 변수 사용 - layout.tsx에서 환경 변수 읽어서 Kakao SDK 초기화 - .env.local 템플릿 파일 생성 (키 발급 가이드 포함) 음력 변환 정확도 개선: - 24절기 계산 라이브러리 구현 (solar-terms.ts) - 절기 기준 월주 계산으로 정확도 향상 - 입춘, 경칩, 청명 등 12개 월 절기 지원 - getSolarTermMonthBranch() - 절기 기준 월 지지 계산 - getCurrentSolarTerm() - 현재 절기 확인 - 사주 결과 페이지에 절기 정보 표시 대운 시작 나이 정밀 계산: - 절기 기준 대운수 계산 구현 - 양남음녀(순행), 음남양녀(역행) 정확한 일수 계산 - 3일 = 1세 공식 적용 - calculateDaeunStartAge() 함수로 정밀 계산 - 이전 평균 8세 → 실제 계산값 (1~10세 범위) - 대운 섹션에 시작 나이 계산 근거 표시 문서화: - SETUP.md 생성 - 카카오 앱 키 발급 및 설정 가이드 - 절기 기준 사주 계산 설명 - 대운 계산 원리 설명 - 음력 변환 사용법 - 기술 스택 및 개발 환경 사주 결과 페이지 개선: - 절기 정보 표시 (녹색 박스) - 대운 시작 나이 설명 추가 - 사용자에게 계산 원리 투명하게 공개 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -60,19 +60,19 @@ export function getYearGanzi(year: number): { stem: string; branch: string; stem
|
||||
}
|
||||
|
||||
/**
|
||||
* 월의 간지를 계산
|
||||
* 월의 간지를 계산 (절기 기준)
|
||||
*/
|
||||
export function getMonthGanzi(year: number, month: number): { stem: string; branch: string; stemKr: string; branchKr: string } {
|
||||
// 월 지지는 고정: 1월=인, 2월=묘, 3월=진, 4월=사, 5월=오, 6월=미...
|
||||
// 단, 절기 기준이지만 간단히 월로 계산
|
||||
const branchIndex = (month + 1) % 12; // 1월=인(2), 2월=묘(3)...
|
||||
export function getMonthGanzi(year: number, month: number, day: number): { stem: string; branch: string; stemKr: string; branchKr: string } {
|
||||
// 절기 기준으로 월 지지 계산
|
||||
const { getSolarTermMonthBranch } = require('./solar-terms');
|
||||
const branchIndex = getSolarTermMonthBranch(year, month, day);
|
||||
|
||||
// 월 천간 계산 (년간에 따라 달라짐)
|
||||
const yearStem = getYearGanzi(year).stem;
|
||||
const yearStemIndex = HEAVENLY_STEMS.indexOf(yearStem as any);
|
||||
|
||||
// 월 천간 공식: (년간 * 2 + 월) % 10
|
||||
const stemIndex = (yearStemIndex * 2 + month) % 10;
|
||||
// 월 천간 공식: (년간 * 2 + 월지지) % 10
|
||||
const stemIndex = (yearStemIndex * 2 + branchIndex) % 10;
|
||||
|
||||
return {
|
||||
stem: HEAVENLY_STEMS[stemIndex],
|
||||
@@ -224,7 +224,7 @@ export function calculateSaju(
|
||||
gender: 'male' | 'female'
|
||||
): SajuData {
|
||||
const yearGanzi = getYearGanzi(year);
|
||||
const monthGanzi = getMonthGanzi(year, month);
|
||||
const monthGanzi = getMonthGanzi(year, month, day);
|
||||
const dayGanzi = getDayGanzi(year, month, day);
|
||||
const hourGanzi = hour !== null ? getHourGanzi(dayGanzi, hour) : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user