klio 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klio",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Eine CLI für astrologische Berechnungen",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -268,6 +268,9 @@ function getAstrologicalData(planetName, customDate = null) {
268
268
 
269
269
  // Verwende das angegebene Datum oder das aktuelle Datum (mit Zeitzonenberücksichtigung)
270
270
  let calcYear, calcMonth, calcDay, calcHour, calcMinute;
271
+ let timezoneOffsetMinutes;
272
+ let timezone = null;
273
+ let baseDate;
271
274
 
272
275
  if (customDate) {
273
276
  calcYear = customDate.year;
@@ -275,6 +278,18 @@ function getAstrologicalData(planetName, customDate = null) {
275
278
  calcDay = customDate.day;
276
279
  calcHour = customDate.hour;
277
280
  calcMinute = customDate.minute;
281
+ baseDate = customDate;
282
+ // Versuche, die Zeitzone vom customDate abzuleiten (z.B. Geburtsort)
283
+ if (customDate.location && customDate.location.timezone) {
284
+ timezone = customDate.location.timezone;
285
+ } else {
286
+ try {
287
+ const config = loadConfig();
288
+ if (config && config.currentLocation && config.currentLocation.timezone) {
289
+ timezone = config.currentLocation.timezone;
290
+ }
291
+ } catch (_) {}
292
+ }
278
293
  } else {
279
294
  // Verwende die aktuelle Zeit in der konfigurierten Zeitzone
280
295
  const timeData = getCurrentTimeInTimezone();
@@ -283,9 +298,24 @@ function getAstrologicalData(planetName, customDate = null) {
283
298
  calcDay = timeData.day;
284
299
  calcHour = timeData.hour;
285
300
  calcMinute = timeData.minute;
301
+ baseDate = timeData;
302
+ try {
303
+ const config = loadConfig();
304
+ if (config && config.currentLocation && config.currentLocation.timezone) {
305
+ timezone = config.currentLocation.timezone;
306
+ }
307
+ } catch (_) {}
308
+ }
309
+
310
+ // Bestimme Offset in Minuten (Lokalzeit - UTC)
311
+ if (timezone) {
312
+ timezoneOffsetMinutes = getTimezoneOffset({ year: calcYear, month: calcMonth, day: calcDay, hour: calcHour, minute: calcMinute }, timezone);
313
+ } else {
314
+ // Fallback: Systemoffset umkehren, damit (Lokalzeit - UTC) entsteht
315
+ timezoneOffsetMinutes = -new Date().getTimezoneOffset();
286
316
  }
287
317
 
288
- const julianDay = swisseph.swe_julday(calcYear, calcMonth, calcDay, calcHour + calcMinute / 60, swisseph.SE_GREG_CAL);
318
+ const julianDay = calculateJulianDayUTC({ year: calcYear, month: calcMonth, day: calcDay, hour: calcHour, minute: calcMinute }, timezoneOffsetMinutes);
289
319
  const flag = swisseph.SEFLG_SWIEPH | swisseph.SEFLG_SPEED;
290
320
  const result = swisseph.swe_calc_ut(julianDay, planet, flag);
291
321
 
@@ -340,13 +370,18 @@ function getCriticalPlanets(customDate = null) {
340
370
  timeData = getCurrentTimeInTimezone();
341
371
  }
342
372
 
343
- const julianDay = swisseph.swe_julday(
344
- timeData.year,
345
- timeData.month,
346
- timeData.day,
347
- timeData.hour + timeData.minute / 60,
348
- swisseph.SE_GREG_CAL
349
- );
373
+ // Berücksichtige die lokale Zeitzone für die Umrechnung nach UTC
374
+ let timezone = null;
375
+ try {
376
+ const config = loadConfig();
377
+ if (customDate && customDate.location && customDate.location.timezone) {
378
+ timezone = customDate.location.timezone;
379
+ } else if (config && config.currentLocation && config.currentLocation.timezone) {
380
+ timezone = config.currentLocation.timezone;
381
+ }
382
+ } catch (_) {}
383
+ const offsetMinutes = timezone ? getTimezoneOffset(timeData, timezone) : -new Date().getTimezoneOffset();
384
+ const julianDay = calculateJulianDayUTC(timeData, offsetMinutes);
350
385
 
351
386
  // Berechne Positionen aller Planeten
352
387
  for (const [name, planetId] of Object.entries(planets)) {
@@ -613,13 +648,16 @@ function isPlanetRetrograde(planetName, dateComponents) {
613
648
  if (planet === undefined) return false;
614
649
 
615
650
  // Berechne die Position mit Geschwindigkeitsinformation
616
- const julianDay = swisseph.swe_julday(
617
- dateComponents.year,
618
- dateComponents.month,
619
- dateComponents.day,
620
- dateComponents.hour + dateComponents.minute / 60,
621
- swisseph.SE_GREG_CAL
622
- );
651
+ // Konvertiere Datum zu UTC basierend auf konfigurierter Zeitzone
652
+ let tz = null;
653
+ try {
654
+ const config = loadConfig();
655
+ if (config && config.currentLocation && config.currentLocation.timezone) {
656
+ tz = config.currentLocation.timezone;
657
+ }
658
+ } catch (_) {}
659
+ const off = tz ? getTimezoneOffset(dateComponents, tz) : -new Date().getTimezoneOffset();
660
+ const julianDay = calculateJulianDayUTC(dateComponents, off);
623
661
 
624
662
  const flag = swisseph.SEFLG_SWIEPH | swisseph.SEFLG_SPEED;
625
663
  const result = swisseph.swe_calc_ut(julianDay, planet, flag);
@@ -1343,7 +1381,6 @@ async function showCombinedAnalysis(planetName, transitDate = null, birthData =
1343
1381
  console.log('================================================================================');
1344
1382
  console.log(`Analyse-Datum: ${transitDate.day}.${transitDate.month}.${transitDate.year}`);
1345
1383
  console.log(`Geburtsdatum: ${birthData.day}.${birthData.month}.${birthData.year} ${birthData.hour}:${birthData.minute.toString().padStart(2, '0')}`);
1346
- console.log(`Haus-System: ${houseSystem.charAt(0).toUpperCase() + houseSystem.slice(1)} (basierend auf Geburts-ASC)`);
1347
1384
  console.log('');
1348
1385
 
1349
1386
  // Zeige Planetenpositionen und Häuser
package/src/cli/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const { Command } = require('commander');
2
2
  const { planets, signs } = require('../astrology/astrologyConstants');
3
3
  const { showRetrogradePlanets } = require('../astrology/retrogradeService');
4
- const { getCurrentTimeInTimezone, showAspectFigures, analyzeElementDistribution, getTimezoneOffset, calculateJulianDayUTC, calculateHouses, getAstrologicalData, getPlanetHouse, showPlanetAspects, calculatePlanetAspects, getAllActiveAspects, showAllActiveAspects, getBirthDataFromConfig, detectAspectFigures, calculatePersonalTransits, showPersonalTransitAspects, showCombinedAnalysis, calculatePersonalTransitAspects, determineAspectPhase, findExactAspectTime, findLastExactAspectTime } = require('../astrology/astrologyService');
4
+ const { getCurrentTimeInTimezone, showAspectFigures, analyzeElementDistribution, getTimezoneOffset, calculateJulianDayUTC, calculateHouses, getAstrologicalData, getPlanetHouse, showPlanetAspects, calculatePlanetAspects, getAllActiveAspects, showAllActiveAspects, getBirthDataFromConfig, detectAspectFigures, calculatePersonalTransits, showPersonalTransitAspects, showCombinedAnalysis, calculatePersonalTransitAspects, determineAspectPhase, findExactAspectTime, findLastExactAspectTime, getAspectAngle, getFutureAspects, getPastAspects } = require('../astrology/astrologyService');
5
5
  const { performSetup, showConfigStatus, loadConfig, setAIModel, askAIModel } = require('../config/configService');
6
6
  const { parseAppleHealthXML } = require('../health/healthService');
7
7
  const { analyzeStepsByPlanetSign, analyzeStressByPlanetAspects, analyzePlanetAspectsForSleep } = require('../health/healthAnalysis');
@@ -529,7 +529,6 @@ program
529
529
  console.log('================================================================================');
530
530
  console.log(`\nAnalyse-Datum: ${transitDateDisplay.day}.${transitDateDisplay.month}.${transitDateDisplay.year}`);
531
531
  console.log(`Geburtsdatum: ${birthData.day}.${birthData.month}.${birthData.year} ${birthData.hour}:${birthData.minute.toString().padStart(2, '0')}`);
532
- console.log(`Haus-System: ${houseSystem.charAt(0).toUpperCase() + houseSystem.slice(1)} (basierend auf Geburts-ASC)`);
533
532
 
534
533
  }
535
534
 
@@ -28,10 +28,16 @@ async function analyzeHouseDistribution(planetName, folderPath, houseSystem = 'K
28
28
  const planetLongitude = planetData.longitude;
29
29
 
30
30
  // Berechne die Hausposition für dieses Datum
31
- const julianDay = swisseph.swe_julday(
32
- dateComponents.year, dateComponents.month, dateComponents.day,
33
- dateComponents.hour + dateComponents.minute / 60, swisseph.SE_GREG_CAL
34
- );
31
+ const { calculateJulianDayUTC, getTimezoneOffset, loadConfig } = require('../astrology/astrologyService');
32
+ let tz = null;
33
+ try {
34
+ const config = loadConfig();
35
+ if (config && config.currentLocation && config.currentLocation.timezone) {
36
+ tz = config.currentLocation.timezone;
37
+ }
38
+ } catch (_) {}
39
+ const off = tz ? getTimezoneOffset(dateComponents, tz) : -new Date().getTimezoneOffset();
40
+ const julianDay = calculateJulianDayUTC(dateComponents, off);
35
41
 
36
42
  const houses = await calculateHouses(julianDay, houseSystem);
37
43
  const planetHouse = getPlanetHouse(planetLongitude, houses.house);
@@ -89,10 +95,16 @@ async function filterFilesByHouse(planetName, folderPath, targetHouse, houseSyst
89
95
  const planetLongitude = planetData.longitude;
90
96
 
91
97
  // Berechne die Hausposition für dieses Datum
92
- const julianDay = swisseph.swe_julday(
93
- dateComponents.year, dateComponents.month, dateComponents.day,
94
- dateComponents.hour + dateComponents.minute / 60, swisseph.SE_GREG_CAL
95
- );
98
+ const { calculateJulianDayUTC, getTimezoneOffset, loadConfig } = require('../astrology/astrologyService');
99
+ let tz = null;
100
+ try {
101
+ const config = loadConfig();
102
+ if (config && config.currentLocation && config.currentLocation.timezone) {
103
+ tz = config.currentLocation.timezone;
104
+ }
105
+ } catch (_) {}
106
+ const off = tz ? getTimezoneOffset(dateComponents, tz) : -new Date().getTimezoneOffset();
107
+ const julianDay = calculateJulianDayUTC(dateComponents, off);
96
108
 
97
109
  const houses = await calculateHouses(julianDay, houseSystem);
98
110
  const planetHouse = getPlanetHouse(planetLongitude, houses.house);