ingeni-validation 1.1.8 → 1.1.10
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/ingeni-validation.js +9 -6
- package/package.json +1 -1
package/ingeni-validation.js
CHANGED
|
@@ -310,7 +310,7 @@ async function isValidDate(value, format) {
|
|
|
310
310
|
|
|
311
311
|
//Stop details Validation "stop_details":[{"30":["Baripada","13:00","13:01","21.9319,86.7465"]}]
|
|
312
312
|
|
|
313
|
-
|
|
313
|
+
async function isValidStopDetails(stop_details){
|
|
314
314
|
|
|
315
315
|
if (!Array.isArray(stop_details) || stop_details.length === 0){
|
|
316
316
|
return false;
|
|
@@ -362,13 +362,17 @@ async function isValidDate(value, format) {
|
|
|
362
362
|
return false;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
// arrival must be
|
|
366
|
-
if (toMinutes(arrival_time)
|
|
365
|
+
// arrival must be <= departure
|
|
366
|
+
if (toMinutes(arrival_time) > toMinutes(departure_time)){
|
|
367
367
|
return false;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
//
|
|
371
|
-
if (typeof latlong !== "string" ||
|
|
370
|
+
// coordinates mandatory
|
|
371
|
+
if (typeof latlong !== "string" || latlong.trim().length === 0){
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (!latlongRegex.test(latlong)){
|
|
372
376
|
return false;
|
|
373
377
|
}
|
|
374
378
|
|
|
@@ -376,7 +380,6 @@ async function isValidDate(value, format) {
|
|
|
376
380
|
|
|
377
381
|
if (lat < -90 || lat > 90) return false;
|
|
378
382
|
if (lon < -180 || lon > 180) return false;
|
|
379
|
-
|
|
380
383
|
}
|
|
381
384
|
|
|
382
385
|
return true;
|