1
0
Fork 0
mirror of synced 2024-06-13 16:24:47 +12:00

PR review changes

This commit is contained in:
Matej Bačo 2022-09-13 21:55:24 +00:00
parent 948049f944
commit 182db2b2e3
5 changed files with 5 additions and 20 deletions

View file

@ -51,7 +51,7 @@
"utopia-php/cache": "0.6.*",
"utopia-php/cli": "0.13.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.25.x",
"utopia-php/database": "0.25.*",
"utopia-php/locale": "0.4.*",
"utopia-php/registry": "0.5.*",
"utopia-php/preloader": "0.2.*",

2
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3df5d0b38aee7480e6a2a75effe15b93",
"content-hash": "aca68a1c1c7d762cabd02ce02cf40df4",
"packages": [
{
"name": "adhocore/jwt",

View file

@ -3937,9 +3937,7 @@ request.onerror=function(){reject(new Error("Network Error"));};request.send(par
return new Intl.DateTimeFormat(navigator.languages,{hourCycle:'h24',...format}).format(new Date(datetime));}
return{format:format,}}(),true);})(window);(function(window){"use strict";window.ls.container.set('env',function(){return APP_ENV;},true);})(window);(function(window){"use strict";window.ls.container.set('form',function(){function cast(value,from,to,){if(value&&Array.isArray(value)&&to!=='array'){value=value.map(element=>cast(element,from,to));return value;}
switch(to){case'int':case'integer':value=parseInt(value);break;case'numeric':value=Number(value);break;case'float':value=parseFloat(value);break;case'string':value=value.toString();if(value.length===0){value=null;}
break;case'string-datetime':if(value.length===0){value=null;}else{function prefixWithZero(value,minLength=2){value=value+"";while(value.length<minLength){value=`0${value}`;}
return value;}
const date=new Date(value);const isoTime=`${date.getUTCFullYear()}-${prefixWithZero(date.getUTCMonth() + 1)}-${prefixWithZero(date.getUTCDate())}T${prefixWithZero(date.getUTCHours())}:${prefixWithZero(date.getUTCMinutes())}:${prefixWithZero(date.getUTCSeconds())}.${prefixWithZero(date.getUTCMilliseconds(), 3)}+00:00`;value=isoTime;}
break;case'string-datetime':if(value.length===0){value=null;}else{const date=new Date(value);value=date.toISOString();}
break;case'json':value=(value)?JSON.parse(value):[];break;case'array':if(value&&value.constructor&&value.constructor===Array){break;}
if(from==='csv'){if(value.length===0){value=[];}else{value=value.split(',');}}else{value=[value];}
break;case'array-empty':value=[];break;case'bool':case'boolean':value=(value==='false')?false:value;value=!!value;break;}

View file

@ -525,9 +525,7 @@ request.onerror=function(){reject(new Error("Network Error"));};request.send(par
return new Intl.DateTimeFormat(navigator.languages,{hourCycle:'h24',...format}).format(new Date(datetime));}
return{format:format,}}(),true);})(window);(function(window){"use strict";window.ls.container.set('env',function(){return APP_ENV;},true);})(window);(function(window){"use strict";window.ls.container.set('form',function(){function cast(value,from,to,){if(value&&Array.isArray(value)&&to!=='array'){value=value.map(element=>cast(element,from,to));return value;}
switch(to){case'int':case'integer':value=parseInt(value);break;case'numeric':value=Number(value);break;case'float':value=parseFloat(value);break;case'string':value=value.toString();if(value.length===0){value=null;}
break;case'string-datetime':if(value.length===0){value=null;}else{function prefixWithZero(value,minLength=2){value=value+"";while(value.length<minLength){value=`0${value}`;}
return value;}
const date=new Date(value);const isoTime=`${date.getUTCFullYear()}-${prefixWithZero(date.getUTCMonth() + 1)}-${prefixWithZero(date.getUTCDate())}T${prefixWithZero(date.getUTCHours())}:${prefixWithZero(date.getUTCMinutes())}:${prefixWithZero(date.getUTCSeconds())}.${prefixWithZero(date.getUTCMilliseconds(), 3)}+00:00`;value=isoTime;}
break;case'string-datetime':if(value.length===0){value=null;}else{const date=new Date(value);value=date.toISOString();}
break;case'json':value=(value)?JSON.parse(value):[];break;case'array':if(value&&value.constructor&&value.constructor===Array){break;}
if(from==='csv'){if(value.length===0){value=[];}else{value=value.split(',');}}else{value=[value];}
break;case'array-empty':value=[];break;case'bool':case'boolean':value=(value==='false')?false:value;value=!!value;break;}

View file

@ -29,19 +29,8 @@
if (value.length === 0) {
value = null;
} else {
function prefixWithZero(value, minLength = 2) {
value = value + "";
while (value.length < minLength) {
value = `0${value}`;
}
return value;
}
const date = new Date(value);
const isoTime = `${date.getUTCFullYear()}-${prefixWithZero(date.getUTCMonth() + 1)}-${prefixWithZero(date.getUTCDate())}T${prefixWithZero(date.getUTCHours())}:${prefixWithZero(date.getUTCMinutes())}:${prefixWithZero(date.getUTCSeconds())}.${prefixWithZero(date.getUTCMilliseconds(), 3)}+00:00`;
value = isoTime;
value = date.toISOString();
}
break;
case 'json':