A timezone aware fastapi demo application.
Find a file
Waylon S. Walker d847a02781 add to just
2024-10-13 10:57:42 -05:00
fastapi_timezone init 2024-10-10 08:19:50 -05:00
templates init 2024-10-10 08:19:50 -05:00
.gitignore init 2024-10-10 08:19:50 -05:00
.python-version init 2024-10-10 08:19:50 -05:00
justfile add to just 2024-10-13 10:57:42 -05:00
pyproject.toml init 2024-10-10 08:19:50 -05:00
README.md init 2024-10-10 08:19:50 -05:00
uv.lock init 2024-10-10 08:19:50 -05:00

Timezone Aware FastApi Application

This is a demo application to demo how someone might make a fastapi application timezone aware. It does this by injecting a small amount of javascript in the template to set a timezone cookie that will be passed to the backend on every request. Alternatively the X-Timezone header can override this for non-browser based http requests i.e. another backend service or curl.

Running the application

This project uses just as a command runner, and uv as the package installer, you will need to have these installed to follow the instructions.

just run

Now you can open the application in your webbrowser at localhost:8000. You will see the time returned is localized to you even though the simulated times stored in the database are utc.