Implement three divination modes, learn pages, and PM2 deploy on port 3130.
Add liuyao/bazi/combined flows with shared calc and AI infrastructure, 64-gua learn routes, and update Ubuntu PM2 deployment docs for port 3130. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/** 中国标准时间基准经度(UTC+8) */
|
||||
export const CHINA_STANDARD_MERIDIAN = 120;
|
||||
|
||||
/**
|
||||
* 根据出生地经度校正真太阳时。
|
||||
* 每差 1 度经度,时间差约 4 分钟。
|
||||
*/
|
||||
export function adjustToTrueSolarTime(
|
||||
date: Date,
|
||||
longitude: number,
|
||||
standardMeridian = CHINA_STANDARD_MERIDIAN,
|
||||
): Date {
|
||||
const offsetMinutes = (longitude - standardMeridian) * 4;
|
||||
return new Date(date.getTime() + offsetMinutes * 60 * 1000);
|
||||
}
|
||||
|
||||
export function formatDateTime(date: Date): string {
|
||||
const pad = (n: number) => n.toString().padStart(2, "0");
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
}
|
||||
|
||||
export function parseDateTime(
|
||||
dateStr: string,
|
||||
timeStr: string,
|
||||
): Date {
|
||||
const [year, month, day] = dateStr.split("-").map(Number);
|
||||
const [hour, minute] = timeStr.split(":").map(Number);
|
||||
return new Date(year, month - 1, day, hour, minute, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user