Skip to content
Snippets Groups Projects
Commit 4c56762b authored by Alvaro Cabrera Durán's avatar Alvaro Cabrera Durán
Browse files

Apply formats for date/date-time; fix

parent a3c4662b
Branches
Tags
No related merge requests found
...@@ -139,6 +139,24 @@ function typecast(type, schema, callback) { ...@@ -139,6 +139,24 @@ function typecast(type, schema, callback) {
if (value.length > max) { if (value.length > max) {
value = value.substr(0, max); value = value.substr(0, max);
} }
switch (schema.format) {
case 'date-time':
case 'datetime':
value = new Date(value).toISOString();
break;
case 'date':
value = new Date(value).toISOString().substr(0, 10);
break;
case 'time':
value = new Date(value).toISOString().substr(11);
break;
default:
break;
}
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment