小编Mit*_*tel的帖子

在 daterangepicker 中更改日期格式

我正在使用日期范围选择器 jQuery。我需要更改开始、结束和标题日期格式。这是我到目前为止所尝试的。

$('#from-todate').daterangepicker({
    ranges: {
    "setDate": new Date(),
    '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')],
    'Last 6 Month': [moment().subtract(6, 'month').startOf('month'), moment().subtract(6, 'month').endOf('month')],
    'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
            "alwaysShowCalendars": true,
            "opens": "left",
            "applyClass": "btn-primary",
            "cancelClass": "hide-btn",
            "startDate": monthStartDate,
            "endDate": todaysdate,
            "maxDate": todaysdate,

}, function (start, end, label) {

    SetDates(start.format('YYYY-MM-DD'), end.format('YYYY-MM-DD'));
    console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to …
Run Code Online (Sandbox Code Playgroud)

jquery

3
推荐指数
1
解决办法
6904
查看次数

标签 统计

jquery ×1