Skip to content

Commit d534f6a

Browse files
committed
Remove sf-options from example as it broke some examples
1 parent eba144a commit d534f6a

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

dist/schema-form.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,17 @@ return /******/ (function(modules) { // webpackBootstrap
21912191
value = undefined;
21922192
};
21932193

2194+
// Date fields are painful and return a date object
2195+
if (schema.type === 'string' && schema.format === 'date') {
2196+
if (value === null) {
2197+
value = undefined;
2198+
} else {
2199+
if (typeof value.toISOString === 'function') {
2200+
value = value.toISOString();
2201+
}
2202+
}
2203+
}
2204+
21942205
// Version 4 of JSON Schema has the required property not on the
21952206
// property itself but on the wrapping object. Since we like to test
21962207
// only this property we wrap it in a fake object.
@@ -3681,7 +3692,6 @@ return /******/ (function(modules) { // webpackBootstrap
36813692
});
36823693

36833694
exports.default = function (sfValidator, $parse, sfSelect) {
3684-
36853695
return {
36863696
restrict: 'A',
36873697
scope: false,

dist/schema-form.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ <h1>Schema Form Example</h1>
142142
<div class="col-sm-4">
143143
<h3>The Generated Form</h3>
144144

145-
<form name="ngform" sf-model="modelData" sf-form="form" sf-schema="schema" ng-submit="submitForm(ngform,modelData)" sf-options="{ formDefaults: { ngModelOptions: { updateOn: 'blur' } }}"></form>
145+
<form name="ngform" sf-model="modelData" sf-form="form" sf-schema="schema" ng-submit="submitForm(ngform,modelData)"></form>
146146
<!--
147+
sf-options="{ formDefaults: { ngModelOptions: { updateOn: 'blur' } }}"
147148
<form name="ngform"
148149
sf-model="modelData"
149150
sf-form="form"

src/directives/schemaValidate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import angular from 'angular';
22

33
export default function(sfValidator, $parse, sfSelect) {
4-
54
return {
65
restrict: 'A',
76
scope: false,

src/services/validator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ export default function() {
3737
value = undefined;
3838
};
3939

40+
// Date fields are painful and return a date object
41+
if (schema.type === 'string' && schema.format === 'date') {
42+
if (value === null) {
43+
value = undefined;
44+
}
45+
else {
46+
if (typeof value.toISOString === 'function') {
47+
value = value.toISOString();
48+
}
49+
}
50+
}
51+
4052
// Version 4 of JSON Schema has the required property not on the
4153
// property itself but on the wrapping object. Since we like to test
4254
// only this property we wrap it in a fake object.

0 commit comments

Comments
 (0)