-
当月第一天,和当月最后一天的获取方式...这个就确实比较扯了,但事实上它就要这样....
查看全部 -
1.如何计算出现位置
wrapper.left=input.offsetleft
wrapper.top=input.top+height
2.ui设计 div+table
3.一个月有4-6个星期
4.当月第一天 new Date(year,month-1,1)
当月最后天 new Date(year,month,0)因为月可能28天可能30,31
星期1-星期天【1,2,3,4,5,6】
5.组件结构
查看全部 -
vscode数字范围插件
查看全部 -
第一天
new Date(year, minth-1, 1)
最后一天
new Date(year, month,0)
查看全部 -
(function () { var datepicker = {}; datepicker.getMonthData = function (year,month) { var ret = []; if(!year || !month){ var today = new Date(); year = today.getFullYear(); month = today.getMonth()+1; } var firstDay = new Date(year,month-1,1); var firstDayWeekDay = firstDay.getDay(); if(firstDayWeekDay === 0) firstDayWeekDay = 7; var lastDayOfLastMonth = new Date(year,month-1,0); var lastDateOfLastMonth = lastDayOfLastMonth.getDate(); var preMonthDayCount = firstDayWeekDay -1; var lastDay = new Date(year,month,0); var lastDate = lastDay.getDate(); //利用循环查询到一周日期 for( var i = 0; i<7*6; i++){ var date = i+1 - preMonthDayCount; var showDate = date; var thisMonth = month; if(date <= 0){ thisMonth = month +1; showDate = lastDateOfLastMonth +date; }else if(date > lastDate){ thisMonth = month +1; showDate = showDate-lastDate; }if(thisMonth === 0)thisMonth = 12; if(thisMonth === 13) thisMonth = 1; ret.push({ month:thisMonth, date:date, showDate:showDate }); } return ret; }; window.datepicker = datepicker; })();
查看全部 -
new Date(year, month-1, date)
月份需要减一
越界自动退位
getFullYear()/ getMonth()/ getDate() / getDay() [获取星期0到6]
当月第一天new Date(year, minth-1, 1)
当月最后一天new Date(year, month,0)
查看全部
举报
0/150
提交
取消