GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 9950db...730c62 )
by
unknown
03:18
created

Date.rangePicker   B

Complexity

Conditions 2

Size

Total Lines 74
Code Lines 61

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 61
dl 0
loc 74
rs 8.2763
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/**
2
 * This file is part of the O2System Venus UI Framework package.
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @author         Steeve Andrian Salim
8
 * @copyright      Copyright (c) Steeve Andrian Salim
9
 */
10
// ------------------------------------------------------------------------
11
12
import * as $ from 'jquery';
13
import * as moment from 'moment';
14
import 'bootstrap-datepicker';
15
import 'bootstrap-daterangepicker';
16
17
/**
18
 * Class Date
19
 * 
20
 * @author          Teguh Rianto
21
 * @package         Components/Input
22
 */
23
export default class Date {
24
    constructor() {
25
        /**
26
         * Initiate basic date picker
27
         */
28
        this.basicPicker();
29
30
        /**
31
         * Initiate range date picker
32
         */
33
        this.rangePicker();
34
    }
35
36
    // ------------------------------------------------------------------------
37
38
    /**
39
     * Date.basicPicker
40
     */
41
    basicPicker() {
42
        // Date Picker
43
        $('.datepicker').datepicker();
44
        $('.datepicker-autoclose').datepicker({
45
            autoclose: true,
46
            todayHighlight: true
47
        });
48
        $('.datepicker-inline').datepicker();
49
        $('.datepicker-multiple-date').datepicker({
50
            format: "mm/dd/yyyy",
51
            clearBtn: true,
52
            multidate: true,
53
            multidateSeparator: ","
54
        });
55
        $('.date-range').datepicker({
56
            toggleActive: true
57
        });
58
    }
59
60
    // ------------------------------------------------------------------------
61
62
    /**
63
     * Date.rangePicker
64
     */
65
    rangePicker(){
66
        //Date range picker
67
        $('.input-daterange-datepicker').daterangepicker({
68
            buttonClasses: ['btn', 'btn-sm'],
69
            applyClass: 'btn-success',
70
            cancelClass: 'btn-light'
71
        });
72
        $('.input-daterange-timepicker').daterangepicker({
73
            timePicker: true,
74
            timePickerIncrement: 30,
75
            locale: {
76
                format: 'MM/DD/YYYY h:mm A'
77
            },
78
            buttonClasses: ['btn', 'btn-sm'],
79
            applyClass: 'btn-success',
80
            cancelClass: 'btn-light'
81
        });
82
        $('.input-limit-datepicker').daterangepicker({
83
            format: 'MM/DD/YYYY',
84
            minDate: '06/01/2018',
85
            maxDate: '06/30/2018',
86
            buttonClasses: ['btn', 'btn-sm'],
87
            applyClass: 'btn-success',
88
            cancelClass: 'btn-light',
89
            dateLimit: {
90
                days: 6
91
            }
92
        });
93
94
        $('.reportrange span').html(moment().subtract(29, 'days').format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY'));
95
96
        $('.reportrange').daterangepicker({
97
            format: 'MM/DD/YYYY',
98
            startDate: moment().subtract(29, 'days'),
99
            endDate: moment(),
100
            minDate: '01/01/2017',
101
            maxDate: '12/31/2020',
102
            dateLimit: {
103
                days: 60
104
            },
105
            showDropdowns: true,
106
            showWeekNumbers: false,
107
            timePicker: false,
108
            timePickerIncrement: 1,
109
            timePicker12Hour: true,
110
            ranges: {
111
                'Today': [moment(), moment()],
112
                'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
113
                'Last 7 Days': [moment().subtract(6, 'days'), moment()],
114
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
115
                'This Month': [moment().startOf('month'), moment().endOf('month')],
116
                'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
117
            },
118
            opens: 'left',
119
            drops: 'down',
120
            buttonClasses: ['btn', 'btn-sm'],
121
            applyClass: 'btn-success',
122
            cancelClass: 'btn-light',
123
            separator: ' to ',
124
            locale: {
125
                applyLabel: 'Submit',
126
                cancelLabel: 'Cancel',
127
                fromLabel: 'From',
128
                toLabel: 'To',
129
                customRangeLabel: 'Custom',
130
                daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
131
                monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
132
                firstDay: 1
133
            }
134
        }, function (start, end, label) {
135
            console.log(start.toISOString(), end.toISOString(), label);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
136
            $('.reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
137
        });
138
    }
139
}