Skip to content

Commit

Permalink
- eurodate doesn't event work in ACF/Lucee as it uses just a single…
Browse files Browse the repository at this point in the history
… standard. Remove it so the user can validate as they see fit.
  • Loading branch information
lmajano committed Feb 19, 2025
1 parent acea8c1 commit 8c4707b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed

- `eurodate` doesn't event work in ACF/Lucee as it uses just a single standard. Remove it so the user can validate as they see fit.

### Added

- BoxLang certification
Expand Down
2 changes: 1 addition & 1 deletion models/ValidationManager.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* // required or not
* required : boolean [false]
* // type constraint
* type : (ssn,email,url,alpha,boolean,date,usdate,eurodate,numeric,GUID,UUID,integer,[string],telephone,zipcode,ipaddress,creditcard,binary,component,query,struct,json,xml),
* type : (ssn,email,url,alpha,boolean,date,usdate,numeric,GUID,UUID,integer,[string],telephone,zipcode,ipaddress,creditcard,binary,component,query,struct,json,xml),
* // size or length of the value (struct,string,array,query)
* size : numeric or range, eg: 10 or 6..8
* // range is a range of values the property value should exist in
Expand Down
6 changes: 1 addition & 5 deletions models/validators/TypeValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ component extends="BaseValidator" accessors="true" singleton {
*/
TypeValidator function init(){
variables.name = "Type";
variables.validTypes = "alpha,array,binary,boolean,component,creditcard,date,email,eurodate,float,GUID,integer,ipaddress,json,numeric,query,ssn,string,struct,telephone,url,usdate,UUID,xml,zipcode";
variables.validTypes = "alpha,array,binary,boolean,component,creditcard,date,email,float,GUID,integer,ipaddress,json,numeric,query,ssn,string,struct,telephone,url,usdate,UUID,xml,zipcode";

return this;
}
Expand Down Expand Up @@ -83,10 +83,6 @@ component extends="BaseValidator" accessors="true" singleton {
r = isValid( "usdate", arguments.targetValue );
break;
}
case "eurodate": {
r = isValid( "eurodate", arguments.targetValue );
break;
}
case "numeric": {
r = isValid( "numeric", arguments.targetValue );
break;
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ this.constraints = {
size : numeric or range, eg: 10 or 6..8

// specific type constraint, one in the list.
type : (alpha,array,binary,boolean,component,creditcard,date,email,eurodate,float,GUID,integer,ipaddress,json,numeric,query,ssn,string,struct,telephone,url,usdate,UUID,xml,zipcode),
type : (alpha,array,binary,boolean,component,creditcard,date,email,float,GUID,integer,ipaddress,json,numeric,query,ssn,string,struct,telephone,url,usdate,UUID,xml,zipcode),

// UDF to use for validation, must return boolean accept the incoming value and target object, validate(value,target):boolean
udf = variables.UDF or this.UDF or a closure.
Expand Down
12 changes: 6 additions & 6 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name":"cbvalidation-adobe@2023",
"app":{
"serverHomeDirectory":".engine/adobe2023",
"cfengine":"adobe@2023.0.0-beta.1"
"cfengine":"adobe@2023"
},
"web":{
"http":{
Expand All @@ -11,19 +11,19 @@
"rewrites":{
"enable":"true"
},
"webroot": "test-harness",
"aliases":{
"/moduleroot/cbvalidation":"../"
"webroot":"test-harness",
"aliases":{
"/moduleroot/cbvalidation":"./"
}
},
"jvm":{
"jvm":{
"heapSize":"1024"
},
"openBrowser":"false",
"cfconfig": {
"file" : ".cfconfig.json"
},
"scripts" : {
"scripts" : {
"onServerInstall":"cfpm install zip,debugger"
}
}
2 changes: 1 addition & 1 deletion test-harness/tests/resources/ValidationManager.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* // required or not
* required : boolean [false]
* // type constraint
* type : (ssn,email,url,alpha,boolean,date,usdate,eurodate,numeric,GUID,UUID,integer,[string],telephone,zipcode,ipaddress,creditcard,binary,component,query,struct,json,xml),
* type : (ssn,email,url,alpha,boolean,date,usdate,numeric,GUID,UUID,integer,[string],telephone,zipcode,ipaddress,creditcard,binary,component,query,struct,json,xml),
* // size or length of the value (struct,string,array,query)
* size : numeric or range, eg: 10 or 6..8
* // range is a range of values the property value should exist in
Expand Down
6 changes: 0 additions & 6 deletions test-harness/tests/specs/validators/TypeValidatorTest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ component extends="coldbox.system.testing.BaseModelTest" model="cbvalidation.mod
r = model.validate( result, this, "test", "01/01/2012", "usdate" );
assertEquals( true, r );

// eurodate
r = model.validate( result, this, "test", "1aa", "eurodate" );
assertEquals( false, r );
r = model.validate( result, this, "test", "23/01/2012", "eurodate" );
assertEquals( true, r );

// numeric
r = model.validate( result, this, "test", "1aa", "numeric" );
assertEquals( false, r );
Expand Down

0 comments on commit 8c4707b

Please sign in to comment.