Просмотр исходного кода

Bug fixing for working hours

master
Nikola Ignjatovic 4 лет назад
Родитель
Сommit
d0e930b7bd
1 измененных файлов: 7 добавлений и 4 удалений
  1. 7
    4
      src/helpers/GetTodaysWorkingHours.js

+ 7
- 4
src/helpers/GetTodaysWorkingHours.js Просмотреть файл



export default function getHours(officeHours) { export default function getHours(officeHours) {
var day = new Date().getDay(); var day = new Date().getDay();
var value = null;
if(officeHours === undefined && officeHours.length < 3 ){ if(officeHours === undefined && officeHours.length < 3 ){
return null;
value = null;
} }
else if(day === Saturday){ else if(day === Saturday){
return officeHours[SaturdayType].hours;
value = officeHours[SaturdayType];
} }
else if(day === Sunday){ else if(day === Sunday){
return officeHours[SundayType].hours;
value = officeHours[SundayType];
} }
else { else {
return officeHours[WorkingDayType].hours;
value = officeHours[WorkingDayType];
} }

return value !== null && value !==undefined ? value.hours: null ;
} }

Загрузка…
Отмена
Сохранить