javascript, JQuery

[Jquery] anypicker

cattaku 2020. 4. 13. 15:50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ==============================
* anypicker 함수 (년월일)
* ============================== */
$.fn.dateAnyPicker = function(option){
      var maxDate,minDate ;
      var el = $(this);
      if(!option.maxDate) maxDate = false;
      else maxDate = new Date(option.maxDate[0],option.maxDate[1],2);
      if(!option.minDate) minDate = false;
      else minDate = new Date(option.minDate[0],option.minDate[1],2);
      
      $(this).AnyPicker({
        mode: "datetime",
        dateTimeFormat: option.format,
        minValue: minDate,
        maxValue: maxDate,
        buttonClicked : function(){
            $("section").removeClass('dim-on');
        },
        parseInput:function(sElemValue)
        {
            console.log("test",new Date(sElemValue));
            this.setSelectedDate(new Date(sElemValue));
            $("section").addClass('dim-on');
            return sElemValue;
        },
        setOutput: function(dateTxt){
            el.val(dateTxt);
            option.onChange();
            return dateTxt;
        },
        viewSections:
        {
          header: ["headerTitle"],
          contentTop: [],
          contentBottom: [],
          footer: ["setButton""cancelButton"]
        },
        i18n:
        {
          setButton: "확인",
          cancelButton : "취소"
        },
        headerTitle:
          {
            markup: "<span class='ap-header__title02'>날짜선택</span>"
            // type: "Text",
            // contentBehaviour: "Static",
            // format: ""
          }
      });
    }