You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on getting the new getGroupedRanges() feature preparsed so i can use it via GraphQL I saw that all dates returned by the plugin are using today as the date.
For anyone trying to solve this with Javascript, this is what i came up with:
exportinterfaceGroupedOpeningHour{days: Array<number>;firstDay: number;lastDay: number;open: string;close: string;}functionopeningHoursGrouped(openingHours: OpeningHours_Day[]){constresult: Array<GroupedOpeningHour>=[];// move sunday at the end of arrayconstsunday=openingHours.shift();if(sunday){openingHours.push(sunday);}openingHours.forEach((day,index)=>{constdayOfWeek=index+1;constlastEntry=result[result.length-1];if(lastEntry&&lastEntry.open===day?.open&&lastEntry.close===day?.close&&lastEntry.days[lastEntry.days.length-1]===index){lastEntry.days.push(dayOfWeek);lastEntry.lastDay=dayOfWeek;}else{result.push({days: [dayOfWeek],firstDay: dayOfWeek,lastDay: dayOfWeek,open: day?.open,close: day?.close});}});returnresult;}
Description
While working on getting the new
getGroupedRanges()
feature preparsed so i can use it via GraphQL I saw that all dates returned by the plugin are using today as the date.For example given this template:
i get the following result:
while the groups are all correct, there is no way to see which day of the weeks the timeslots are refering to.
I tested this via GraphQL as well:
results in:
Is there no way to get the "day of the week" as an int in the same result without having to call the
getMon()
/getTue()
functions?Additional info
The text was updated successfully, but these errors were encountered: