ingeni-validation 1.1.6 → 1.1.7
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 +24 -1
- package/package.json +1 -1
package/ingeni-validation.js
CHANGED
|
@@ -275,6 +275,28 @@ async function isValidDate(value, format) {
|
|
|
275
275
|
|
|
276
276
|
|
|
277
277
|
|
|
278
|
+
|
|
279
|
+
//Validate Time (hh:mm:ss or hh:mm)
|
|
280
|
+
|
|
281
|
+
async function isValidTime(value){
|
|
282
|
+
|
|
283
|
+
if (value === null || value === undefined) return false;
|
|
284
|
+
|
|
285
|
+
if (typeof value === "boolean") return false;
|
|
286
|
+
|
|
287
|
+
if (typeof value !== "string") return false;
|
|
288
|
+
|
|
289
|
+
if (value.length === 0) return false;
|
|
290
|
+
|
|
291
|
+
// reject spaces anywhere
|
|
292
|
+
if (value.includes(" ")) return false;
|
|
293
|
+
|
|
294
|
+
const regex = /^([01][0-9]|2[0-3]):([0-5][0-9])(:([0-5][0-9]))?$/;
|
|
295
|
+
|
|
296
|
+
return regex.test(value);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
278
300
|
//Validate Price
|
|
279
301
|
|
|
280
302
|
async function isValidPrice(price){
|
|
@@ -288,4 +310,5 @@ async function isValidDate(value, format) {
|
|
|
288
310
|
|
|
289
311
|
|
|
290
312
|
|
|
291
|
-
|
|
313
|
+
|
|
314
|
+
export {validateMandate,validateOptional,isValidMobile,isValidEmail,isValidOtp,isValidPin,isValidNumber,isValidBoolean,checkBooleanParams,isValidDate,isValidTime,isValidPrice};
|