I need some help displaying the next available day for delivery based on when a user places an order and what day/s they are eligible to receive an order.
I also need some help disabling/filtering all week days except the delivery day and future delivery day a user is eligible for.
I am using React, React-Datepicker, MomentJS and auth0.
The problem is that a company's delivery trucks go to certain locations on certain days. On Mondays they go to Location 1 and on Tuesdays they go to Location 2 for example.
When getting a new client (aka user) they assign a day/s to that user. So if UserA is located in Location 1 they will be assigned to Mondays and if UserB is located in Location 2 they will be assigned to Tuesdays for example.
This data I get from auth0's user_metadata. So I got data coming in.
I searched and researched and found this post on stackoverflow: https://stackoverflow.com/questions/34979051/find-next-instance-of-a-given-weekday-ie-monday-with-moment-js#:~:text=In%20a%20nutshell%2C%20you%20want,day(1)%20.
It allows me to get the next available day based on the day the user orders.
But I am having trouble figuring out how to apply this to display the message dynamically. Meaning UserA will see information about delivery day based on his data and UserB will see information about delivery day based on his data.
Another problem is that I can filter the weekends using react-datepicker but I don't know how to apply these momentjs functions to react-datepicker for each user.
I created a codesandbox with my progress (not a lot of progress) and I created two users but am stuck.
https://codesandbox.io/embed/dry-violet-trjrq?codemirror=1
Please let me know if I need to provide more information or post the question better.
Here is the link to the github repo if that helps (linking to component where codesandbox code will go):
https://github.com/Chizzah/core-water/blob/master/src/components/tableContainer/tableView.js
Thanks in advance for any help or guidance.