第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

“bootstrap 兼容日歷”不在周一開(kāi)始

“bootstrap 兼容日歷”不在周一開(kāi)始

慕勒3428872 2023-12-14 15:41:11
我正在嘗試讓這段代碼為我工作:https://codepen.io/bbarry/pen/Eopdk我希望日歷從星期一開(kāi)始。我已經(jīng)將 .js 中的 days:[] 從 Sa-So 更改為 Mo-Su。但這僅更改標(biāo)題。日期還是錯(cuò)了,12月1日仍然是星期三,但今年應(yīng)該是星期二。我很確定問(wèn)題出在 .html 中這部分附近的某個(gè)地方:<thead>  <tr class="c-weeks">    {{ for (i = 0; i < 7; i++) { }}      <th class="c-name">        {{: days[i] }}      </th>    {{ } }}  </tr></thead><tbody>  {{ for (j = 0; j < 6 && (j < 1 || mode === 'month'); j++) { }}  <tr>    {{ for (i = 0; i < 7; i++) { }}    {{ if (thedate > last) { dayclass = nextmonthcss; } else if (thedate >= first) { dayclass = thismonthcss; } }}    <td class="calendar-day {{: dayclass }} {{: thedate.toDateCssClass() }} {{: date.toDateCssClass() === thedate.toDateCssClass() ? 'selected':'' }} {{: daycss[i] }} js-cal-option" data-date="{{: thedate.toISOString() }}">      <div class="date">{{: thedate.getDate() }}</div>      {{ thedate.setDate(thedate.getDate() + 1);}}    </td>    {{ } }}  </tr>  {{ } }}</tbody>我已經(jīng)嘗試更改循環(huán)(i = 0; i < 7; i++)但無(wú)法修復(fù)它。
查看完整描述

1 回答

?
qq_花開(kāi)花謝_0

TA貢獻(xiàn)1835條經(jīng)驗(yàn) 獲得超7個(gè)贊

html 文件中的循環(huán)for (i = 0; i < 7; i++)僅打印 7 個(gè)標(biāo)題單元格,迭代數(shù)組days并打印單元格中的數(shù)組值。正如您所看到的,這不會(huì)影響日期。您需要處理日期對(duì)象。

html 文件中有 2 個(gè)日期對(duì)象:一個(gè)用于月視圖,另一個(gè)用于周視圖和日視圖。

月視圖

Date 對(duì)象在 html 文件的第 12 行實(shí)例化:

first?=?new?Date(year,?month,?1),

這意味著新的日期對(duì)象,傳遞參數(shù)年(上面為當(dāng)前年份)和月份(上面定義為當(dāng)前年份)。第三個(gè)參數(shù)是被視為該月第一天的月份中的某一天。將該參數(shù)設(shè)置為0。

first?=?new?Date(year,?month,?0),

周視圖

Date 對(duì)象在 html 文件的第 20 行實(shí)例化:

thedate?=?new?Date(date);

日期設(shè)置在第 21 行:

thedate.setDate(date.getDate()?-?date.getDay());

只需設(shè)置日期如下:

thedate.setDate(date.getDate()?-?date.getDay()+1);

日視圖:無(wú)需更改,因?yàn)槟褂弥芤晥D的相同對(duì)象。

查看完整回答
反對(duì) 回復(fù) 2023-12-14
  • 1 回答
  • 0 關(guān)注
  • 162 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)