From 3a6afcfbb6f1dc3b45c5699701000acf2086e48a Mon Sep 17 00:00:00 2001 From: Ramez Rafla Date: Sun, 25 Jun 2017 01:37:10 -0400 Subject: [PATCH] Added 'date' form validation --- src/definitions/modules/calendar.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/definitions/modules/calendar.js b/src/definitions/modules/calendar.js index cef8747..1a979e8 100644 --- a/src/definitions/modules/calendar.js +++ b/src/definitions/modules/calendar.js @@ -19,6 +19,12 @@ : Function('return this')() ; + // form validation for type 'date' + // note that Semantic passes the date as it's shown as a string, so we have to convert to date to validate + $.fn.form.settings.rules.date = function(value) { + return value && typeof value == "string" && value.length > 6 && !isNaN(new Date(value).getTime()); + } + $.fn.calendar = function (parameters) { var