あなたは日付を取得するために、日付範囲ピッカーを使用していると仮定。あなたはあなたが望むものを得るために何かをすることができます。
$('#daterange-btn').daterangepicker({
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')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
startDate: moment().subtract(29, 'days'),
endDate: moment()
}, function (start, end) {
alert('Date is between' + start.format('YYYY-MM-DD h:m') + 'and' + end.format('YYYY-MM-DD h:m')}
[Moment JSの開始日と終了日]の複製が可能です(http://stackoverflow.com/questions/26131003/moment-js-start-and-end-of-given-month) –
Moment.js月の最初と最後の日を取得する機能をサポートするあなたは、現在の月のそれを、moment()。startOf( 'month')とmoment()。endOf( 'month')で得ることができます。 あなたは[this](http://stackoverflow.com/questions/26131003/moment-js-start-and-end-of-given-month)から回答を見るべきだと思います –
@TanLeはい、これは'Thu Sep 01 2016 00:00:00 GMT + 0100(GMTサマータイム)'私の質問で言及したようなフォーマットが欲しい – user3574492