Merge branch 'master' of git.wkit.fun:yutent/bash-calendar

master
yutent 2024-12-10 17:48:21 +08:00
commit ef6dea3605
5 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
node_modules/
package-lock.json
run.js
index.js
# Thumbnails
._*

View File

@ -9,8 +9,7 @@
农历的计算, 只支持 1901-2100 范围内的。
![demo1.png](./img/demo.png)
<img src="./img/demo.png" width="673">
## 安装
```bash

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 297 KiB

File diff suppressed because one or more lines are too long

View File

@ -92,8 +92,9 @@ export function getCalendarTable(year, month) {
list.push(tmp)
}
nd = list.length % 7
nd = nd > 0 ? 7 - nd : 0
// nd = list.length % 7
// nd = nd > 0 ? 7 - nd : 0
nd = 42 - list.length // 统一补够6行
// 修正年月日的数值, 以匹配节假日
if (nd > 0) {
@ -140,7 +141,7 @@ function drawThead(year, month) {
function drawTbody(year, month) {
var table = getCalendarTable(year, month)
var line = 0
var maxi = 3 * Math.ceil(table.length / 7)
var maxi = 3 * Math.ceil(table.length / 7) // 每个单元格占3行, 所以要 * 3
// i 是 纵坐标, j是横坐标格子
for (let i = 0; i < maxi + 1; i++) {