统一补够6行
parent
bc55309c1a
commit
d91ed4e414
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "bash-calendar",
|
||||
"description": "终端版万年历",
|
||||
"version": "1.2.6",
|
||||
"version": "1.2.7",
|
||||
"author": "yutent <yutent.io@gmail.com>",
|
||||
"bin": {
|
||||
"calendar": "index.js",
|
||||
|
|
|
@ -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++) {
|
||||
|
|
Loading…
Reference in New Issue