@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
@@ -5,6 +5,9 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.9.6
9
+ - Fix bug: wrong timzone in startTime and andTime in operating hours service
10
+
8
11
  # 2.9.5
9
12
  - Added raw option in /users/availables
10
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.9.5",
4
+ "version": "2.9.6",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -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)