I have a start date [dates are in y-m-d format] (2018-12-23) and an end date(2018-12-31). I want those dates only between the start and end date where the day is Monday,Thursday,Saturday. How can I achieve this using javascript only ?
I have done it in PHP, but I need this in node js.
my PHP code sample is:-
<?php
$startDate = '2018-12-23';
$endDate = '2018-12-31';
for ($i = strtotime($startDate); $i <= strtotime($endDate); $i = strtotime('+1 day', $i)) {
if (date('N', $i) == 1 || date('N', $i) == 2)
echo date('l Y-m-d', $i);
}
?>