Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 492d106

Browse files
committed
Added between/min/max conditional date validators
Added between/min/max conditional validators on all date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT)
1 parent d1286a1 commit 492d106

File tree

10 files changed

+544
-132
lines changed

10 files changed

+544
-132
lines changed

app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
7373
.addValidator('input11', 'date_us_long|required')
7474
.addValidator('input12', 'time')
7575
.addValidator('select1', 'required')
76-
.addValidator('select2', 'required')
7776
.addValidator({elmName: 'input13', rules: 'min_len:5|max_len:10|alpha_dash_spaces|required', validationErrorTo: ".validation-input13"})
7877
.addValidator('input14', 'alpha|required')
7978
.addValidator('input15', 'alpha|min_len:3|required')
8079
.addValidator('input16', 'match:input15,Password|required')
8180
.addValidator({elmName: 'input17', rules: 'alpha_spaces|exact_len:3|required', debounce: 5000})
81+
.addValidator('input18', 'date_iso_min:1999-12-31|required')
82+
.addValidator('input19', 'date_us_short_between:11/28/99,12/31/15|required')
8283
.addValidator('area1', 'alpha_dash_spaces|min_len:15|required');
8384

8485

change-log.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

changelog.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Angular-Validation change logs
2+
3+
1.1.0 (2014-05-02): only start validating after user inactivity, it could also be passed as an argument for more customization of the inactivity timeout (typing-limit).
4+
1.3.0 (2014-12-01): support to Angular 1.3.x
5+
1.3.1 (2015-01-02): Added Input Match (confirmation) Validator
6+
1.3.2 (2015-01-03): Float number validator to also permit dot (.) as first char. Also removed keyboard blocking of invalid character on input type="number" instead display error message.
7+
1.3.3 (2015-01-04): Updated Bootstrap(3.3.1) and AngularJS(1.3.7) to latest versions
8+
1.3.4 (2015-01-06): Removed the necessity of creating a <span> for displaying the error message, the directive now handles it by itself.
9+
1.3.5 (2015-01-26): Throw an error message when user did not provide a name="" property inside the element to validate.
10+
1.3.6 (2015-02-09): Added ng-strict-di for minification, renamed some files and folder lib to /vendors, moved directive into new /src folder for better separation.
11+
1.3.7 (2015-03-08): Complete rewrite (but same functionality) so that I could add an Angular-Validation Service which is similar implementation as the Directive. Also added `debounce` attribute which is an alias to `typingLimit`, validation rules are now defined as an external service for better maintainability and also created a common file for shared functions by both Validation Directive and Service.
12+
1.3.8 (2015-03-15): Added between/min/max conditional validators on all Date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT)

locales/validation/en.json

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,56 @@
11
{
2-
"INVALID_ALPHA": "May only contain letters. ",
3-
"INVALID_ALPHA_SPACE": "May only contain letters and spaces. ",
4-
"INVALID_ALPHA_NUM": "May only contain letters and numbers. ",
5-
"INVALID_ALPHA_NUM_SPACE": "May only contain letters, numbers and spaces. ",
6-
"INVALID_ALPHA_DASH": "May only contain letters, numbers and dashes. ",
7-
"INVALID_ALPHA_DASH_SPACE": "May only contain letters, numbers, dashes and spaces. ",
8-
"INVALID_BETWEEN_CHAR": "Text must be between :param and :param characters in length. ",
9-
"INVALID_BETWEEN_NUM": "Needs to be a numeric value, between :param and :param. ",
10-
"INVALID_BOOLEAN": "May only contain a true or false value. ",
11-
"INVALID_CREDIT_CARD": "Must be a valid credit card number. ",
12-
"INVALID_DATE_EURO_LONG": "Must be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy). ",
13-
"INVALID_DATE_EURO_SHORT": "Must be a valid date format (dd-mm-yy) OR (dd/mm/yy). ",
14-
"INVALID_DATE_ISO": "Must be a valid date format (yyyy-mm-dd). ",
15-
"INVALID_DATE_US_LONG": "Must be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy). ",
16-
"INVALID_DATE_US_SHORT": "Must be a valid date format (mm/dd/yy) OR (mm-dd-yy). ",
17-
"INVALID_EMAIL": "Must be a valid email address. ",
18-
"INVALID_EXACT_LEN": "Must have a length of exactly :param characters. ",
19-
"INVALID_FLOAT": "May only contain a positive float value (integer excluded). ",
20-
"INVALID_FLOAT_SIGNED": "May only contain a positive or negative float value (integer excluded). ",
21-
"INVALID_IBAN": "Must a valid IBAN. ",
22-
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \":param\". ",
23-
"INVALID_INTEGER": "Must be a positive integer. ",
24-
"INVALID_INTEGER_SIGNED": "Must be a positive or negative integer. ",
25-
"INVALID_IPV4": "Must be a valid IP (IPV4). ",
26-
"INVALID_IPV6": "Must be a valid IP (IPV6). ",
27-
"INVALID_IPV6_HEX": "Must be a valid IP (IPV6 Hex). ",
28-
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type \"number\". ",
29-
"INVALID_MAX_CHAR": "May not be greater than :param characters. ",
30-
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than :param. ",
31-
"INVALID_MIN_CHAR": "Must be at least :param characters. ",
32-
"INVALID_MIN_NUM": "Needs to be a numeric value, equal to, or higher than :param. ",
33-
"INVALID_NUMERIC": "Must be a positive number. ",
34-
"INVALID_NUMERIC_SIGNED": "Must be a positive or negative number. ",
35-
"INVALID_PATTERN": "Must be following this format: :param. ",
36-
"INVALID_REQUIRED": "Field is required. ",
37-
"INVALID_URL": "Must be a valid URL. ",
38-
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",
2+
"INVALID_ALPHA": "May only contain letters. ",
3+
"INVALID_ALPHA_SPACE": "May only contain letters and spaces. ",
4+
"INVALID_ALPHA_NUM": "May only contain letters and numbers. ",
5+
"INVALID_ALPHA_NUM_SPACE": "May only contain letters, numbers and spaces. ",
6+
"INVALID_ALPHA_DASH": "May only contain letters, numbers and dashes. ",
7+
"INVALID_ALPHA_DASH_SPACE": "May only contain letters, numbers, dashes and spaces. ",
8+
"INVALID_BETWEEN_CHAR": "Text must be between :param and :param characters in length. ",
9+
"INVALID_BETWEEN_NUM": "Needs to be a numeric value, between :param and :param. ",
10+
"INVALID_BOOLEAN": "May only contain a true or false value. ",
11+
"INVALID_CREDIT_CARD": "Must be a valid credit card number. ",
12+
"INVALID_DATE_EURO_LONG": "Must be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy). ",
13+
"INVALID_DATE_EURO_LONG_BETWEEN": "Needs to be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy) between :param and :param. ",
14+
"INVALID_DATE_EURO_LONG_MAX": "Needs to be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy), equal to, or lower than :param. ",
15+
"INVALID_DATE_EURO_LONG_MIN": "Needs to be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy), equal to, or higher than :param. ",
16+
"INVALID_DATE_EURO_SHORT": "Must be a valid date format (dd-mm-yy) OR (dd/mm/yy). ",
17+
"INVALID_DATE_EURO_SHORT_BETWEEN": "Needs to be a valid date format (dd-mm-yy) OR (dd/mm/yy) between :param and :param. ",
18+
"INVALID_DATE_EURO_SHORT_MAX": "Needs to be a valid date format (dd-mm-yy) OR (dd/mm/yy), equal to, or lower than :param. ",
19+
"INVALID_DATE_EURO_SHORT_MIN": "Needs to be a valid date format (dd-mm-yy) OR (dd/mm/yy), equal to, or higher than :param. ",
20+
"INVALID_DATE_ISO": "Must be a valid date format (yyyy-mm-dd). ",
21+
"INVALID_DATE_ISO_BETWEEN": "Needs to be a valid date format (yyyy-mm-dd) between :param and :param. ",
22+
"INVALID_DATE_ISO_MAX": "Needs to be a valid date format (yyyy-mm-dd), equal to, or lower than :param. ",
23+
"INVALID_DATE_ISO_MIN": "Needs to be a valid date format (yyyy-mm-dd), equal to, or higher than :param. ",
24+
"INVALID_DATE_US_LONG": "Must be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy). ",
25+
"INVALID_DATE_US_LONG_BETWEEN": "Needs to be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy) between :param and :param. ",
26+
"INVALID_DATE_US_LONG_MAX": "Needs to be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy), equal to, or lower than :param. ",
27+
"INVALID_DATE_US_LONG_MIN": "Needs to be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy), equal to, or higher than :param. ",
28+
"INVALID_DATE_US_SHORT": "Must be a valid date format (mm/dd/yy) OR (mm-dd-yy). ",
29+
"INVALID_DATE_US_SHORT_BETWEEN": "Needs to be a valid date format (mm/dd/yy) OR (mm-dd-yy) between :param and :param. ",
30+
"INVALID_DATE_US_SHORT_MAX": "Needs to be a valid date format (mm/dd/yy) OR (mm-dd-yy), equal to, or lower than :param. ",
31+
"INVALID_DATE_US_SHORT_MIN": "Needs to be a valid date format (mm/dd/yy) OR (mm-dd-yy), equal to, or higher than :param. ",
32+
"INVALID_EMAIL": "Must be a valid email address. ",
33+
"INVALID_EXACT_LEN": "Must have a length of exactly :param characters. ",
34+
"INVALID_FLOAT": "May only contain a positive float value (integer excluded). ",
35+
"INVALID_FLOAT_SIGNED": "May only contain a positive or negative float value (integer excluded). ",
36+
"INVALID_IBAN": "Must a valid IBAN. ",
37+
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \":param\". ",
38+
"INVALID_INTEGER": "Must be a positive integer. ",
39+
"INVALID_INTEGER_SIGNED": "Must be a positive or negative integer. ",
40+
"INVALID_IPV4": "Must be a valid IP (IPV4). ",
41+
"INVALID_IPV6": "Must be a valid IP (IPV6). ",
42+
"INVALID_IPV6_HEX": "Must be a valid IP (IPV6 Hex). ",
43+
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type \"number\". ",
44+
"INVALID_MAX_CHAR": "May not be greater than :param characters. ",
45+
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than :param. ",
46+
"INVALID_MIN_CHAR": "Must be at least :param characters. ",
47+
"INVALID_MIN_NUM": "Needs to be a numeric value, equal to, or higher than :param. ",
48+
"INVALID_NUMERIC": "Must be a positive number. ",
49+
"INVALID_NUMERIC_SIGNED": "Must be a positive or negative number. ",
50+
"INVALID_PATTERN": "Must be following this format: :param. ",
51+
"INVALID_REQUIRED": "Field is required. ",
52+
"INVALID_URL": "Must be a valid URL. ",
53+
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",
3954

4055

4156
"AREA1": "TextArea: Alphanumeric + Minimum(15) + Required",
@@ -48,15 +63,16 @@
4863
"INPUT7": "IP (IPV4)",
4964
"INPUT8": "Credit Card",
5065
"INPUT9": "Between(2,6) Characters",
51-
"INPUT10": "Date ISO (yyyy-mm-dd)",
52-
"INPUT11": "Date US (long)",
66+
"INPUT10": "Date ISO (yyyy-mm-dd)",
67+
"INPUT11": "Date US LONG (mm/dd/yyyy)",
5368
"INPUT12": "Time (hh:mm OR hh:mm:ss) -- NOT Required",
5469
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=\" \"",
5570
"INPUT14": "Alphanumeric + Required -- NG-DISABLED",
5671
"INPUT15": "Password",
5772
"INPUT16": "Password Confirmation",
58-
"INPUT17": "Alphanumeric + Exactly(3) + Required -- debounce(5sec)",
73+
"INPUT17": "Alphanumeric + Exactly(3) + Required -- debounce(5sec)",
74+
"INPUT18": "Date ISO (yyyy-mm-dd) -- minimum condition >= 2001-01-01 ",
75+
"INPUT19": "Date US SHORT (mm/dd/yy) -- between the dates 12/01/99 and 12/31/15",
5976
"SAVE": "Save",
60-
"SELECT1": "Required (select) -- NoEVENT default(keyup) -- Directive will validate has EVENT (blur)",
61-
"SELECT2": "Required (select) -- EVENT (blur)"
77+
"SELECT1": "Required (select) -- validation with (blur) EVENT"
6278
}

0 commit comments

Comments
 (0)