Merge branch 'master' of git.wkit.fun:yutent/bash-calendar
commit
ef6dea3605
|
@ -7,6 +7,7 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
run.js
|
run.js
|
||||||
|
index.js
|
||||||
|
|
||||||
# Thumbnails
|
# Thumbnails
|
||||||
._*
|
._*
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
农历的计算, 只支持 1901-2100 范围内的。
|
农历的计算, 只支持 1901-2100 范围内的。
|
||||||
|
|
||||||
|
|
||||||
![demo1.png](./img/demo.png)
|
<img src="./img/demo.png" width="673">
|
||||||
|
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
```bash
|
```bash
|
||||||
|
|
BIN
img/demo.png
BIN
img/demo.png
Binary file not shown.
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 297 KiB |
|
@ -92,8 +92,9 @@ export function getCalendarTable(year, month) {
|
||||||
list.push(tmp)
|
list.push(tmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
nd = list.length % 7
|
// nd = list.length % 7
|
||||||
nd = nd > 0 ? 7 - nd : 0
|
// nd = nd > 0 ? 7 - nd : 0
|
||||||
|
nd = 42 - list.length // 统一补够6行
|
||||||
|
|
||||||
// 修正年月日的数值, 以匹配节假日
|
// 修正年月日的数值, 以匹配节假日
|
||||||
if (nd > 0) {
|
if (nd > 0) {
|
||||||
|
@ -140,7 +141,7 @@ function drawThead(year, month) {
|
||||||
function drawTbody(year, month) {
|
function drawTbody(year, month) {
|
||||||
var table = getCalendarTable(year, month)
|
var table = getCalendarTable(year, month)
|
||||||
var line = 0
|
var line = 0
|
||||||
var maxi = 3 * Math.ceil(table.length / 7)
|
var maxi = 3 * Math.ceil(table.length / 7) // 每个单元格占3行, 所以要 * 3
|
||||||
|
|
||||||
// i 是 纵坐标, j是横坐标格子
|
// i 是 纵坐标, j是横坐标格子
|
||||||
for (let i = 0; i < maxi + 1; i++) {
|
for (let i = 0; i < maxi + 1; i++) {
|
||||||
|
|
Loading…
Reference in New Issue