This commit is contained in:
MeiK
2021-09-06 11:18:47 +08:00
parent 789976cd8e
commit 7ab215c587
2 changed files with 3 additions and 12 deletions

View File

@@ -1,15 +1,5 @@
# github-style
## 已知问题
- 往年热力图起始点错误
## TODO
- 评论
- 自定义菜单
- 更多链接平台支持
## Init hugo site
```bash

View File

@@ -173,12 +173,13 @@ function graph(year, posts, startDate, endDate) {
}
const monthPos = [];
let startMonth = -1;
const weekday = startDate.getDay();
for (let i = 0; i < 53; i++) {
html += `<g transform="translate(${i * 16}, 0)">`;
for (let j = 0; j < 7; j++) {
const date = new Date(startDate.getTime() + (i * 7 + j) * 24 * 60 * 60 * 1000);
const date = new Date(startDate.getTime() + (i * 7 + j - weekday) * 24 * 60 * 60 * 1000);
const dataDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
if (date > endDate) {
if (date < startDate || date > endDate) {
continue;
}