Skip to content
Snippets Groups Projects
Unverified Commit f23e4f6c authored by Kevin Aleman's avatar Kevin Aleman Committed by GitHub
Browse files

fix: Take seconds to assess if BH is open/closed (#29558)

parent f38211af
No related branches found
No related tags found
No related merge requests found
---
"@rocket.chat/meteor": patch
---
Fixed Business Hours behavior so they now Take seconds in consideration to assess if BH is open/closed
......@@ -8,7 +8,7 @@ import { createDefaultBusinessHourRow } from './LivechatBusinessHours';
export const filterBusinessHoursThatMustBeOpened = async (
businessHours: ILivechatBusinessHour[],
): Promise<Pick<ILivechatBusinessHour, '_id' | 'type'>[]> => {
const currentTime = moment(moment().format('dddd:HH:mm'), 'dddd:HH:mm');
const currentTime = moment(moment().format('dddd:HH:mm:ss'), 'dddd:HH:mm:ss');
return businessHours
.filter(
......@@ -17,9 +17,9 @@ export const filterBusinessHoursThatMustBeOpened = async (
businessHour.workHours
.filter((hour) => hour.open)
.some((hour) => {
const localTimeStart = moment(`${hour.start.cron.dayOfWeek}:${hour.start.cron.time}`, 'dddd:HH:mm');
const localTimeFinish = moment(`${hour.finish.cron.dayOfWeek}:${hour.finish.cron.time}`, 'dddd:HH:mm');
return currentTime.isSameOrAfter(localTimeStart) && currentTime.isSameOrBefore(localTimeFinish);
const localTimeStart = moment(`${hour.start.cron.dayOfWeek}:${hour.start.cron.time}:00`, 'dddd:HH:mm:ss');
const localTimeFinish = moment(`${hour.finish.cron.dayOfWeek}:${hour.finish.cron.time}:00`, 'dddd:HH:mm:ss');
return currentTime.isSameOrAfter(localTimeStart) && currentTime.isBefore(localTimeFinish);
}),
)
.map((businessHour) => ({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment