Я хочу показать/скрыть строки таблицы в зависимости от дня недели. Код у меня на данный момент показывает/скрывает на основе периодов времени, 24 часа, а не календарных дней:Момент JS диапазон дат
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" id="button1">Monday</button>
<button type="button" id="button2">Tuesday</button>
<table id="myTable">
<thead>
<tr>
<th>Table</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dates">13/02/2017 12:45 pm</td>
</tr>
<tr>
<td class="dates">14/02/2017 12:45 pm</td>
</tr>
</tbody>
$('#button1').click(function(){
var $dates = $('.dates');
var m = moment().add(1, 'd');
$dates.each(function() {
var date = moment($(this).text(), 'DD/MM/YYYY hh:mm a');
if (date.isBetween(moment(), m)) {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
Спасибо, я не знал об этом решении. –