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

Fixed Git history to show the correct date and fixed some typos (#1754) #1778

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 5 additions & 3 deletions packages/git/src/browser/history/git-history-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class GitHistoryWidget extends GitNavigableListWidget<GitHistoryListNode>
@inject(ApplicationShell) protected readonly shell: ApplicationShell,
@inject(FileSystem) protected readonly fileSystem: FileSystem,
@inject(Git) protected readonly git: Git,
@inject(GitAvatarService) protected readonly avartarService: GitAvatarService,
@inject(GitAvatarService) protected readonly avatarService: GitAvatarService,
@inject(WidgetManager) protected readonly widgetManager: WidgetManager,
@inject(GitDiffContribution) protected readonly diffContribution: GitDiffContribution) {
super();
Expand Down Expand Up @@ -107,10 +107,12 @@ export class GitHistoryWidget extends GitNavigableListWidget<GitHistoryListNode>
const commits: GitCommitNode[] = [];
for (const commit of changes) {
const fileChangeNodes: GitFileChangeNode[] = [];
const avatarUrl = await this.avartarService.getAvatar(commit.author.email);
const avatarUrl = await this.avatarService.getAvatar(commit.author.email);
const authorDate = new Date(commit.author.timestamp);
authorDate.setUTCSeconds(commit.author.timestamp);
Copy link
Contributor

Choose a reason for hiding this comment

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

I have reviewed the code and my recommendation was incorrect. We should do:

const authorDate = new Date(commit.author.timestamp * 1000);

instead of:

const authorDate = new Date(commit.author.timestamp);
authorDate.setUTCSeconds(commit.author.timestamp);

Could you please make an update, @AlexErling?

commits.push({
authorName: commit.author.name,
authorDate: new Date(commit.author.timestamp),
authorDate,
authorEmail: commit.author.email,
authorDateRelative: commit.authorDateRelative,
authorAvatar: avatarUrl,
Expand Down