fix: send ISO format dates instead of Unix timestamps
Backend was sending Unix timestamps as strings (e.g. '1716112800') which JavaScript Date couldn't parse. Now sends proper ISO 8601 format dates that work with new Date() in the browser.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import subprocess
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
|
||||
@@ -182,10 +183,10 @@ def get_commit_detail(repo_path: str, commit_hash: str) -> dict[str, Any]:
|
||||
"parents": parents,
|
||||
"author_name": author,
|
||||
"author_email": email,
|
||||
"author_date": str(timestamp),
|
||||
"author_date": datetime.fromtimestamp(timestamp, tz=timezone.utc).isoformat(),
|
||||
"committer_name": author, # TODO: extract committer separately
|
||||
"committer_email": email, # TODO: extract committer separately
|
||||
"committer_date": str(timestamp),
|
||||
"committer_date": datetime.fromtimestamp(timestamp, tz=timezone.utc).isoformat(),
|
||||
"message": message,
|
||||
"body": body,
|
||||
"branches": branch_map.get(commit_hash, []),
|
||||
@@ -361,7 +362,7 @@ def _commit_to_dict(commit: Commit, graph_symbol: str = "", graph_depth: int = 0
|
||||
"parents": commit.parents,
|
||||
"author_name": commit.author,
|
||||
"author_email": commit.email,
|
||||
"author_date": str(commit.timestamp),
|
||||
"author_date": datetime.fromtimestamp(commit.timestamp, tz=timezone.utc).isoformat(),
|
||||
"message": commit.message,
|
||||
"refs": refs,
|
||||
"graph_symbol": graph_symbol,
|
||||
|
||||
Reference in New Issue
Block a user