Skip to content

Commit 16d490f

Browse files
committed
Make time zone be dependant on client's time zone
1 parent 8078465 commit 16d490f

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/components/overrides/LastUpdated.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const acc: GitHubAccount = await getGitHubAccountFromFile(filePath);
1414
<time datetime={lastUpdated.toISOString()}>
1515
{lastUpdated.toLocaleDateString(lang, {
1616
dateStyle: "medium",
17-
timeZone: "UTC",
17+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
1818
})}
1919
</time>
2020
{" by "}

src/utils/git-utils.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@ export interface GitHubAccount {
66
accountLink?: string;
77
}
88

9-
const token: string | null = import.meta.env.GITHUB_TOKEN
10-
11-
const headers: RequestInit = token != null ? {
12-
headers: {
13-
Accept: "application/vnd.github+json",
14-
"User-Agent": "papermc-docs/author",
15-
"Authorization": `Bearer ${token}`
16-
},
17-
}
18-
: {
19-
headers: {
20-
Accept: "application/vnd.github+json",
21-
"User-Agent": "papermc-docs/author"
22-
},
23-
};
9+
const token: string | null = import.meta.env.GITHUB_TOKEN;
10+
11+
const headers: RequestInit =
12+
token != null
13+
? {
14+
headers: {
15+
Accept: "application/vnd.github+json",
16+
"User-Agent": "papermc-docs/author",
17+
Authorization: `Bearer ${token}`,
18+
},
19+
}
20+
: {
21+
headers: {
22+
Accept: "application/vnd.github+json",
23+
"User-Agent": "papermc-docs/author",
24+
},
25+
};
2426

2527
const repo: string = "PaperMC/docs";
2628
const cache: Map<string, GitHubAccount> = new Map();
2729

28-
2930
// Git
3031
export async function getGitHubAccountFromFile(filePath: string): Promise<GitHubAccount | null> {
3132
const displayName = execSync(`git log -1 --pretty="format:%an" -- "${filePath}"`).toString();

0 commit comments

Comments
 (0)