Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default TZ when calculating birthdate if on_date param is not set #112

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
1.5.0 (unreleased)
------------------

- #112 Use default TZ when calculating birthdate if `on_date` param is not set
- #111 Allow/Disallow the introduction of future dates of birth
- #110 Compatibility with core#2584 (SampleType to DX)
- #108 Fix Traceback when creating partitions when no patient assigned
Expand Down
3 changes: 3 additions & 0 deletions src/senaite/patient/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ def get_birth_date(period, on_date=None, default=_marker):
on_date = dtime.to_dt(on_date)
if not on_date:
on_date = datetime.now()
# apply system's current time zone
tz = dtime.get_os_timezone()
on_date = dtime.to_zone(on_date, tz)

# calculate the date when everything started
delta = relativedelta(years=years, months=months, days=days)
Expand Down
Loading