Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery daterangepicker using moment

  $(document).ready(function () {
         $('input[name="ETDsdt"]').daterangepicker({
            format: 'MM/DD/YYYY',
            singleDatePicker: false,
            showDropdowns: true,
            ranges: {
                'Today': [moment(), moment()],
                'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                'This Month': [moment().startOf('month'), moment().endOf('month')]

            },
         },
            function (start, end, label) {
                $('#ETDsdt').val(start.format('MM/DD/YYYY'));
                $('#ETDedt').val(end.format('MM/DD/YYYY'));
           }
        );
    });
Source by edwindeloso.com #
 
PREVIOUS NEXT
Tagged: #jquery #daterangepicker #moment
ADD COMMENT
Topic
Name
3+8 =