๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Lect & Tip/bootstrap

๋ถ€ํŠธ์ŠคํŠธ๋žฉ4 ๋ฐ์ดํŠธํ”ผ์ปค datepicker ์ด๋ฒคํŠธ ๊ฐ€๋กœ์ฑ„๊ธฐ

by ๋‚ฏ์„ ๊ณต๊ฐ„2019 2019. 9. 27.

๋ชฉ์ฐจ

    ๋ถ€ํŠธ์ŠคํŠธ๋žฉ4 ๋ฐ์ดํŠธํ”ผ์ปค๋ถ€ํŠธ์ŠคํŠธ๋žฉ4 ๋ฐ์ดํŠธํ”ผ์ปค datepicker ์ด๋ฒคํŠธ ๊ฐ€๋กœ์ฑ„๊ธฐ

    ํ”Œ๋Ÿฌ๊ทธ์ธ ์ž์ฒด์—์„œ ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œ์ผœ ์ฃผ์ง€๋งŒ, ๋”ฑ ๋‚ด๊ฐ€ ์›ํ•˜๋˜๊ฒŒ ์•„๋‹ˆ์–ด์„œ ์ง์ ‘ ์†Œ์Šค๋ฅผ ๊ฑด๋“œ๋ ธ๋‹ค.

    https://tempusdominus.github.io/bootstrap-4/Events/

     

    Events - Tempus Dominus - Bootstrap 4

    Events Events hide.datetimepicker Fired when the widget is hidden. Parameters: e = { date //the currently set date. Type: moment object (clone) } Emitted from: toggle() hide() disable() show.datetimepicker Fired when the widget is shown. Parameters: No par

    tempusdominus.github.io

    ์›๋ž˜๋Œ€๋กœ๋ผ๋ฉด 

    <script>
    $('#datetimepicker1').on('change.datetimepicker', function (e) {
        $('.timeBtn ').removeClass('active');
    });
    </script>

    ์œ„์™€ ๊ฐ™์ด ์ฝ”๋”ฉํ•˜๋ฉด ๊ฐ„๋‹จํ•œ ์ผ์ด๋‹ค.

    ํ•˜์ง€๋งŒ, datepicker๊ฐ€ ์ดˆ๊ธฐ ๊ฐ’์ด ์—†๋˜ ์ƒํƒœ๊ธฐ ๋•Œ๋ฌธ์—, ์‹ค์งˆ์ ์œผ๋กœ๋Š” shown๊ณผ ํ•จ๊ป˜ change์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•ด๋ฒ„๋ฆฌ๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค.

    ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š๋ƒ, ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์„ ์“ฐ๋Š๋ƒ์˜ ์ฐจ์ด๊ฐ€ ์žˆ๊ธด ํ–ˆ๋‹ค.

    2019/09/05 - [Lect & Tip/bootstrap] - bootstrap4 datepicker tempusdominus style css ์ˆ˜์ •์„ ์œ„ํ•œ ๋‹ฌ๋ ฅ element dom class

    2256line selectDay

                  case "selectDay":
                    var k = this._viewDate.clone();
                    // datepicker๊ฐ€ ์ƒˆ ๋‚ ์งœ๋ฅผ ์„ ํƒํ•˜๋Š” ์ˆœ๊ฐ„ time button์˜ active ํด๋ž˜์Šค๋ฅผ ์ œ๊ฑฐํ•จ.
                    $('.timeBtn ').removeClass('active'); //chj
                    e(a.target).is(".old") && k.subtract(1, "M"),
                      e(a.target).is(".new") && k.add(1, "M"),
                      this._setValue(
                        k.date(parseInt(e(a.target).text(), 10)),
                        this._getLastPickedDateIndex()
                      ),
                      this._hasTime() ||
                      this._options.keepOpen ||
                      this._options.inline ||
                      this.hide();
                    break;

    datepicker์—์„œ ๋‚ ์งœ๋ฅผ ์„ ํƒํ•˜๋ฉด ๋‹ค๋ฅธ ์—˜๋Ÿฌ๋จผํŠธ์ธ ์˜ ์Šคํƒ€์ผ ์†์„ฑ์„ ๋ณ€๊ฒฝํ•จ.

    ๋ฐ˜์‘ํ˜•

    ๋Œ“๊ธ€