Create Date list bar (horizontal list) in React/React Native with moment library
sometimes you may need create horizontal date list to show to user..and block required dates. i had to create date bar in my work place. so this is how i solved that using moment library . import moment from "moment"; //run function in component did mount.. setInitialDate() { const tomorrowDate = moment().add(1, 'days').format("YYYY-MM-DD"); const todayDate = moment().format("YYYY-MM-DD"); const todayName = moment().format('dddd'); //TODO: get blocked dates from backend const blockedDays =['2020-06-04','2020-06-05','2020-06-06','2020-06-07']; let dateList = []; //if need to remove weekend day you can add like this //this code part using to for set 'today' date if ((!(todayName == 'Sunday' || todayName == 'Saturday')) && moment().isBefore(moment("17:00", 'HH:mm'))) ...