๋ชฉ์ฐจ
bootstrap4 datepicker tempusdominus style css ์์ ์ ์ํ ๋ฌ๋ ฅ element dom class
๋ถํธ์คํธ๋ฉ4์์๋ ๊ธฐ์กด์ datepicker๊ฐ ์๋ํ์ง ์๋๋ค.
๊ทธ๋ ๋ค๊ณ bootstrap์ ๋ง์ด๋๊ทธ๋ ์ด์ ์ ํ๊ธฐ๋ ์ ๋งคํ๋ค.
๋ถํธ์คํธ๋ฉ4์ ์ ์ฉ์ด ๊ฐ๋ฅํ ๋ฐ์ดํธํผ์ปค๋ tempusdominus๊ฐ ๊ฑฐ์ ์ ์ผํ๋ค.
์ข ๋ ์ปค์คํฐ๋ง์ด์ง์ ํ๋ ค๋ฉด ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ธ moments.js๋ ๊ฑด๋๋ ค์ผ ํ์ง๋ง, ์ผ๋จ์ tempusdominus๊ฐ ๊ทธ๋ฆฌ๋ calendar์ class์ html element ๊ตฌ์กฐ๋ง ์์๋ ๋๋ต์ ์ธ ์คํ์ผ๋ง์ ๊ฐ๋ฅํ๋ค.
ํ์ง๋ง ์ ๊ฐ์ค๋ฝ๊ฒ๋ ๋ฐ์ดํฐํผ์ปค๋ฅผ ๋ฉ์ถ๊ณ ๋์ ํ์ํ๊ธฐ๊ฐ ์ฝ์ง ์๋ค.
์๊ฐ์ด ์์ด์ ์ผ๋จ ๊ทธ๋ฅ tempusdominus datepicker widget์ html์ฝ๋๋ฅผ ์ฌ๋ ค๋๋ค.
์ฐธ๊ณ ํด์ ๋์์ด ๋๊ธฐ๋ฅผ...
<div class="datepicker">
<div class="datepicker-days" style="">
<table class="table table-sm">
<thead>
<tr>
<th class="prev" data-action="previous"><span class="fa fa-chevron-left"
title="Previous Month"></span></th>
<th class="picker-switch" data-action="pickerSwitch" colspan="5" title="Select Month">09 2019</th>
<th class="next" data-action="next"><span class="fa fa-chevron-right" title="Next Month"></span>
</th>
</tr>
<tr>
<th class="dow">Sun</th>
<th class="dow">Mon</th>
<th class="dow">Tue</th>
<th class="dow">Wed</th>
<th class="dow">Thu</th>
<th class="dow">Fri</th>
<th class="dow">Sat</th>
</tr>
</thead>
<tbody>
<tr>
<td data-action="selectDay" data-day="09/01/2019" class="day weekend">1</td>
<td data-action="selectDay" data-day="09/02/2019" class="day">2</td>
<td data-action="selectDay" data-day="09/03/2019" class="day">3</td>
<td data-action="selectDay" data-day="09/04/2019" class="day">4</td>
<td data-action="selectDay" data-day="09/05/2019" class="day active today">5</td>
<td data-action="selectDay" data-day="09/06/2019" class="day">6</td>
<td data-action="selectDay" data-day="09/07/2019" class="day weekend">7</td>
</tr>
<tr>
<td data-action="selectDay" data-day="09/08/2019" class="day weekend">8</td>
<td data-action="selectDay" data-day="09/09/2019" class="day">9</td>
<td data-action="selectDay" data-day="09/10/2019" class="day">10</td>
<td data-action="selectDay" data-day="09/11/2019" class="day">11</td>
<td data-action="selectDay" data-day="09/12/2019" class="day">12</td>
<td data-action="selectDay" data-day="09/13/2019" class="day">13</td>
<td data-action="selectDay" data-day="09/14/2019" class="day weekend">14</td>
</tr>
<tr>
<td data-action="selectDay" data-day="09/15/2019" class="day weekend">15</td>
<td data-action="selectDay" data-day="09/16/2019" class="day">16</td>
<td data-action="selectDay" data-day="09/17/2019" class="day">17</td>
<td data-action="selectDay" data-day="09/18/2019" class="day">18</td>
<td data-action="selectDay" data-day="09/19/2019" class="day">19</td>
<td data-action="selectDay" data-day="09/20/2019" class="day">20</td>
<td data-action="selectDay" data-day="09/21/2019" class="day weekend">21</td>
</tr>
<tr>
<td data-action="selectDay" data-day="09/22/2019" class="day weekend">22</td>
<td data-action="selectDay" data-day="09/23/2019" class="day">23</td>
<td data-action="selectDay" data-day="09/24/2019" class="day">24</td>
<td data-action="selectDay" data-day="09/25/2019" class="day">25</td>
<td data-action="selectDay" data-day="09/26/2019" class="day">26</td>
<td data-action="selectDay" data-day="09/27/2019" class="day">27</td>
<td data-action="selectDay" data-day="09/28/2019" class="day weekend">28</td>
</tr>
<tr>
<td data-action="selectDay" data-day="09/29/2019" class="day weekend">29</td>
<td data-action="selectDay" data-day="09/30/2019" class="day">30</td>
<td data-action="selectDay" data-day="10/01/2019" class="day new">1</td>
<td data-action="selectDay" data-day="10/02/2019" class="day new">2</td>
<td data-action="selectDay" data-day="10/03/2019" class="day new">3</td>
<td data-action="selectDay" data-day="10/04/2019" class="day new">4</td>
<td data-action="selectDay" data-day="10/05/2019" class="day new weekend">5</td>
</tr>
<tr>
<td data-action="selectDay" data-day="10/06/2019" class="day new weekend">6</td>
<td data-action="selectDay" data-day="10/07/2019" class="day new">7</td>
<td data-action="selectDay" data-day="10/08/2019" class="day new">8</td>
<td data-action="selectDay" data-day="10/09/2019" class="day new">9</td>
<td data-action="selectDay" data-day="10/10/2019" class="day new">10</td>
<td data-action="selectDay" data-day="10/11/2019" class="day new">11</td>
<td data-action="selectDay" data-day="10/12/2019" class="day new weekend">12</td>
</tr>
</tbody>
</table>
</div>
<div class="datepicker-months" style="display: none;">
<table class="table-condensed">
<thead>
<tr>
<th class="prev" data-action="previous"><span class="fa fa-chevron-left"
title="Previous Year"></span></th>
<th class="picker-switch" data-action="pickerSwitch" colspan="5" title="Select Year">2019</th>
<th class="next" data-action="next"><span class="fa fa-chevron-right" title="Next Year"></span></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7"><span data-action="selectMonth" class="month">Jan</span><span
data-action="selectMonth" class="month">Feb</span><span data-action="selectMonth"
class="month">Mar</span><span data-action="selectMonth" class="month">Apr</span><span
data-action="selectMonth" class="month">May</span><span data-action="selectMonth"
class="month">Jun</span><span data-action="selectMonth" class="month">Jul</span><span
data-action="selectMonth" class="month">Aug</span><span data-action="selectMonth"
class="month active">Sep</span><span data-action="selectMonth" class="month">Oct</span><span
data-action="selectMonth" class="month">Nov</span><span data-action="selectMonth"
class="month">Dec</span></td>
</tr>
</tbody>
</table>
</div>
<div class="datepicker-years" style="display: none;">
<table class="table-condensed">
<thead>
<tr>
<th class="prev" data-action="previous"><span class="fa fa-chevron-left"
title="Previous Decade"></span></th>
<th class="picker-switch" data-action="pickerSwitch" colspan="5" title="Select Decade">2010-2019
</th>
<th class="next" data-action="next"><span class="fa fa-chevron-right" title="Next Decade"></span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7"><span data-action="selectYear" class="year old">2009</span><span
data-action="selectYear" class="year">2010</span><span data-action="selectYear"
class="year">2011</span><span data-action="selectYear" class="year">2012</span><span
data-action="selectYear" class="year">2013</span><span data-action="selectYear"
class="year">2014</span><span data-action="selectYear" class="year">2015</span><span
data-action="selectYear" class="year">2016</span><span data-action="selectYear"
class="year">2017</span><span data-action="selectYear" class="year">2018</span><span
data-action="selectYear" class="year active">2019</span><span data-action="selectYear"
class="year old">2020</span></td>
</tr>
</tbody>
</table>
</div>
<div class="datepicker-decades" style="display: none;">
<table class="table-condensed">
<thead>
<tr>
<th class="prev" data-action="previous"><span class="fa fa-chevron-left"
title="Previous Century"></span></th>
<th class="picker-switch" data-action="pickerSwitch" colspan="5">2000-2090</th>
<th class="next" data-action="next"><span class="fa fa-chevron-right" title="Next Century"></span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7"><span data-action="selectDecade" class="decade old"
data-selection="2006">1990</span><span data-action="selectDecade" class="decade"
data-selection="2006">2000</span><span data-action="selectDecade" class="decade active"
data-selection="2016">2010</span><span data-action="selectDecade" class="decade"
data-selection="2026">2020</span><span data-action="selectDecade" class="decade"
data-selection="2036">2030</span><span data-action="selectDecade" class="decade"
data-selection="2046">2040</span><span data-action="selectDecade" class="decade"
data-selection="2056">2050</span><span data-action="selectDecade" class="decade"
data-selection="2066">2060</span><span data-action="selectDecade" class="decade"
data-selection="2076">2070</span><span data-action="selectDecade" class="decade"
data-selection="2086">2080</span><span data-action="selectDecade" class="decade"
data-selection="2096">2090</span><span data-action="selectDecade" class="decade old"
data-selection="2106">2100</span></td>
</tr>
</tbody>
</table>
</div>
</div>
๋๊ธ