Here is the script I have created to display the working hours:
const workHour = "Monday :9:00AM to 5:00PM,Thursday :9:00AM to 5:00PM,Wednesday :9:00AM to 5:00PM,Tuesday : 9:00AM to 5:00PM,Friday :9:00AM to 5:00PM,Saturday :9:00AM to 5:00PM,Sunday :9:00AM to 5:00PM".split(',').map((val) => {
const obj = val.split(':');
const time = val.replace(`${obj[0]}:`, '');
return {
day: obj[0],
time,
}
});
console.log(workHour);
To display the values on an HTML page, use the following code:
<table class="table">
<thead>
<tr>
<th v-for="(item,key) in data.workHr" :key="key">{{item.day}}</th>
</tr>
</thead>
<tbody>
<tr>
<td v-for="(item,key) in data.workHr" :key="key">{{item.time}}</td>
</tr>
</tbody>
</table>
I successfully displayed the dates and working hours using this code. Now, I am looking for a way to change the color of today's working hours and automatically update it for tomorrow. Can anyone provide assistance with solving this issue?