@tiledesk/tiledesk-server 2.9.5 → 2.9.6
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -209,7 +209,6 @@ class OperatingHoursService {
|
|
209
209
|
}
|
210
210
|
|
211
211
|
let timeSlot = project.timeSlots[slot_id];
|
212
|
-
console.log("timeSlot: ", timeSlot);
|
213
212
|
|
214
213
|
if (!timeSlot) {
|
215
214
|
callback(null, { errorCode: 1030, msg: 'Slot not found with id ' + slot_id })
|
@@ -233,17 +232,18 @@ class OperatingHoursService {
|
|
233
232
|
|
234
233
|
// Get the current time in the specified timezone
|
235
234
|
const currentTime = moment_tz.tz(tzname);
|
236
|
-
const currentWeekday = currentTime.isoWeekday();
|
237
235
|
|
236
|
+
const currentWeekday = currentTime.isoWeekday();
|
238
237
|
const daySlots = hours[currentWeekday];
|
239
238
|
if (!daySlots) {
|
240
239
|
callback(false, null)
|
240
|
+
return;
|
241
241
|
}
|
242
242
|
|
243
243
|
let promises = [];
|
244
244
|
|
245
245
|
daySlots.forEach((slot) => {
|
246
|
-
promises.push(slotCheck(currentTime, slot))
|
246
|
+
promises.push(slotCheck(currentTime, tzname, slot))
|
247
247
|
})
|
248
248
|
|
249
249
|
await Promise.all(promises).then((resp) => {
|
@@ -258,11 +258,11 @@ class OperatingHoursService {
|
|
258
258
|
}
|
259
259
|
}
|
260
260
|
|
261
|
-
function slotCheck(currentTime, slot) {
|
261
|
+
function slotCheck(currentTime, tzname, slot) {
|
262
262
|
return new Promise((resolve) => {
|
263
263
|
|
264
|
-
const startTime = moment_tz(slot.start, 'HH:mm');
|
265
|
-
const endTime = moment_tz(slot.end, 'HH:mm');
|
264
|
+
const startTime = moment_tz.tz(slot.start, 'HH:mm', tzname);
|
265
|
+
const endTime = moment_tz.tz(slot.end, 'HH:mm', tzname);
|
266
266
|
|
267
267
|
if (currentTime.isBetween(startTime, endTime, null, '[)')) {
|
268
268
|
resolve(true)
|