Skip to content

Conversation

@mr-raj12
Copy link
Contributor

@mr-raj12 mr-raj12 commented Feb 5, 2026

Description

Convert Borg 2.x UTC timestamps to local time before storing as naive datetimes.
Borg 2.x returns timestamps with UTC timezone info (e.g., 2018-11-06T14:24:04+00:00). The old code stripped timezone with .replace(tzinfo=None), storing
raw UTC values that displayed incorrectly as local time in the UI.

Changes (2 files):

File Change
src/vorta/borg/create.py:25 Add .astimezone() before .replace(tzinfo=None)
src/vorta/borg/list_repo.py:57 Same fix

Behavior:

  • Borg 1.x (naive timestamps): No change — .astimezone() on naive datetime assumes local time
  • Borg 2.x (UTC timestamps): Now correctly converts UTC → local before storing

Related Issue

Closes #2390

Motivation and Context

Users in non-UTC timezones would see incorrect archive times when using Borg 2.x. A backup made at 9:24 AM local (EST) would display as "14:24" (the raw UTC
value).

How Has This Been Tested?

  • Verified datetime behavior for both Borg 1.x and 2.x timestamp formats
  • Ruff lint passes
  • Unit tests pass (4 passed, 5 skipped on Windows)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix timezone handling for archive timestamps (Borg 2.x readiness)

1 participant