I have a model in my database that contains an array called "AvailableDays" [0...6]. 0 = Sunday & 6 = Saturday. I am looking to convert this day number of the week to the date of day in the current week.
For example, this is the logic broken down
- Retrieve the list of available days (
const availableDays = [0,2,4,6]
) - Get the current DATE (
const today = new Date('2021-08-20');
) - Covert day numbers to dates (
output =['15-08-2021', '17-08-2021', '19-08-2021', '21-08-2021']
)