From 60409362c7eeab2cad96de7b48be7cea4ed681b7 Mon Sep 17 00:00:00 2001 From: vrubel Date: Tue, 30 Dec 2025 14:26:14 +0300 Subject: [PATCH] Update timezone from Europe/London to Europe/Moscow across configuration, backend, and frontend files for consistent time handling. --- Dockerfile | 2 +- README.md | 2 +- backend/api.py | 2 +- backend/telegram_bot.py | 2 +- backend/utils.py | 2 +- docker-compose.yml | 2 +- frontend/admin/static/script.js | 2 +- frontend/public/static/script.js | 12 ++++++------ 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1d1651c..db0fdf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ COPY backend/ ./backend/ COPY frontend/ ./frontend/ # Переменные окружения -ENV TZ=Europe/London +ENV TZ=Europe/Moscow ENV PYTHONPATH=/app # Запуск приложения diff --git a/README.md b/README.md index 87351ac..826f26b 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ docker compose exec backend python -c "import shutil; shutil.copy2('/app/data/sc ## Особенности -- Таймзона: Europe/London +- Таймзона: Europe/Moscow - Неделя начинается с понедельника - Дискретность времени: 15 минут (00, 15, 30, 45) - Диапазон времени: 08:00-20:00 diff --git a/backend/api.py b/backend/api.py index 35e05de..33b9d28 100644 --- a/backend/api.py +++ b/backend/api.py @@ -17,7 +17,7 @@ from backend.utils import ( router = APIRouter() -TZ = pytz.timezone("Europe/London") +TZ = pytz.timezone("Europe/Moscow") @router.get("/schedule", response_model=ScheduleResponse) diff --git a/backend/telegram_bot.py b/backend/telegram_bot.py index 24fb805..776ade2 100644 --- a/backend/telegram_bot.py +++ b/backend/telegram_bot.py @@ -18,7 +18,7 @@ from backend.models import TaskCreate, EventCreate logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) -TZ = pytz.timezone("Europe/London") +TZ = pytz.timezone("Europe/Moscow") BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN", "") # Состояния для ConversationHandler diff --git a/backend/utils.py b/backend/utils.py index ef2117b..2f4d585 100644 --- a/backend/utils.py +++ b/backend/utils.py @@ -6,7 +6,7 @@ import pytz from backend.database import Task, Event, WeeklyTaskException from backend.models import ScheduleItem -TZ = pytz.timezone("Europe/London") +TZ = pytz.timezone("Europe/Moscow") def get_weekday_from_date(date_str: str) -> int: diff --git a/docker-compose.yml b/docker-compose.yml index 40f4a3a..7a2abdb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: env_file: - .env environment: - - TZ=Europe/London + - TZ=Europe/Moscow - DATABASE_PATH=/app/data/schedule.db restart: unless-stopped depends_on: diff --git a/frontend/admin/static/script.js b/frontend/admin/static/script.js index d25e91b..c6833d4 100644 --- a/frontend/admin/static/script.js +++ b/frontend/admin/static/script.js @@ -7,7 +7,7 @@ function getTodayInLondon() { // Получаем текущую дату в таймзоне London const now = new Date(); const formatter = new Intl.DateTimeFormat('en-CA', { - timeZone: 'Europe/London', + timeZone: 'Europe/Moscow', year: 'numeric', month: '2-digit', day: '2-digit' diff --git a/frontend/public/static/script.js b/frontend/public/static/script.js index 5459038..a99dc7d 100644 --- a/frontend/public/static/script.js +++ b/frontend/public/static/script.js @@ -1,4 +1,4 @@ -const TZ = 'Europe/London'; +const TZ = 'Europe/Moscow'; function formatDate(dateStr) { const date = new Date(dateStr + 'T00:00:00'); @@ -17,11 +17,11 @@ function formatDate(dateStr) { return `${weekday}, ${day} ${month}`; } -function getTodayInLondon() { - // Получаем текущую дату в таймзоне London +function getTodayInMoscow() { + // Получаем текущую дату в таймзоне Moscow const now = new Date(); const formatter = new Intl.DateTimeFormat('en-CA', { - timeZone: 'Europe/London', + timeZone: 'Europe/Moscow', year: 'numeric', month: '2-digit', day: '2-digit' @@ -30,7 +30,7 @@ function getTodayInLondon() { } function getTomorrowInLondon() { - const today = getTodayInLondon(); + const today = getTodayInMoscow(); const date = new Date(today); date.setDate(date.getDate() + 1); return date.toISOString().split('T')[0]; @@ -80,7 +80,7 @@ function calculateEndTime(startTime, durationMin) { } async function loadSchedule() { - const today = getTodayInLondon(); + const today = getTodayInMoscow(); const tomorrow = getTomorrowInLondon(); console.log('Loading schedule from', today, 'to', tomorrow);