tripstorekrabi-shared 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils.js +8 -4
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -404,7 +404,7 @@ export function getItemSummary(item, product) {
|
|
|
404
404
|
return summary;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
export function validateSchedule(schedule, schedules = []) {
|
|
407
|
+
export function validateSchedule(schedule, schedules = [], boolean = false, context) {
|
|
408
408
|
if (schedule === "?") {
|
|
409
409
|
return true;
|
|
410
410
|
} else if (schedule.indexOf(" - ") != -1) {
|
|
@@ -413,16 +413,20 @@ export function validateSchedule(schedule, schedules = []) {
|
|
|
413
413
|
var to = times[1];
|
|
414
414
|
|
|
415
415
|
if (!SCHEDULE_PATTERN.test(from) || !SCHEDULE_PATTERN.test(to) || (from === to)) {
|
|
416
|
-
return "Invalid schedule format: for example use '09:00 - 15:30'";
|
|
416
|
+
return boolean ? false : "Invalid schedule format: for example use '09:00 - 15:30'";
|
|
417
417
|
}
|
|
418
418
|
} else {
|
|
419
|
-
return "Invalid schedule format: for example use '09:00 - 15:30'";
|
|
419
|
+
return boolean ? false : "Invalid schedule format: for example use '09:00 - 15:30'";
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
|
|
423
423
|
if (schedule != "") {
|
|
424
424
|
if (schedules.length > 0 && schedules.indexOf(schedule) == -1) {
|
|
425
|
-
return {
|
|
425
|
+
return context.createError({
|
|
426
|
+
message: "The value does not match the product schedules",
|
|
427
|
+
path: context.path,
|
|
428
|
+
params: { status: "warning" },
|
|
429
|
+
});
|
|
426
430
|
}
|
|
427
431
|
}
|
|
428
432
|
|