In my code snippet, moment js is not giving the expected result.
weekStart is set to start of the week (ie 19th Jul ) and weekEnd is set to end of the week (ie. 25th Jul).
while printing individually both are printing the correct dates, but when it is used from an array(validRange), weekStart is printing 25th Jul instead of 19th Jul.
Is there any solution for this? what could be the reason?.
const today = moment() // let take today is 22 July 2020
const weekStart = today.startOf('week'); // 19th
console.log(weekStart.toString()); // Sun Jul 19 2020 00:00:00 GMT+0530
const weekEnd = today.endOf('week'); // 25th
console.log(weekEnd.toString()); // Sat Jul 25 2020 23:59:59 GMT+0530
const validRange = [weekStart,weekEnd]; // should be an array
console.log(validRange.map(item =>item.toString())); // ["Sat Jul 25 2020 23:59:59 GMT+0530", "Sat Jul 25 2020 23:59:59 GMT+0530"]
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
