如何在日期范围选择器中获取开始日期?

时间:2015-07-28 03:29:15

标签: daterangepicker

enter image description here

如何在图片中获取开始日期。

是这样的吗?

date:$('#reservation')daterangepicker.val.startDate()

这是表格

<form id="form4">
                <div class="modal-body">
                    <div class="form-group">
                        <label>Date range:</label>
                        <div class="input-group">
                            <div class="input-group-addon">
                                <i class="fa fa-calendar"></i>
                            </div>
                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                            <input type="text" class="form-control pull-right" id="reservation" name="reservation"/>

                        </div><!-- /.input group -->
                    </div><!-- /.form group -->
                </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove"></i> <span>Close</span></button>
                        <button type="submit" type="button" class="btn btn-outline"><i class="fa fa-check"></i> <span>Search</span></button>
                    </div>
                </form>

这是ajax

<script type="text/javascript">
    $(function () {
        //Datemask dd/mm/yyyy
        $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "dd/mm/yyyy"});
        //Date range picker
        $('#reservation').daterangepicker();

    });
    $("#form4").submit(function(){
        $("#submit").prop('disabled', true);
        $.ajax({
            url:'{{ url('dashboard/add1') }}',
            type: 'get',
            data: {date:$('#reservation').daterangepicker.val.startDate()},
            dataType:"json",
            success: function(data){
                if(!data.success)
                {
                    alert('failed');
                }
                else
                {
                    alert('success');
                }
            }
        });
        return false;
    });
</script>

任何回复都将不胜感激。谢谢。 无法在互联网上找到任何关于此的来源。我希望有可能。

1 个答案:

答案 0 :(得分:0)

我把它切成片

id =保留价值=&#34; 2015-05-06,2015-05-26&#34;

.bashrc

startDate给出:2015-05-06 00:00:00

endDate给出:2015-05-26 23:59:59