diff --git a/client/src/components/LogEntryEditor.tsx b/client/src/components/LogEntryEditor.tsx index 62967e1..a1aff07 100644 --- a/client/src/components/LogEntryEditor.tsx +++ b/client/src/components/LogEntryEditor.tsx @@ -412,6 +412,14 @@ export default function LogEntryEditor({ entryId, logbookId, onBack }: LogEntryE } const handleFetchWeather = async () => { + const localToday = new Date() + const todayStr = `${localToday.getFullYear()}-${String(localToday.getMonth() + 1).padStart(2, '0')}-${String(localToday.getDate()).padStart(2, '0')}` + + if (date && date !== todayStr) { + showAlert(t('settings.weather_date_mismatch', { date, today: todayStr })) + return + } + const hasGps = evGpsLat && evGpsLng const fallbackLocation = evLocationName.trim() || departure.trim() || destination.trim() diff --git a/client/src/i18n/locales/de.json b/client/src/i18n/locales/de.json index 4cd6c82..a53e482 100644 --- a/client/src/i18n/locales/de.json +++ b/client/src/i18n/locales/de.json @@ -178,6 +178,7 @@ "no_key": "Bitte hinterlegen Sie Ihren OpenWeatherMap API-Schlüssel in den Einstellungen, um Wetterdaten abzurufen.", "weather_success": "Wetterdaten erfolgreich abgerufen!", "weather_error": "Wetterdatenabruf fehlgeschlagen. Überprüfen Sie den API-Schlüssel und die Verbindung.", + "weather_date_mismatch": "Wetterdaten können nur für den heutigen Tag ({{today}}) abgerufen werden. Dieser Logbucheintrag ist auf den {{date}} datiert.", "gps_error": "Bitte geben Sie einen Ort an oder ermitteln Sie die GPS-Koordinaten.", "theme_title": "Design-Anpassung", "theme_label": "Design-Stil der App", diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.json index 128bdd4..0c66d03 100644 --- a/client/src/i18n/locales/en.json +++ b/client/src/i18n/locales/en.json @@ -178,6 +178,7 @@ "no_key": "Please set your OpenWeatherMap API Key in settings to enable weather auto-fill.", "weather_success": "Weather details fetched successfully!", "weather_error": "Failed to fetch weather. Check your API key and connection.", + "weather_date_mismatch": "Weather data can only be fetched for today ({{today}}). This logbook entry is dated {{date}}.", "gps_error": "Please enter a location or fetch GPS coordinates first.", "theme_title": "UI Customization", "theme_label": "Application Style / Theme",