Skip to content

fix #459: use UTC for release year display#474

Open
SvenS7 wants to merge 1 commit into
swingmx:masterfrom
SvenS7:fix/release-year-from-tags
Open

fix #459: use UTC for release year display#474
SvenS7 wants to merge 1 commit into
swingmx:masterfrom
SvenS7:fix/release-year-from-tags

Conversation

@SvenS7
Copy link
Copy Markdown

@SvenS7 SvenS7 commented May 5, 2026

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

This fixes a timezone-dependent release year display issue.

Root cause:

  • Release year was derived using local timezone conversion from timestamps.
  • In negative UTC offsets (e.g., America/New_York), 2026-01-01 00:00:00 UTC could display as 2025.

Changes:

  • Use UTC conversion when deriving release year for display in artist and get all album date paths.
  • Keep other timestamp displays (created_date, last played) unchanged.

Validation:

  • Reproduced timezone difference with a small script.
  • Ran Ruff on changed files:
    uv run ruff check src/swingmusic/api/artist.py src/swingmusic/api/getall/init.py
  • Result: all checks passed.

Closes #459

Copilot AI review requested due to automatic review settings May 5, 2026 13:18
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 5, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes timezone-dependent off-by-one release year displays by ensuring the year is derived in UTC rather than the server’s local timezone, aligning UI output across negative UTC offsets (e.g., America/New_York).

Changes:

  • Use timezone.utc when converting album/artist release timestamps to a display year.
  • Remove an unused pprint import from the artist API module.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/swingmusic/api/getall/init.py Derives the “date” sort help text year using UTC-based timestamp conversion.
src/swingmusic/api/artist.py Derives an artist’s release year in UTC and removes an unused debug import.

Comment on lines +141 to +143
item_dict["help_text"] = datetime.fromtimestamp(
item.date, tz=timezone.utc
).year
try:
year = datetime.fromtimestamp(artist.date).year
year = datetime.fromtimestamp(artist.date, tz=timezone.utc).year
except ValueError:
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.

Release Year is appearing as -1 from tags

3 participants