From cb107415b94c283765c959bb4b16c635af0b4835 Mon Sep 17 00:00:00 2001 From: Rajan Sahu <55847984+rajansahu713@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:25:08 +0530 Subject: [PATCH] Change hardcoded time zone to default to picking from local time This commit modifies the code to utilize the system's default time zone instead of hardcoding a specific one. By doing so, the application will automatically adapt to the local time zone settings of the user's system, providing a more flexible and user-friendly experience. --- fastapi_scheduler/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastapi_scheduler/admin.py b/fastapi_scheduler/admin.py index f97531a..1c959f1 100644 --- a/fastapi_scheduler/admin.py +++ b/fastapi_scheduler/admin.py @@ -39,6 +39,7 @@ from pydantic import BaseModel, validator from starlette.requests import Request from typing_extensions import Annotated, Literal +import tzlocal class SchedulerAdmin(admin.PageAdmin): @@ -47,7 +48,7 @@ class SchedulerAdmin(admin.PageAdmin): router_prefix = "/jobs" scheduler: BaseScheduler = AsyncIOScheduler( jobstores={"default": MemoryJobStore()}, - timezone="Asia/Shanghai", + timezone=tzlocal.get_localzone_name(), ) class JobModel(BaseModel):